/* ============================================
   Tuition Connect — Neumorphic Design System
   ============================================
   A comprehensive design system built on soft UI
   principles with extruded elements, smooth shadows,
   and a cohesive color palette.
   ============================================ */

/* ── CSS Custom Properties (Design Tokens) ──── */
:root {
  /* ── Color Palette ─────────────────────── */
  --bg-primary: #e0e5ec;
  --bg-secondary: #d1d9e6;
  --bg-card: #e0e5ec;
  --bg-dark: #2d3436;
  --bg-darker: #1e272e;

  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #536170;
  --text-white: #f5f6fa;

  --accent-primary: #6c5ce7;
  --accent-primary-light: #a29bfe;
  --accent-primary-dark: #5f3dc4;
  --accent-secondary: #00cec9;
  --accent-gradient: linear-gradient(
    135deg,
    #6c5ce7 0%,
    #a29bfe 50%,
    #00cec9 100%
  );
  --accent-gradient-vivid: linear-gradient(135deg, #6c5ce7 0%, #e84393 100%);

  --success: #00b894;
  --success-light: #55efc4;
  --warning: #fdcb6e;
  --warning-dark: #e17055;
  --danger: #d63031;
  --danger-light: #ff7675;
  --info: #74b9ff;
  --info-dark: #0984e3;

  /* ── Neumorphic Shadows ─────────────────── */
  --shadow-light: #ffffff;
  --shadow-dark: #a3b1c6;
  --shadow-darker: #8b9db5;

  /* Extruded (raised) */
  --neu-shadow-xs:
    2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
  --neu-shadow-sm:
    4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  --neu-shadow:
    6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  --neu-shadow-md:
    8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  --neu-shadow-lg:
    12px 12px 24px var(--shadow-dark), -12px -12px 24px var(--shadow-light);
  --neu-shadow-xl:
    20px 20px 40px var(--shadow-dark), -20px -20px 40px var(--shadow-light);

  /* Pressed (inset) */
  --neu-inset-xs:
    inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
  --neu-inset-sm:
    inset 4px 4px 8px var(--shadow-dark),
    inset -4px -4px 8px var(--shadow-light);
  --neu-inset:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);

  /* Colored shadows */
  --neu-shadow-accent:
    6px 6px 12px rgba(108, 92, 231, 0.3), -6px -6px 12px var(--shadow-light);
  --neu-shadow-success:
    6px 6px 12px rgba(0, 184, 148, 0.3), -6px -6px 12px var(--shadow-light);

  /* ── Typography ─────────────────────────── */
  --font-primary:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Outfit", var(--font-primary);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
  --text-6xl: 4.5rem;

  /* ── Spacing ─────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ── Border Radius ───────────────────────── */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ── Transitions ─────────────────────────── */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Z-Index Scale ───────────────────────── */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
}

/* ── Reset & Base ────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Smooth scrolling container for Lenis */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* ── Typography ──────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-5xl);
}
h2 {
  font-size: var(--text-4xl);
}
h3 {
  font-size: var(--text-3xl);
}
h4 {
  font-size: var(--text-2xl);
}
h5 {
  font-size: var(--text-xl);
}
h6 {
  font-size: var(--text-lg);
}

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary-dark);
}

/* ── Layout ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm {
  max-width: 720px;
}
.container-lg {
  max-width: 1400px;
}

.section {
  padding: var(--space-20) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* ── Neumorphic Components ───────────────────── */

/* Card */
.neu-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--neu-shadow);
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base);
}

.neu-card:hover {
  box-shadow: var(--neu-shadow-lg);
  transform: translateY(-2px);
}

.neu-card-flat {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--neu-shadow-sm);
}

.neu-card-inset {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--neu-inset);
}

/* Buttons */
.neu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--neu-shadow-sm);
  transition: all var(--transition-base);
  text-decoration: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.neu-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: inherit;
}

.neu-btn:hover {
  box-shadow: var(--neu-shadow);
  transform: translateY(-1px);
}

.neu-btn:active {
  box-shadow: var(--neu-inset-sm);
  transform: translateY(0);
}

.neu-btn span,
.neu-btn i,
.neu-btn svg {
  position: relative;
  z-index: 1;
}

.neu-btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--neu-shadow-accent);
}

.neu-btn-primary::before {
  background: var(--accent-gradient-vivid);
}

.neu-btn-primary:hover {
  box-shadow: var(--neu-shadow-md);
  transform: translateY(-2px);
}

.neu-btn-primary:hover::before {
  opacity: 1;
}

.neu-btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--neu-shadow-sm);
}

.neu-btn-outline {
  background: transparent;
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: none;
}

.neu-btn-outline:hover {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--neu-shadow-accent);
}

.neu-btn-sm {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.neu-btn-lg {
  padding: var(--space-5) var(--space-12);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.neu-btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
}

/* Inputs */
.neu-input,
.neu-select,
.neu-textarea {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  box-shadow: var(--neu-inset-sm);
  transition: all var(--transition-base);
  outline: none;
}

.neu-input:focus,
.neu-select:focus,
.neu-textarea:focus {
  box-shadow:
    var(--neu-inset),
    0 0 0 3px rgba(108, 92, 231, 0.2);
}

.neu-input::placeholder {
  color: var(--text-muted);
}

.neu-textarea {
  resize: vertical;
  min-height: 120px;
}

.neu-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23636e72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 20px;
  padding-right: var(--space-12);
}

