/* =============================================================================
   AkademiQ Campus - Main Stylesheet
   Design System from Brandbook 2026
   ============================================================================= */

/* -------------------------------------------------------------------------
   CSS VARIABLES / DESIGN TOKENS
   ------------------------------------------------------------------------- */

:root {
  /* Primary Palette */
  --color-primary: #0D1B2A;
  --color-primary-light: #1B4965;
  --color-primary-dark: #0A1220;

  /* Secondary */
  --color-secondary: #1B4965;
  --color-teal: #2B7A78;

  /* Accent Colors */
  --color-accent: #5EEAD4;
  --color-accent-purple: #7C3AED;
  --color-accent-gold: #F59E0B;
  --color-accent-red: #C8102E;

  /* Dark Theme (Default) */
  --bg-primary: #0D1B2A;
  --bg-surface: #1B4965;
  --bg-surface-muted: #1E3A5F;
  --bg-elevated: #243B55;

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);
  --border-color-active: rgba(94, 234, 212, 0.4);

  /* Text Colors */
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-inverse: #0D1B2A;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-warning: #F97316;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Font Sizes (phi-based scale) */
  --text-xs: 10px;
  --text-sm: 13px;
  --text-base: 16px;
  --text-md: 21px;
  --text-lg: 26px;
  --text-xl: 34px;
  --text-2xl: 42px;
  --text-3xl: 55px;

  /* Line Heights */
  --leading-tight: 1.15;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing (Fibonacci) */
  --space-0: 0px;
  --space-1: 1px;
  --space-2: 2px;
  --space-3: 3px;
  --space-4: 5px;
  --space-5: 8px;
  --space-6: 13px;
  --space-7: 21px;
  --space-8: 34px;
  --space-9: 55px;
  --space-10: 89px;
  --space-11: 144px;

  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 5px;
  --radius-xl: 8px;
  --radius-2xl: 13px;
  --radius-3xl: 21px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --shadow-glow-cyan: 0 0 20px rgba(94, 234, 212, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);

  /* Motion */
  --duration-fast: 89ms;
  --duration-normal: 144ms;
  --duration-medium: 233ms;
  --duration-slow: 377ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1070;

  /* Layout */
  --sidebar-width: 260px;
  --navbar-height: 64px;
  --content-max-width: 1200px;
}

/* -------------------------------------------------------------------------
   CSS RESET
   ------------------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* -------------------------------------------------------------------------
   TYPOGRAPHY
   ------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); font-weight: var(--font-medium); }

p {
  margin-bottom: var(--space-6);
}

p:last-child {
  margin-bottom: 0;
}

.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--color-accent); }
.text-purple { color: var(--color-accent-purple); }
.text-gold { color: var(--color-accent-gold); }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* -------------------------------------------------------------------------
   LAYOUT UTILITIES
   ------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--space-7);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-7 { gap: var(--space-7); }
.gap-8 { gap: var(--space-8); }

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

.w-full { width: 100%; }
.h-full { height: 100%; }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* -------------------------------------------------------------------------
   SPACING UTILITIES
   ------------------------------------------------------------------------- */

.m-0 { margin: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-7 { margin-bottom: var(--space-7); }
.mb-8 { margin-bottom: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-7 { padding: var(--space-7); }
.p-8 { padding: var(--space-8); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.px-7 { padding-left: var(--space-7); padding-right: var(--space-7); }
.py-5 { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-7 { padding-top: var(--space-7); padding-bottom: var(--space-7); }

/* -------------------------------------------------------------------------
   ANIMATIONS
   ------------------------------------------------------------------------- */

/* Page fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--duration-medium) var(--ease-out);
}

/* Fade in up for scroll reveal */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-on-scroll {
  opacity: 0;
}

.animate-on-scroll.is-visible {
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

/* Stagger children */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 80ms; }
.stagger-children > *:nth-child(3) { animation-delay: 160ms; }
.stagger-children > *:nth-child(4) { animation-delay: 240ms; }
.stagger-children > *:nth-child(5) { animation-delay: 320ms; }
.stagger-children > *:nth-child(6) { animation-delay: 400ms; }
.stagger-children > *:nth-child(7) { animation-delay: 480ms; }
.stagger-children > *:nth-child(8) { animation-delay: 560ms; }

/* Like bounce */
@keyframes likeBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.like-bounce {
  animation: likeBounce var(--duration-medium) var(--ease-spring);
}

/* Shimmer for skeleton loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
}

/* Pro badge shimmer */
@keyframes proShimmer {
  0% { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

.pro-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-accent-purple) 0%,
    #A78BFA 50%,
    var(--color-accent-purple) 100%
  );
  background-size: 200% 100%;
  animation: proShimmer 3s ease infinite;
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Slide in from right (toast) */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Modal scale */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

/* -------------------------------------------------------------------------
   SELECTION & SCROLLBAR
   ------------------------------------------------------------------------- */

::selection {
  background: var(--color-accent);
  color: var(--text-inverse);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-surface);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-elevated);
}

/* -------------------------------------------------------------------------
   VISUALLY HIDDEN (Accessibility)
   ------------------------------------------------------------------------- */

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

/* -------------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
   ------------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

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

  .hide-tablet { display: none !important; }
}

/* Mobile */
@media (max-width: 480px) {
  :root {
    --text-3xl: 42px;
    --text-2xl: 34px;
    --text-xl: 26px;
  }

  .container {
    padding: 0 var(--space-6);
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .hide-mobile { display: none !important; }
}
