/* ----------------------------------------------------
   1. Design System & CSS Variables
---------------------------------------------------- */
:root {
  /* Fonts */
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  /* Theme: Light Mode (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-glass-border: rgba(226, 232, 240, 0.8);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --color-accent: #6366f1; /* Indigo */
  --color-accent-hover: #4f46e5;
  --color-accent-glow: rgba(99, 102, 241, 0.15);
  
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-warning-border: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.08);

  --header-height: 80px;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
}

/* Dark Mode Overrides */
body.dark-theme {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass-border: rgba(37, 99, 235, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --color-accent: #3b82f6; /* Premium Blue */
  --color-accent-hover: #60a5fa;
  --color-accent-glow: rgba(59, 130, 246, 0.25);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------------------
   2. Reset & General Styles
---------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.7;
  transition: var(--transition-smooth);
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-smooth);
}

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

/* Background Glow Effects */
.bg-gradient-glow {
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
}

.bg-gradient-glow.top-left {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
}

.bg-gradient-glow.bottom-right {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
}

/* ----------------------------------------------------
   3. Buttons & Interactive Elements
---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--bg-glass-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--bg-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* Manage light/dark toggle icons */
body.light-theme .sun-icon { display: none; }
body.light-theme .moon-icon { display: block; }
body.dark-theme .sun-icon { display: block; }
body.dark-theme .moon-icon { display: none; }

/* ----------------------------------------------------
   4. Layout: Header & Footer
---------------------------------------------------- */
.app-header {
  height: var(--header-height);
  background-color: rgba(var(--bg-secondary), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.header-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.logo-subtext {
  color: var(--color-accent);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--bg-glass-border);
  padding: 40px 24px;
  text-align: center;
  margin-top: 80px;
}

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

.footer-note {
  margin-top: 8px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ----------------------------------------------------
   5. Layout: Main Grid & Sidebar
---------------------------------------------------- */
.main-content {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 0 24px;
}

.page-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 64px;
}

.sidebar-nav {
  position: relative;
}

.sticky-nav-container {
  position: sticky;
  top: calc(var(--header-height) + 40px);
}

.nav-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 12px;
}

#table-of-contents ul {
  list-style: none;
}

#table-of-contents li {
  margin-bottom: 8px;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  border-left: 2px solid transparent;
  transition: var(--transition-smooth);
}

.nav-link:hover {
  background-color: rgba(99, 102, 241, 0.05);
  color: var(--color-accent);
}

.nav-link.active {
  color: var(--color-accent);
  font-weight: 600;
  border-left-color: var(--color-accent);
  background-color: var(--color-accent-glow);
}

/* ----------------------------------------------------
   6. Content Styles (Article, Cards, Disclosures)
---------------------------------------------------- */
.policy-article {
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--border-radius-lg);
  padding: 48px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.policy-header {
  border-bottom: 1px solid var(--bg-glass-border);
  padding-bottom: 32px;
  margin-bottom: 40px;
}

.policy-tag {
  display: inline-block;
  background-color: var(--color-success-bg);
  color: var(--color-success);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 16px;
}

#policy-title {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.policy-last-updated {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.policy-section {
  margin-bottom: 48px;
}

.policy-section h2 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 8px;
}

.policy-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: var(--color-accent);
  border-radius: 2px;
}

.policy-section p {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

/* Info Cards */
.info-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}

.info-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--border-radius-md);
  padding: 24px;
  transition: var(--transition-smooth);
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--color-accent);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.info-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.info-card p {
  font-size: 0.95rem;
  margin-bottom: 0;
  color: var(--text-secondary);
}

/* Disclosure Box */
.disclosure-box {
  background-color: var(--bg-primary);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  padding: 24px;
  margin: 24px 0;
}

.disclosure-box h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.disclosure-box p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Permissions List */
.permissions-list {
  list-style: none;
  margin: 24px 0;
}

.permissions-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 16px;
  font-size: 1.02rem;
}

.permissions-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 2px;
  color: var(--color-success);
  font-weight: 700;
  font-size: 1.1rem;
}

/* Warnings / Info Alert */
.warning-alert {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--border-radius-sm);
  padding: 16px 20px;
  font-size: 0.95rem !important;
  color: var(--text-primary);
}

/* Third-Party Service Links */
.third-party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.tp-service-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
}

.tp-service-link:hover {
  border-color: var(--color-accent);
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

.tp-service-logo {
  font-size: 1.8rem;
}

.tp-service-info {
  display: flex;
  flex-direction: column;
}

.tp-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.tp-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Contact box */
.contact-box {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background-color: var(--bg-primary);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--border-radius-md);
  margin-top: 16px;
}

.contact-icon {
  font-size: 2rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
}

.contact-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.contact-link {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ----------------------------------------------------
   7. Responsive Styles
---------------------------------------------------- */
@media (max-width: 992px) {
  .page-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .sidebar-nav {
    display: none; /* Hide TOC on smaller screens to prioritize reading */
  }
}

@media (max-width: 768px) {
  .logo-text {
    font-size: 1.15rem;
  }
  
  .policy-article {
    padding: 24px;
  }
  
  #policy-title {
    font-size: 2rem;
  }
  
  .info-card-grid, .third-party-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------------------
   8. Print Styles (@media print)
---------------------------------------------------- */
@media print {
  /* Hide interactive / non-content elements */
  .app-header, 
  .sidebar-nav, 
  .bg-gradient-glow, 
  #theme-toggle, 
  #print-btn, 
  .app-footer {
    display: none !important;
  }
  
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .page-container {
    display: block !important;
  }
  
  .policy-article {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  
  .policy-header {
    border-bottom: 2px solid #000000 !important;
    margin-bottom: 30px !important;
    padding-bottom: 15px !important;
  }
  
  /* Ensure page breaks don't orphan headings */
  h2, h3 {
    page-break-after: avoid;
    break-after: avoid;
  }
  
  .policy-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .info-card-grid, .third-party-grid {
    display: block !important;
  }
  
  .info-card, .disclosure-box, .tp-service-link, .contact-box {
    border: 1px solid #cccccc !important;
    background-color: transparent !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  a {
    text-decoration: underline !important;
    color: #000000 !important;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 85%;
  }
}