/* Form Groups */
.form-group {
  margin-bottom: var(--space-6);
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group .helptext {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-group .errorlist {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0 0;
}

.form-group .errorlist li {
  color: var(--danger);
  font-size: var(--text-sm);
}

/* Checkbox & Radio (Neumorphic) */
.neu-checkbox-group,
.neu-radio {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.neu-checkbox-group label,
.neu-radio label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-shadow-xs);
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--text-sm);
}

.neu-checkbox-group label:hover,
.neu-radio label:hover {
  box-shadow: var(--neu-shadow-sm);
}

.neu-checkbox-group input:checked + label,
.neu-checkbox-group label:has(input:checked),
.neu-radio input:checked + label,
.neu-radio label:has(input:checked) {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--neu-shadow-accent);
}

/* Badge */
.neu-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-primary);
  box-shadow: var(--neu-shadow-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.neu-badge-primary {
  background: var(--accent-gradient);
  color: white;
}

.neu-badge-success {
  background: var(--success);
  color: white;
}

.neu-badge-warning {
  background: var(--warning);
  color: var(--text-primary);
}

.neu-badge-danger {
  background: var(--danger);
  color: white;
}

/* Avatar */
.neu-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  box-shadow: var(--neu-shadow-sm);
  object-fit: cover;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-primary);
  font-size: var(--text-lg);
}

.neu-avatar-lg {
  width: 80px;
  height: 80px;
  font-size: var(--text-3xl);
}

.neu-avatar-xl {
  width: 120px;
  height: 120px;
  font-size: var(--text-4xl);
}

/* Divider */
.neu-divider {
  height: 2px;
  background: var(--bg-primary);
  box-shadow: var(--neu-inset-xs);
  border-radius: var(--radius-full);
  margin: var(--space-8) 0;
}

/* ── Alert Messages ──────────────────────────── */
.messages-container {
  position: fixed;
  top: 90px;
  right: 20px;
  width: auto;
  min-width: 300px;
  max-width: 400px;
  z-index: 99999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
}

.alert {
  pointer-events: auto;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  box-shadow: var(--neu-shadow-md);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideInRight 0.4s var(--transition-spring);
  width: 100%;
}

.alert-success {
  border-left: 4px solid var(--success);
  color: var(--success);
}

.alert-error,
.alert-danger {
  border-left: 4px solid var(--danger);
  color: var(--danger);
}

.alert-warning {
  border-left: 4px solid var(--warning-dark);
  color: var(--warning-dark);
}

.alert-info {
  border-left: 4px solid var(--info-dark);
  color: var(--info-dark);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .messages-container {
    top: 90px;
    right: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    min-width: auto;
    padding: 0 var(--space-4);
    align-items: center;
  }
  .alert {
    animation: slideInDown 0.4s var(--transition-spring);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Progress Bar ────────────────────────────── */
.progress-container {
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  box-shadow: var(--neu-inset-sm);
  padding: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ── Pagination ──────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-10);
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  box-shadow: var(--neu-shadow-xs);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.pagination a:hover {
  box-shadow: var(--neu-shadow-sm);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.pagination .current {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--neu-shadow-accent);
}

/* ── Loading Spinner ─────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-secondary);
  border-top-color: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Utility Classes ─────────────────────────── */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: var(--space-2);
}
.gap-4 {
  gap: var(--space-4);
}
.gap-6 {
  gap: var(--space-6);
}
.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);
}

.mt-4 {
  margin-top: var(--space-4);
}
.mt-8 {
  margin-top: var(--space-8);
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-8 {
  margin-bottom: var(--space-8);
}

.hidden {
  display: none !important;
}
.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;
}

/* ── GSAP Animation Helpers ──────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --text-5xl: 2rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
  }
  .container {
    padding: 0 var(--space-4);
  }
  .section {
    padding: var(--space-12) 0;
  }
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .neu-card {
    padding: var(--space-6);
  }
  .hide-mobile {
    display: none !important;
  }
}

@media (max-width: 480px) {
  :root {
    --text-5xl: 1.75rem;
    --text-4xl: 1.5rem;
  }
  .neu-btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
  }
}

/* ── Select2 Neumorphic Styling ──────────────── */
.select2-container--default .select2-selection--multiple {
  background-color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-inset-sm);
  padding: var(--space-2) var(--space-4);
  min-height: 48px;
}
.select2-container--default.select2-container--focus
  .select2-selection--multiple {
  box-shadow:
    var(--neu-inset),
    0 0 0 3px rgba(108, 92, 231, 0.2);
  border: none;
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background-color: var(--accent-gradient);
  border: none;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-shadow-xs);
  padding: var(--space-1) var(--space-2);
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove {
  color: var(--danger);
  margin-right: var(--space-1);
  border: none;
}
.select2-dropdown {
  background-color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-shadow-lg);
  color: var(--text-primary);
  z-index: var(--z-dropdown);
}
.select2-container--default
  .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--accent-gradient);
  color: white;
}
.select2-results__option {
  padding: var(--space-2) var(--space-4);
}
.select2-container--default .select2-selection--single {
  background-color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-inset-sm);
  height: 48px;
  padding: var(--space-3) var(--space-6);
}
.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: var(--text-primary);
  line-height: normal;
}
.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 48px;
  right: 12px;
}
