@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* CSS Variables for Themes */
:root {
  /* Light Theme Variables */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-focus: #6366f1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #6366f1;
  --accent-secondary: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --tag-bg: rgba(99, 102, 241, 0.08);
  --tag-text: #4f46e5;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-premium: 0 20px 40px -15px rgba(15, 23, 42, 0.06);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --sidebar-width: 280px;
  --header-height: 72px;
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #818cf8;
  
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #6b7280;
  
  --accent-primary: #818cf8;
  --accent-secondary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a855f7 100%);
  --accent-glow: rgba(129, 140, 248, 0.25);
  --tag-bg: rgba(129, 140, 248, 0.12);
  --tag-text: #a5b4fc;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

/* Global Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-x: hidden;
}

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

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

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* App Header styling */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--accent-glow);
  color: #fff;
}

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

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

/* Search bar styling */
.search-wrapper {
  position: relative;
  width: 240px;
  display: none; /* Shown on desktop */
}

@media (min-width: 768px) {
  .search-wrapper {
    display: block;
  }
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  fill: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* Button styles */
.btn-action {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: var(--border-color);
  transform: translateY(-1px);
}

.btn-action svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Theme Toggle animation */
.theme-toggle .sun-icon { display: block; }
.theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }

/* Main Container Layout */
.app-container {
  max-width: 1280px;
  margin: var(--header-height) auto 0;
  display: flex;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: calc((100vw - 1280px) / 2);
  padding: 2.5rem 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  transition: all 0.4s ease;
  z-index: 10;
  display: none; /* Shown on desktop/tablet */
}

@media (min-width: 1024px) {
  .app-sidebar {
    display: block;
  }
}

/* Adjust left offset based on layout width limit */
@media (max-width: 1280px) {
  .app-sidebar {
    left: 0;
  }
}

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

.sidebar-nav {
  list-style: none;
}

.nav-item {
  margin-bottom: 0.35rem;
}

.nav-link {
  display: block;
  padding: 0.65rem 1rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding-left: 1.25rem;
}

.nav-link.active {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 600;
}

/* Main Content Area */
.app-content {
  flex: 1;
  padding: 2.5rem 1.5rem;
  margin-left: 0; /* Full width on mobile */
  max-width: 100%;
  transition: margin-left 0.4s ease;
}

@media (min-width: 1024px) {
  .app-content {
    margin-left: var(--sidebar-width);
    padding: 3.5rem 3rem;
  }
}

/* Hero Section */
.policy-hero {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-color);
  animation: fadeIn 0.8s ease-out;
}

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

.policy-title {
  font-size: 2.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

@media (min-width: 768px) {
  .policy-title {
    font-size: 3rem;
  }
}

.policy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-item svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Policy Content Blocks */
.policy-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: calc(var(--header-height) + 2rem);
  animation: slideUp 0.6s ease-out;
}

.section-icon-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--tag-bg);
  color: var(--tag-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.policy-section h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.policy-section p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.policy-section ul, .policy-section ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.policy-section li {
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.policy-section strong {
  color: var(--text-primary);
}

/* Interactive Cards / Highlights */
.highlight-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.highlight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-premium);
  border-color: var(--border-focus);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.card-title svg {
  width: 18px;
  height: 18px;
  fill: var(--accent-primary);
}

/* Custom Alert Banner */
.policy-alert {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-left: 4px solid #ef4444;
  border-radius: var(--border-radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
}

.alert-icon {
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.alert-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.alert-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.alert-text strong {
  color: var(--text-primary);
}

/* Grid layout for permissions */
.permissions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (min-width: 768px) {
  .permissions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.permission-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  transition: all 0.25s ease;
}

.permission-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
}

.permission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.permission-name {
  font-family: monospace;
  font-size: 0.85rem;
  background: var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--text-primary);
  font-weight: 600;
}

.permission-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.permission-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* User Deletion Drawer / Dynamic Interaction */
.action-box {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2.25rem;
  margin-top: 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.action-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.action-box-content {
  position: relative;
  z-index: 2;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: #ffffff;
  padding: 0.75rem 1.75rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  margin-top: 1.25rem;
  box-shadow: 0 4px 15px var(--accent-glow);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
  filter: brightness(1.1);
}

.action-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Highlight matching styles */
mark.search-highlight {
  background: #fde047;
  color: #000000;
  border-radius: 2px;
  padding: 0 0.15rem;
}

/* Floating Action Button (FAB) */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--accent-glow);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Footer Section */
.app-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 3rem 2rem;
  text-align: center;
  transition: background-color 0.4s ease;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.footer-logo svg {
  width: 24px;
  height: 24px;
}

.footer-logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent-primary);
}

/* Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  .app-header, 
  .app-sidebar, 
  .btn-action, 
  .scroll-top-btn, 
  .action-box, 
  .search-wrapper,
  .policy-meta .meta-item:not(.last-updated), 
  .app-footer {
    display: none !important;
  }

  .app-container {
    margin-top: 0 !important;
    min-height: auto !important;
  }

  .app-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .policy-hero {
    margin-bottom: 2rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 2px solid #000000 !important;
  }

  .policy-title {
    font-size: 24pt !important;
    color: #000000 !important;
  }

  .policy-section {
    page-break-inside: avoid;
    margin-bottom: 2rem !important;
  }

  .policy-section h2 {
    color: #000000 !important;
    font-size: 16pt !important;
    border-bottom: 1px solid #cccccc;
    padding-bottom: 0.2rem;
  }

  .highlight-card, 
  .permission-card, 
  .policy-alert {
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }

  .permission-status {
    border: 1px solid #000000;
    color: #000000 !important;
    background: none !important;
  }

  .section-icon {
    display: none !important;
  }
}
