/* Premium Legal Stylesheet - Matixo */

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

:root {
  /* Fonts */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Theme: Light Mode */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 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);
  
  /* Brand Gradients & Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --accent: #a855f7;
  --accent-light: #f3e8ff;
  
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f1f5f9;
}

[data-theme="dark"] {
  /* Theme: Dark Mode */
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-light: rgba(99, 102, 241, 0.15);
  --accent: #c084fc;
  --accent-light: rgba(168, 85, 247, 0.15);
  
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-text: #34d399;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-text: #f87171;
  
  --scrollbar-thumb: #475569;
  --scrollbar-track: #1e293b;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar Customization */
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);

@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
  }
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] header {
  background-color: rgba(15, 23, 42, 0.8);
}

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

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

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

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  background-color: var(--border);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

/* Main Container Layout */
.main-wrapper {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 2rem;
  display: flex;
  gap: 2.5rem;
}

.main-wrapper.no-sidebar {
  max-width: 800px;
  justify-content: center;
}

.content-card {
  flex: 1;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem;
  box-shadow: var(--shadow);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Sticky Sidebar Table of Contents */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
  height: fit-content;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

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

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc-link {
  display: block;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--primary);
  border-left-color: var(--primary-light);
  padding-left: 0.9rem;
}

.toc-link.active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
  background-color: var(--primary-light);
  border-radius: 0 4px 4px 0;
}

/* Typographic Elements */
h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.last-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: inline-block;
  background-color: var(--scrollbar-track);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 500;
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

p {
  margin-bottom: 1.2rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

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

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

li {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

/* Styled Lists for Do/Do Not sections */
.list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.list-item-card {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  display: flex;
  gap: 0.75rem;
  font-size: 1rem;
}

.list-item-card.success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.list-item-card.danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.list-item-card svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

th {
  background-color: var(--scrollbar-track);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) td {
  background-color: rgba(248, 250, 252, 0.5);
}

[data-theme="dark"] tr:nth-child(even) td {
  background-color: rgba(30, 41, 59, 0.3);
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

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

/* Landing Portal Styling */
.portal-container {
  max-width: 800px;
  margin: 5rem auto;
  padding: 0 2rem;
  text-align: center;
}

.portal-logo-glow {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  color: white;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.portal-logo-glow svg {
  width: 44px;
  height: 44px;
}

.portal-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.portal-subtitle {
  color: var(--text-secondary);
  font-size: 1.25rem;
  margin-bottom: 3.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.portal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.5rem;
  text-align: left;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.portal-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.portal-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.portal-card-icon svg {
  width: 24px;
  height: 24px;
}

.portal-card:nth-child(2) .portal-card-icon {
  background-color: var(--accent-light);
  color: var(--accent);
}

.portal-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

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

.portal-card-link {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
}

.portal-card:nth-child(2) .portal-card-link {
  color: var(--accent);
}

.portal-footer {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

/* Floating Back-to-Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--primary);
  color: white;
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 99;
}

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

.back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Footer Section */
footer.legal-footer {
  text-align: center;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background-color: var(--bg-card);
}

/* Responsive Overrides */
@media (max-width: 992px) {
  .sidebar {
    display: none; /* Hide TOC on medium screens for simplicity */
  }
  .content-card {
    padding: 2.5rem;
  }
}

@media (max-width: 768px) {
  .main-wrapper {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }
  .content-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
  }
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.4rem;
  }
  .nav-container {
    padding: 1rem;
  }
  .nav-links {
    gap: 1rem;
  }
  .nav-link {
    font-size: 0.85rem;
  }
  .portal-container {
    margin: 3rem auto;
    padding: 0 1rem;
  }
  .portal-title {
    font-size: 2.25rem;
  }
}

/* Print Overrides */
@media print {
  body {
    background-color: white;
    color: black;
  }
  header, .sidebar, .back-to-top, footer.legal-footer {
    display: none !important;
  }
  .main-wrapper {
    margin: 0;
    padding: 0;
  }
  .content-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 85%;
  }
  h2 {
    page-break-before: always;
  }
}
