/* ==========================================================================
   IACADEMIX LMS - main.css (shared design system)
   ========================================================================== */

:root {
  --color-primary: #042e33;
  --color-primary-dark: #021a1d;
  --color-accent: #00c896;
  --color-accent-hover: #00b085;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f9fa;
  --color-text: #1a1a1a;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  --color-premium: #b8860b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --container: 1280px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg-alt);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--color-accent-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-primary);
  margin: 0 0 .75rem;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
p { margin: 0 0 1rem; }

/* ----- Layout helpers ----- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 920px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 42px;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9375rem;
  line-height: 1;
  transition: all .2s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--color-accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-accent-hover); box-shadow: var(--shadow-md); color: #fff; }
.btn-secondary { background: var(--color-primary); color: #fff; }
.btn-secondary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.btn-outline:hover { background: var(--color-bg-alt); border-color: var(--color-primary); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg-alt); color: var(--color-text); }
.btn-sm { min-height: 34px; padding: .375rem .875rem; font-size: .8125rem; }
.btn-lg { min-height: 52px; padding: .875rem 1.75rem; font-size: 1.0625rem; }
.btn-block { width: 100%; display: flex; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ----- Forms ----- */
.field { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .875rem; color: var(--color-primary); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  padding: .625rem .875rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--color-text);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 150, .15);
}
.field textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
.field-hint { font-size: .8125rem; color: var(--color-text-muted); }
.field-error { font-size: .8125rem; color: var(--color-error); font-weight: 600; }
.field-checkbox { display: flex; align-items: center; gap: .5rem; }
.field-checkbox input[type="checkbox"] { width: 18px; height: 18px; }

/* ----- Cards ----- */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-title { margin: 0 0 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }

/* ----- Alerts ----- */
.alert {
  padding: .875rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert-error   { background: #fef2f2; color: #991b1b; border-left-color: var(--color-error); }
.alert-success { background: #ecfdf5; color: #065f46; border-left-color: var(--color-success); }
.alert-info    { background: #eff6ff; color: #1e40af; border-left-color: var(--color-info); }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: var(--color-warning); }

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-gray   { background: var(--color-bg-alt); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-accent { background: rgba(0, 200, 150, .12); color: var(--color-accent); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-premium { background: rgba(184, 134, 11, .12); color: var(--color-premium); }

/* ----- Logo ----- */
.logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--color-primary);
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--color-primary); }
.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-weight: 900;
  font-size: .875rem;
}

/* ----- Loading ----- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Toast notifications ----- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--color-primary);
  color: #fff;
  padding: .875rem 1.25rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: slideIn .25s var(--ease-out);
  max-width: 340px;
  font-size: .9375rem;
}
.toast-blocked { background: var(--color-error); }
.toast-success { background: var(--color-success); }
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ----- 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;
}
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----- Progress bar ----- */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-bg-alt);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #00e6a8);
  border-radius: 999px;
  transition: width .4s var(--ease-out);
}
.progress-sm { height: 5px; }

/* ----- Tables ----- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table th, .table td {
  padding: .875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.table th {
  background: var(--color-bg-alt);
  font-weight: 700;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
}
.table tbody tr:hover { background: var(--color-bg-alt); }
.table tbody tr:last-child td { border-bottom: none; }

/* ----- Locked state ----- */
.is-locked { opacity: .55; cursor: not-allowed; pointer-events: none; }
.lock-icon { color: var(--color-text-muted); font-size: 1rem; }
