/* CSS Variables & Theme Config */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  
  /* Slate Theme Palettes */
  --bg-primary: #0b0f19;
  --bg-secondary: #161d30;
  --bg-tertiary: #1f2a45;
  --bg-glass: rgba(22, 29, 48, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #10b981;
  --accent-light: rgba(16, 185, 129, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --max-w-content: 800px;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* Global CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px; /* Offset for sticky header */
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75em;
}

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.75rem;
  margin-top: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

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

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

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5rem;
}

/* Glassmorphic Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.3s ease, border-bottom 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Button & Controls */
.btn-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
  width: 36px;
  height: 36px;
}

.btn-toggle:hover {
  background-color: var(--bg-tertiary);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Main Layout Setup */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Index / Landing Page */
.hero-section {
  text-align: center;
  padding: 4rem 1rem 3rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0.5rem auto 2rem;
  color: var(--text-secondary);
}

.search-container {
  max-width: 500px;
  margin: 0 auto 3rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.app-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-md);
}

.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.1);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-icon-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
}

.app-meta h3 {
  margin: 0;
}

.app-meta p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.compliance-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background-color: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Policy Detail Layout */
.policy-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: start;
}

/* Left Sidebar (Table of Contents) */
.policy-sidebar {
  position: sticky;
  top: 120px;
  height: auto;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.toc-list {
  list-style: none;
  padding-left: 0;
  border-left: 2px solid var(--border-color);
}

.toc-item {
  margin-bottom: 0;
}

.toc-link {
  display: block;
  padding: 0.4rem 0 0.4rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-left: 2px solid transparent;
  margin-left: -2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
}

.toc-link:hover, .toc-link.active {
  color: var(--primary);
}

.toc-link.active {
  border-left-color: var(--primary);
  font-weight: 600;
}

/* Right Content Area */
.policy-body {
  max-width: var(--max-w-content);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-glass);
}

.policy-info-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.policy-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.meta-item {
  font-size: 0.85rem;
}

.meta-label {
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Standard HTML Alert styling */
.alert-note {
  background-color: rgba(99, 102, 241, 0.06);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.5rem;
}

.alert-note p {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* Footer Section */
.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .policy-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .policy-sidebar {
    display: none; /* Hide TOC on mobile */
  }

  .policy-body {
    padding: 2rem 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }
}

/* Form Inputs and Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .form-input {
  background-color: var(--bg-tertiary);
}

/* Print Styling - For Clean PDF Exports */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .navbar, .policy-sidebar, .footer, .btn-toggle, .btn-primary {
    display: none !important;
  }

  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .policy-body {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  h1, h2, h3 {
    color: #000000 !important;
    page-break-after: avoid;
  }

  p, li {
    color: #333333 !important;
  }

  a {
    color: #000000 !important;
    text-decoration: underline !important;
  }
}
