@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  --bg: #0b1020;
  --bg-soft: #11182d;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-2: #8b5cf6;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  --radius: 24px;
  --radius-sm: 14px;
  --max-width: 1400px;
  --sidebar-width: 290px;
  --topbar-height: 78px;
  --transition: all 0.28s ease;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 25%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 25%),
    linear-gradient(180deg, #0a0f1f 0%, #0d1326 100%);
  color: var(--text);
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 999;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  backdrop-filter: blur(18px);
  background: rgba(11, 16, 32, 0.78);
  border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-center {
  flex: 1;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  padding: 0.25rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
}

.search-box {
  width: min(100%, 620px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.85rem 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.search-box i {
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
}

.search-box input::placeholder {
  color: #7c8aa5;
}

/* ===== BUTTONS ===== */
.btn,
.icon-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.1);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: white;
}

.btn.secondary {
  background: rgba(255,255,255,0.08);
}

.btn.light {
  background: rgba(255,255,255,0.05);
}

.icon-btn {
  width: 46px;
  height: 46px;
  justify-content: center;
  padding: 0;
}

.mobile-only {
  display: none;
}

/* ===== DROPDOWN ===== */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 270px;
  display: none;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dropdown:hover .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
}

.dropdown-menu a:hover {
  background: rgba(255,255,255,0.06);
}

/* ===== LAYOUT ===== */
.docs-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
  width: var(--sidebar-width);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--border);
  background: rgba(7, 11, 24, 0.55);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f8ba5;
  margin: 0 0 0.35rem 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  text-decoration: none;
  color: #cbd5e1;
  transition: var(--transition);
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
  transform: translateX(4px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(139,92,246,0.15));
  border-color: rgba(59,130,246,0.28);
  color: white;
}

.sidebar-shortcuts {
  margin-top: 1rem;
}

.sidebar-mini-link {
  display: inline-block;
  padding: 0.55rem 0.8rem;
  margin: 0.2rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  transition: var(--transition);
}

.sidebar-mini-link:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.1);
}

/* ===== CONTENT ===== */
.content-area {
  flex: 1;
  min-width: 0;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
}

/* ===== HERO ===== */
.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 1.5rem;
  padding: 2rem;
  margin-bottom: 2.2rem;
  border-radius: 32px;
}

.glass {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-content h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin: 1rem 0 0.75rem;
  line-height: 1.05;
}

