/* ================================================================
   Tutor Jurídico — Legal/Corporate Design System
   ================================================================ */

/* --- CSS Custom Properties ------------------------------------ */
:root {
  --color-primary: #1a2332;       /* Deep navy */
  --color-primary-light: #243447; /* Sidebar hover */
  --color-accent: #c9a84c;        /* Gold accent */
  --color-accent-hover: #d4b65e;
  --color-surface: #ffffff;
  --color-background: #f4f5f7;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;
  --color-border: #e2e8f0;
  --color-success: #059669;
  --color-danger: #dc2626;

  --sidebar-width: 260px;
  --sidebar-collapsed: 0px;
  --header-height: 0px;          /* No top bar */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: 200ms ease;
}


/* --- Reset & Base --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-background);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-text);
  margin-top: 0;
  line-height: 1.3;
}

p { margin: 0 0 0.75rem; color: var(--color-text-muted); line-height: 1.6; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }


/* --- Sidebar ------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-primary);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: var(--color-primary);
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section {
  padding: 6px 16px;
  margin-top: 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  padding: 0 4px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  font-size: 13.5px;
  font-weight: 450;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--color-primary-light);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(201,168,76,.15);
  color: var(--color-accent);
}

.sidebar-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .6;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 13px; color: rgba(255,255,255,.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px; color: rgba(255,255,255,.4);
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 1100;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}


/* --- Main content area --------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 32px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.page-header .breadcrumb-text {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.page-body {
  flex: 1;
  padding: 28px 32px;
}


/* --- Card component ------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-body {
  padding: 20px 24px;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 15px;
}


/* --- Section cards (home page) ------------------------------- */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 28px 24px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.section-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--color-accent);
}

.section-card-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--color-border);
  transition: border-color var(--transition);
}

.section-card:hover .section-card-icon {
  border-color: var(--color-accent);
}

.section-card-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.section-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.section-card-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
}


/* --- Category buttons (section pages) ------------------------ */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}

.category-btn:hover {
  border-color: var(--color-accent);
  background: #fffdf5;
  box-shadow: var(--shadow-sm);
}

.category-btn.active {
  border-color: var(--color-accent);
  background: rgba(201,168,76,.08);
  color: var(--color-primary);
  font-weight: 600;
}

.category-btn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}


/* --- Accordion (document list) ------------------------------- */
.doc-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accordion-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  margin-bottom: 10px;
}

.accordion-button {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-primary);
  padding: 14px 20px;
}

.accordion-button:not(.collapsed) {
  background: var(--color-primary);
  color: #fff;
  box-shadow: none;
}

.accordion-button:focus {
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
  border-color: var(--color-accent);
}

.accordion-body {
  text-align: left;
  line-height: 1.7;
  color: var(--color-text);
  padding: 20px 24px 8px;
  font-size: 13.5px;
}

.accordion-body h4 {
  margin: 18px 0 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--color-primary);
}

.accordion-body h4:first-child {
  margin-top: 0;
}

.accordion-body p,
.accordion-body li {
  color: var(--color-text-muted);
  font-size: 13.5px;
  line-height: 1.7;
}

/* Navigation button inside accordion items ("button button3") */
.accordion-collapse .button.button3,
.accordion-item .button.button3 {
  display: block;
  width: calc(100% - 48px);
  margin: 8px 24px 20px;
  padding: 11px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}

.accordion-collapse .button.button3:hover,
.accordion-item .button.button3:hover {
  background: var(--color-accent);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}


/* --- Form page layout ---------------------------------------- */
.form-page {
  display: flex;
  flex: 1;
  min-height: calc(100vh);
}

.form-panel {
  width: 50%;
  padding: 28px 32px;
  overflow-y: auto;
}

.form-panel-left {
  background: var(--color-primary);
  color: #fff;
}

