/* =====================================================
   AI-Enabled MS Office & Advanced Excel
   Light-Only, Mobile-First, Clean & Modern UI/UX Theme
===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Clean Light Theme Palette */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-code: #0f172a;
  --bg-code-inline: #eff6ff;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-code: #f8fafc;

  --border-light: #e2e8f0;
  --border-focus: #3b82f6;

  /* Brand Accents */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  
  --mod1-color: #4f46e5;
  --mod1-subtle: #eef2ff;
  --mod2-color: #0284c7;
  --mod2-subtle: #f0f9ff;
  --mod3-color: #059669;
  --mod3-subtle: #ecfdf5;

  --danger: #dc2626;
  --danger-subtle: #fef2f2;
  --warning: #d97706;
  --warning-subtle: #fffbeb;
  --success: #16a34a;
  --success-subtle: #f0fdf4;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --header-height: 60px;
  --sidebar-width: 280px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* =====================================================
   Mobile-First Header & Navbar
===================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: var(--text-primary);
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Desktop navigation links - hidden on mobile */
.nav-links {
  display: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-trigger-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.search-trigger-text {
  display: none;
}

.search-shortcut {
  display: none;
}

/* =====================================================
   Mobile Sidebar Drawer & Overlay
===================================================== */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 82vw);
  background: var(--bg-surface);
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  border-right: 1px solid var(--border-light);
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-header-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 32px 12px;
}

.sidebar-body::-webkit-scrollbar {
  width: 4px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px 8px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none !important;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.sidebar-link:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-subtle); color: var(--primary); }
.badge-mod1 { background: var(--mod1-subtle); color: var(--mod1-color); }
.badge-mod2 { background: var(--mod2-subtle); color: var(--mod2-color); }
.badge-mod3 { background: var(--mod3-subtle); color: var(--mod3-color); }

/* =====================================================
   Main Layout & Content Area
===================================================== */
.layout-container {
  display: flex;
  flex: 1;
  width: 100%;
}

.main-wrapper {
  flex: 1;
  min-width: 0;
  padding: 20px 16px 60px 16px;
}

.content-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-light);
  font-size: 0.65rem;
}

/* Hero Section */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.hero-desc {
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.hero-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--border-light);
  padding-top: 18px;
}

.stat-item {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.stat-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none !important;
  line-height: 1.4;
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); color: #ffffff; }

.btn-mod1 { background: var(--mod1-color); color: #ffffff; }
.btn-mod1:hover { background: #4338ca; color: #ffffff; }

.btn-mod2 { background: var(--mod2-color); color: #ffffff; }
.btn-mod2:hover { background: #0369a1; color: #ffffff; }

.btn-mod3 { background: var(--mod3-color); color: #ffffff; }
.btn-mod3:hover { background: #047857; color: #ffffff; }

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--text-primary);
}

/* Card Grids */
.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none !important;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.card-mod1 .card-icon-box { background: var(--mod1-subtle); color: var(--mod1-color); }
.card-mod2 .card-icon-box { background: var(--mod2-subtle); color: var(--mod2-color); }
.card-mod3 .card-icon-box { background: var(--mod3-subtle); color: var(--mod3-color); }

.card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.card-mod1 .card-tag { color: var(--mod1-color); }
.card-mod2 .card-tag { color: var(--mod2-color); }
.card-mod3 .card-tag { color: var(--mod3-color); }

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

/* =====================================================
   Content Body & Markdown Typography
===================================================== */
.content-body h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.content-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 12px;
  line-height: 1.35;
}

.content-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 22px;
  margin-bottom: 10px;
}

.content-body h4 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 16px;
  margin-bottom: 6px;
}

.content-body p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content-body ul, .content-body ol {
  margin-bottom: 16px;
  padding-left: 20px;
  color: var(--text-secondary);
}

.content-body li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.content-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 36px 0;
}

/* Code Blocks & Copy */
.code-container {
  position: relative;
  margin: 16px 0 20px 0;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  z-index: 5;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.copy-code-btn.copied {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

pre {
  background: var(--bg-code);
  color: var(--text-code);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  border: 1px solid #1e293b;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

p code, li code, td code {
  background: var(--bg-code-inline);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #dbeafe;
  font-weight: 500;
}

/* Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  color: var(--text-secondary);
}

tr:nth-child(even) td {
  background: #fbfcfe;
}

/* Callouts / Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-note {
  background: var(--primary-subtle);
  border-left: 4px solid var(--primary);
  color: #1e40af;
}

.alert-tip {
  background: var(--success-subtle);
  border-left: 4px solid var(--success);
  color: #166534;
}

.alert-warning {
  background: var(--warning-subtle);
  border-left: 4px solid var(--warning);
  color: #92400e;
}

.alert-important {
  background: var(--danger-subtle);
  border-left: 4px solid var(--danger);
  color: #991b1b;
}

/* =====================================================
   Search Modal
===================================================== */
.search-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 50px 16px 16px 16px;
}

.search-backdrop.open {
  display: flex;
}

.search-window {
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.search-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text-primary);
}

.search-results {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.search-item:hover {
  background: var(--bg-subtle);
}

.search-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.search-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.search-item-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =====================================================
   Footer
===================================================== */
.footer {
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  padding: 28px 16px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* =====================================================
   Responsive Breakpoints (Mobile-First Upgrades)
===================================================== */

/* Tablet (>= 768px) */
@media (min-width: 768px) {
  .hero-card {
    padding: 32px 28px;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .search-trigger-text {
    display: inline;
  }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
  .navbar {
    padding: 0 24px;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .nav-item {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
  }

  .nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
  }

  .nav-item.active {
    color: var(--primary);
    background: var(--primary-subtle);
  }

  .search-shortcut {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
  }

  .mobile-menu-btn {
    display: none !important;
  }

  /* Desktop Static Sidebar */
  .sidebar-overlay {
    display: none !important;
  }

  .sidebar {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-width);
    transform: none !important;
    box-shadow: none;
    flex-shrink: 0;
  }

  .sidebar-header {
    display: none;
  }

  .main-wrapper {
    padding: 32px 40px 80px 40px;
  }

  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media print {
  .navbar, .sidebar, .copy-code-btn, .search-trigger-btn, .btn-icon, .footer {
    display: none !important;
  }
  .main-wrapper {
    padding: 0 !important;
  }
}