.hero-content p {
  color: #c9d2e3;
  font-size: 1.05rem;
  max-width: 65ch;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.stat-card {
  padding: 1.2rem 1.3rem;
  border-radius: 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.stat-label {
  display: block;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ===== SECTIONS ===== */
.dashboard-section,
.section {
  margin-bottom: 2.5rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.section-heading h2,
.section h2 {
  margin: 0.5rem 0 0;
  font-size: 1.85rem;
  color: #9ec4ff;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.section-description {
  color: var(--muted);
  max-width: 520px;
  line-height: 1.7;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ===== CARDS ===== */
.dashboard-card {
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 1.5rem;
  border-radius: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(59,130,246,0.16), transparent 35%);
  opacity: 0;
  transition: var(--transition);
}

.dashboard-card:hover::before {
  opacity: 1;
}

.dashboard-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255,255,255,0.16);
}

.dashboard-card h3 {
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 1.18rem;
  color: #9ec4ff;
}

.dashboard-card p {
  color: #c5cfdf;
  line-height: 1.7;
  min-height: 88px;
}

.dashboard-card .footer {
  margin-top: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.featured-card {
  border-top: 4px solid var(--accent);
}

.danger-card {
  border-top: 4px solid var(--danger);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}
.card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.card h4 {
  color: #9ec4ff;
  margin-top: 0;
  font-size: 1.2rem;
}
.card p {
  color: #c5cfdf;
}

/* ===== PILLS ===== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #cfe0ff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.white-pill {
  color: white;
}

.card-tag {
  margin-bottom: 0.35rem;
}

/* ===== TEXT BLOCK ===== */
.explain {
  margin-top: 1rem;
  padding: 1.2rem 1.3rem;
  border-radius: 22px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  line-height: 1.8;
  color: #d4deef;
}

.muted {
  color: var(--muted);
}

.small-note {
  font-size: 0.92rem;
}

.footer-note {
  text-align: center;
  padding: 2rem 0 1rem;
  color: var(--muted);
}

/* ===== REVEAL ANIMATION ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: all 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== SEARCH HIDE ===== */
.hidden-by-search {
  display: none !important;
}

/* ===== TABLES (MERGED FROM OLD CSS) ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 2rem 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text);
}

th {
  background: var(--surface-strong);
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
}

tr:hover td { background-color: var(--surface); }
tr:last-child td { border-bottom: none; }

/* ===== MODULE TITLE (MERGED FROM HTML) ===== */
.module-table-title {
  background-color: var(--surface-strong) !important;
  color: var(--text) !important;
  padding: 10px 15px;
  font-weight: bold;
  border-left: 4px solid var(--accent) !important;
  margin-top: 30px;
  margin-bottom: 10px;
  border-radius: 4px;
}

/* ===== UTILS (MERGED FROM OLD) ===== */
code {
  background: var(--surface-strong);
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  color: #fb7185;
}

.report-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin: 2rem 0;
  border: 1px solid var(--border);
}


/* ===== RESPONSIVE ===== */
@media (max-width: 1180px) {
  .section-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: var(--topbar-height);
    width: 300px;
    z-index: 1000;
    transition: var(--transition);
  }

  .sidebar.open {
    left: 0;
  }

  .topbar-center {
    display: none;
  }

  .container {
    padding: 1.25rem;
  }

  .topbar-right .btn.secondary {
    display: none;
  }
}

@media (max-width: 700px) {
  .section-grid {
    grid-template-columns: 1fr;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .topbar {
    padding: 0 0.8rem;
  }

  .brand-subtitle {
    display: none;
  }

  .dashboard-card p {
    min-height: auto;
  }
}

/* ===== ÍNDICES (TOC) ===== */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.toc-list li {
  margin-bottom: 0.75rem;
  border-left: 3px solid transparent;
  padding-left: 1rem;
  transition: var(--transition);
}

.toc-list li:hover {
  border-left-color: var(--accent);
  background: rgba(255,255,255,0.02);
}

.toc-list a {
  text-decoration: none;
  color: #9ec4ff;
  font-weight: 500;
  display: block;
  font-size: 1.05rem;
}

.toc-list a:hover {
  color: white;
}

/* ===== PRINT STYLES ===== */
@media print {
  @page {
    margin: 2cm;
    size: A4;
  }
  
  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  .topbar, .sidebar, .nav-actions, .no-print, .btn, .hero-actions { display: none !important; }
  
  .docs-layout { display: block; }
  .content-area { width: 100%; }
  
  .container { margin: 0; width: 100%; max-width: 100%; padding: 0; }
  
  .hero {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border-bottom: 2pt solid var(--accent);
    border-radius: 0;
    padding: 0 0 1rem 0;
    margin-bottom: 2rem;
    grid-template-columns: 1fr;
  }
  
  .hero::after { display: none; }
  .hero-content h1 { color: var(--accent) !important; font-size: 24pt; }
  .hero-content p { color: #333 !important; font-size: 12pt; }
  .hero-stats { display: none; }

  .dashboard-section, .section {
    box-shadow: none !important;
    border: none !important;
    padding: 1rem 0;
    break-inside: avoid;
    border-top: 1pt solid #ccc;
    margin: 1.5rem 0;
  }

  h2 { color: var(--accent) !important; font-size: 18pt; break-after: avoid; }
  
  .table-wrapper { border: 1pt solid #ccc; border-radius: 0; box-shadow: none; overflow: visible; background: white; }
  table { border-collapse: collapse; page-break-inside: auto; background: white; }
  tr { page-break-inside: avoid; page-break-after: auto; color: black; }
  th { background: #eee !important; color: black !important; border: 1pt solid #ccc; }
  td { border: 1pt solid #ccc; color: black !important; background: white !important; }

  .explain {
    background: #f9f9f9 !important;
    color: black !important;
    border: 1pt solid #ddd;
    border-left: 5pt solid var(--accent);
    page-break-inside: avoid;
  }

  .pill { border: 1pt solid #ccc; background: transparent !important; color: black !important; }

  .footer-note {
    border-top: 1pt solid #ccc;
    padding-top: 1rem;
    font-size: 9pt;
    color: #666;
    text-align: center;
  }
}
