/* ==========================================================================
   ASIS - Design System & Base Styles
   ========================================================================== */

/* 1. Variables (Design Tokens) */
:root {
  /* Colors */
  --color-primary: #0F62FE;
  --color-primary-dark: #0043CE;
  
  --color-core: #0F62FE;
  --color-edu: #7C3AED;
  --color-parent: #059669;
  --color-office: #0891B2;
  --color-id: #EA580C;
  
  --color-premium: #D97706;
  --color-dinas: #DC2626;
  
  --color-surface: #F8FAFC;
  --color-surface-hover: #F1F5F9;
  --color-white: #FFFFFF;
  
  --color-text: #1E293B;
  --color-muted: #64748B;
  --color-border: #E2E8F0;
  
  /* Typography */
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Shadows */
  --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 -2px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.07);
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 800;
  color: var(--color-text);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 2.5rem); }
h3 { font-size: 1.5rem; }

p {
  color: var(--color-muted);
  margin-bottom: var(--space-4);
}

a {
  text-decoration: none;
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 3. Utility Classes */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-muted); }
.font-bold { font-weight: 700; }

.bg-surface { background-color: var(--color-surface); }
.bg-white { background-color: var(--color-white); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

.py-16 { padding-top: var(--space-16); padding-bottom: var(--space-16); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: var(--space-4); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* 4. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

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

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

.btn-outline {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

/* 5. Layout Components */

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0;
  transition: box-shadow var(--transition-fast);
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.nav-item {
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  color: var(--color-primary);
}

.nav-actions {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

/* 6. Animations */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 7. Components */

/* Modul Card */
.modul-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  border-top: 4px solid var(--color-border);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.modul-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.modul-card.core { border-top-color: var(--color-core); }
.modul-card.edu { border-top-color: var(--color-edu); }
.modul-card.parent { border-top-color: var(--color-parent); }
.modul-card.office { border-top-color: var(--color-office); }
.modul-card.id { border-top-color: var(--color-id); }
.modul-card.analytics { border-top-color: var(--color-primary-dark); }

/* Pricing Card */
.pricing-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  position: relative;
  transition: transform var(--transition-fast);
}
.pricing-card:hover {
  transform: translateY(-4px);
}
.pricing-card.popular {
  border-color: var(--color-premium);
  box-shadow: var(--shadow-lg);
}
.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-premium);
  color: var(--color-white);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
.badge-premium { background: #FEF3C7; color: var(--color-premium); }
.badge-roadmap { background: #F1F5F9; color: var(--color-muted); }

/* Accordion FAQ */
.accordion-item {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
}
.accordion-header {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--space-4) 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}
.accordion-content.active {
  max-height: 500px;
}
.accordion-body {
  padding-bottom: var(--space-4);
  color: var(--color-muted);
}

/* Tabs */
.tabs-nav {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}
.tab-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  font-weight: 700;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}
.tab-content.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Footer */
.footer {
  background: var(--color-surface);
  padding: var(--space-12) 0 var(--space-4);
  border-top: 1px solid var(--color-border);
}
.footer-title {
  font-size: 1.125rem;
  font-weight: 800;
  margin-bottom: var(--space-4);
}
.footer-links li {
  margin-bottom: var(--space-2);
}
.footer-links a {
  color: var(--color-muted);
}
.footer-links a:hover {
  color: var(--color-primary);
}
.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin-top: var(--space-8);
  text-align: center;
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Global accessibility foundations */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #ffb04a;
  outline-offset: 3px;
}

:where(input, select, textarea):focus-visible {
  outline-color: rgba(23, 107, 255, 0.45);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Visual-only controls inside dashboard previews are not interactive. */
.chart-period {
  border: 1px solid #dfe6ef;
  background: #fff;
  border-radius: 4px;
  font-size: 5px;
  padding: 3px 6px;
}

/* ==========================================================================
   Footer — app store badges & legal row (global, loaded on every page)
   ========================================================================== */
.app-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.app-badges a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #000;
  border: 1px solid #33475f;
  border-radius: 9px;
  padding: 7px 13px;
  color: #fff;
  transition: border-color 150ms ease, transform 150ms ease;
}

.app-badges a:hover {
  border-color: #5b7396;
  transform: translateY(-2px);
  color: #fff;
}

.app-badges svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.app-badges .ab-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.app-badges .ab-text small {
  font-size: 7px;
  letter-spacing: 0.04em;
  color: #c7d2e0;
  text-transform: uppercase;
}

.app-badges .ab-text strong {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  margin-top: 8px;
}

.footer-legal a {
  font-size: 8px;
  color: #718398;
}

.footer-legal a:hover {
  color: #fff;
}

/* ===========================================================================
   Readability pass — canonical site-wide type scale (desktop, >=761px)
   ========================================================================== */
@media (min-width: 761px) {
  .nav-link, .nav-trigger { font-size: 14px !important; }
  .button, .nav-cta, .section-cta { font-size: 15px; }
  .footer-brand p { font-size: 13px; line-height: 1.7; }
  .footer-top h4 { font-size: 12.5px; }
  .footer-top > div:not(:first-child) a { font-size: 12.5px; }
  .socials a { font-size: 10px; }
  .footer-bottom p, .footer-bottom span, .footer-legal a { font-size: 11px; }
  .app-badges .ab-text small { font-size: 10px; }
  .app-badges .ab-text strong { font-size: 12.5px; }
}

/* ===========================================================================
   Mobile usability foundation (content controls, tables, dialogs, footer)
   ========================================================================== */
@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }

  main input:not([type="checkbox"]):not([type="radio"]),
  main select,
  main textarea,
  .auth-main input:not([type="checkbox"]):not([type="radio"]),
  .auth-main select,
  .auth-main textarea {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }

  .button,
  .primary-submit,
  .secondary-submit,
  .accordion-header,
  .tab-btn {
    min-height: 44px;
  }

  main table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  :where([role="dialog"], .modal, .dialog, .dialog-panel, .modal-card) {
    width: calc(100% - 24px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto;
    border-radius: 14px !important;
  }

  .site-footer { padding-top: 44px; }
  .site-footer .footer-top { grid-template-columns: 1fr !important; gap: 0 !important; }
  .site-footer .footer-brand { grid-column: auto !important; margin-bottom: 26px; }
  .site-footer .footer-brand p { font-size: 14px; line-height: 1.75; }
  .site-footer .footer-top > div:not(:first-child) { border-top: 1px solid rgba(255,255,255,.1); }
  .site-footer .footer-top > div:not(:first-child) > h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin: 0;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
  }
  .site-footer .footer-top > div:not(:first-child) > h4::after {
    content: '+';
    color: #8fa1ba;
    font-size: 18px;
  }
  .site-footer .footer-top > div.footer-mobile-open > h4::after { content: '−'; }
  .site-footer .footer-top > div:not(:first-child):not(.footer-mobile-open) > :not(h4) { display: none !important; }
  .site-footer .footer-top > div.footer-mobile-open > a {
    display: block;
    margin: 0 !important;
    padding: 10px 0;
    color: #9aabc1;
    font-size: 13px !important;
  }
  .site-footer .footer-bottom { margin-top: 30px; }
  .site-footer .footer-bottom p,
  .site-footer .footer-bottom span,
  .site-footer .footer-legal a { font-size: 11.5px; line-height: 1.65; }
  .app-badges .ab-text small { font-size: 10px; }
  .app-badges .ab-text strong { font-size: 12.5px; }
}