.form-panel-left h2 {
  color: #fff;
  font-size: 20px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.form-panel-left h3 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-panel-left p {
  color: rgba(255,255,255,.55);
  font-size: 14px;
  margin-bottom: 10px;
}

.form-panel-right {
  background: var(--color-background);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* Form sections */
.form-section {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.form-section .form-control {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  transition: border-color var(--transition);
}

.form-section .form-control::placeholder {
  color: rgba(255,255,255,.35);
}

.form-section .form-control:focus {
  background: rgba(255,255,255,.1);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
  color: #fff;
  outline: none;
}

.form-section select.form-control {
  appearance: auto;
}

.form-section select.form-control option {
  background: var(--color-primary);
  color: #fff;
}

.form-section select.form-control option:hover,
.form-section select.form-control option:focus,
.form-section select.form-control option:checked {
  background: #fff;
  color: var(--color-primary);
}

/* Child fields nested inside a parent form-section */
.form-child {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.form-child h4 {
  color: rgba(255,255,255,.9);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-child p {
  color: rgba(255,255,255,.55);
  font-size: 13px;
  margin-bottom: 6px;
}

.form-child .help-text {
  font-style: italic;
  opacity: .7;
  margin-bottom: 10px;
}

.form-child .help-text p {
  margin-bottom: 4px;
}

.form-child .help-text .sublinhado {
  text-decoration: underline;
  font-weight: 600;
  opacity: 1;
}

.form-child .help-text .italico {
  font-style: italic;
}

/* DOCX preview container */
.docx-preview-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #fafafa;
  border-left: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 14px;
}


/* --- Buttons ------------------------------------------------- */
.btn-primary-gold {
  background: var(--color-accent);
  color: var(--color-primary);
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary-gold:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.2);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-outline:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.3);
  color: #fff;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}


/* --- Login page (no sidebar) --------------------------------- */
.login-page {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.login-left {
  width: 45%;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-left::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(201,168,76,.04);
  bottom: -200px; right: -200px;
}

.login-brand-icon {
  width: 64px; height: 64px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--color-primary);
  margin-bottom: 24px;
}

.login-title {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  text-align: center;
}

.login-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,.5);
  margin-top: 12px;
  text-align: center;
}

.login-right {
  width: 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--color-background);
}

.login-form-container {
  width: 100%;
  max-width: 380px;
}

.login-form-container h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-form-container .login-desc {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--color-surface);
}

.login-field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201,168,76,.12);
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.login-btn:hover {
  background: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}


/* --- Updates panel (home page) ------------------------------- */
.updates-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.updates-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.updates-panel-body {
  padding: 16px 20px;
  max-height: 320px;
  overflow-y: auto;
}

.update-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  line-height: 1.6;
}

.update-item:last-child { border-bottom: none; }

.update-date {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 12px;
}


/* --- Loading spinner ----------------------------------------- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(201,168,76,.25);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(244,245,247,.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-text {
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer { to { background-position: -200% 0; } }


/* --- Flash messages ------------------------------------------ */
.flash-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .3s ease;
}

.flash-msg.success { background: #ecfdf5; color: #065f46; border-left: 3px solid var(--color-success); }
.flash-msg.danger  { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--color-danger); }
.flash-msg.warning { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.flash-msg.info    { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }

@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }


/* --- Responsive ---------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; }

  .form-page { flex-direction: column; }
  .form-panel { width: 100%; }

  .login-page { flex-direction: column; }
  .login-left { width: 100%; padding: 32px; }
  .login-right { width: 100%; }
  .login-title { font-size: 28px; }
}

@media (max-width: 768px) {
  .section-cards { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .page-body { padding: 20px 16px; }
  .page-header { padding: 16px; }
}


/* --- Backwards compat: keep old accordion/Quill working ------ */
.right-side-acordeao {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Quill font/size pickers (carried from style3.css) */
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
  content: attr(data-value) !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value]::before {
  content: attr(data-value) !important;
}

/* Utility */
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
