/* ================================================================
   AiLearn — Design System
   Ljust, modernt, inbjudande med pedagogisk känsla
   ================================================================ */

/* ── CSS-variabler ──────────────────────────────────────────── */
:root {
  --primary:        #4F6EF5;
  --primary-dark:   #3B56D6;
  --primary-light:  #EEF2FF;
  --secondary:      #10B981;
  --secondary-light:#ECFDF5;
  --accent:         #F59E0B;
  --accent-light:   #FFFBEB;
  --body-bg:        #F7F9FC;
  --card-bg:        #FFFFFF;
  --text:           #1E293B;
  --text-muted:     #64748B;
  --border:         #E2E8F0;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.06);
  --shadow-md:      0 4px 20px rgba(0,0,0,.09);
  --shadow-lg:      0 8px 40px rgba(0,0,0,.13);
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
}

/* ── Bas ────────────────────────────────────────────────────── */
html {
  position: relative;
  min-height: 100%;
  font-size: 16px;
  overflow-x: hidden;
}
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--body-bg);
  color: var(--text);
  font-size: .9375rem;
  line-height: 1.65;
  margin: 0;
}
h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--text); line-height: 1.25; }

/* ── Bootstrap-overrides ────────────────────────────────────── */
.btn {
  border-radius: 8px;
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .01em;
  transition: all .18s;
}
.btn:focus, .btn:active:focus {
  box-shadow: 0 0 0 0.2rem rgba(79,110,245,.25);
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-success { background-color: var(--secondary); border-color: var(--secondary); }
.btn-success:hover { background-color: #059669; border-color: #059669; }

.btn-outline-secondary { border-color: var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--border); color: var(--text); border-color: var(--border); }

.btn-lg { padding: .7rem 1.8rem; font-size: 1rem; border-radius: 10px; }
.btn-sm { padding: .3rem .75rem; font-size: .8125rem; border-radius: 6px; }

.card {
  border-radius: var(--radius-lg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--card-bg);
}

.badge { font-weight: 600; border-radius: 6px; padding: .3em .6em; }

.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(79,110,245,.15);
}

.form-label { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .35rem; }

.table { color: var(--text); font-size: .9rem; }
.table-hover tbody tr:hover { background-color: var(--primary-light); }
.table thead th {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom-color: var(--border);
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.table-light { background-color: #F8FAFC !important; }

.alert { border-radius: var(--radius); border: none; font-size: .9rem; }
.alert-success { background: #ECFDF5; color: #065F46; }
.alert-danger  { background: #FEF2F2; color: #991B1B; }
.alert-info    { background: #EFF6FF; color: #1E40AF; }
.alert-warning { background: #FFFBEB; color: #92400E; }

.list-group-item { border-color: var(--border); }

/* ── Navbar ─────────────────────────────────────────────────── */
.ailearn-navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  padding: .65rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.ailearn-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text) !important;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 9px;
  font-size: .85rem;
  flex-shrink: 0;
}
.brand-text { color: var(--primary); letter-spacing: -.02em; }

.ailearn-navbar .nav-link {
  color: var(--text-muted) !important;
  font-weight: 500;
  font-size: .875rem;
  border-radius: 7px;
  padding: .4rem .7rem;
  transition: color .15s, background .15s;
}
.ailearn-navbar .nav-link:hover {
  color: var(--primary) !important;
  background: var(--primary-light);
}
.ailearn-navbar .nav-link.active {
  color: var(--primary) !important;
  background: var(--primary-light);
}

/* SuperAdmin danger link */
.ailearn-navbar .nav-link-admin {
  color: #DC2626 !important;
  font-weight: 700;
}
.ailearn-navbar .nav-link-admin:hover { background: #FEF2F2 !important; }

/* Dropdown */
.ailearn-navbar .dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: .4rem;
  min-width: 180px;
}
.ailearn-navbar .dropdown-item {
  border-radius: 6px;
  font-weight: 500;
  font-size: .875rem;
  color: var(--text);
  padding: .45rem .75rem;
}
.ailearn-navbar .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.ailearn-navbar .dropdown-divider { border-color: var(--border); margin: .3rem 0; }

/* Navbar login-knapp */
.btn-nav-login {
  background: var(--primary);
  color: #fff !important;
  border-radius: 8px;
  padding: .4rem 1.1rem;
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  transition: background .15s;
  display: inline-block;
}
.btn-nav-login:hover { background: var(--primary-dark); color: #fff !important; }

/* ── Herosektionen (startsida, ej inloggad) ──────────────────── */
.hero-section {
  position: relative;
  padding: 5rem 0 4.5rem;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  left: calc(-50vw + 50%);
  right: calc(-50vw + 50%);
  background: linear-gradient(135deg, #EEF2FF 0%, #EFF6FF 55%, #F7F9FC 100%);
  z-index: -1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .35rem .85rem;
  border-radius: 50px;
  margin-bottom: 1.25rem;
}
.hero-section h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.025em;
  margin-bottom: 1.1rem;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 430px;
  line-height: 1.75;
  margin-bottom: 2rem;
}
.hero-image-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-image-wrap img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  display: block;
}
.hero-image-placeholder {
  width: 100%;
  height: 360px;
  background: linear-gradient(135deg, #C7D7FD 0%, #A5F3FC 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  border-radius: var(--radius-xl);
}

/* ── Funktionskort (features) ───────────────────────────────── */
.features-section { padding: 4.5rem 0; }
.section-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .5rem;
}
.section-title {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -.025em;
  margin-bottom: .5rem;
}
.section-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.7;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
  transition: box-shadow .22s, transform .22s;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.feature-card .card-img-top { height: 195px; object-fit: cover; width: 100%; display: block; }
.feature-card .card-img-placeholder {
  height: 195px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}
.feature-card .card-body { padding: 1.5rem; }
.feature-icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 11px;
  font-size: 1.3rem;
  margin-bottom: .85rem;
}
.chip-blue  { background: #EEF2FF; }
.chip-green { background: #ECFDF5; }
.chip-amber { background: #FFFBEB; }

.feature-card h5 { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.feature-card p  { font-size: .875rem; color: var(--text-muted); line-height: 1.65; margin: 0; }

/* ── "Hur det fungerar"-sektion ─────────────────────────────── */
.steps-section {
  position: relative;
  padding: 4.5rem 0;
}
.steps-section::before {
  content: '';
  position: absolute;
  inset: 0;
  left: calc(-50vw + 50%);
  right: calc(-50vw + 50%);
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: -1;
}

.steps-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.step-item {
  flex: 1;
  text-align: center;
  padding: 0 1.25rem;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 auto .9rem;
  box-shadow: 0 4px 16px rgba(79,110,245,.3);
}
.step-item h5 { font-size: .975rem; font-weight: 700; margin-bottom: .4rem; }
.step-item p  { font-size: .85rem; color: var(--text-muted); max-width: 200px; margin: 0 auto; line-height: 1.6; }

.step-connector {
  flex-shrink: 0;
  width: 2px;
  height: 2px;
  margin-top: 27px;
  flex: 0 0 40px;
  background: linear-gradient(90deg, var(--border) 50%, transparent 100%);
  border-top: 2px dashed var(--border);
  align-self: flex-start;
}

/* ── CTA-banner ─────────────────────────────────────────────── */
.cta-section {
  position: relative;
  padding: 4.5rem 0;
  text-align: center;
}
.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  left: calc(-50vw + 50%);
  right: calc(-50vw + 50%);
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
  z-index: -1;
}
.cta-section h2   { color: #fff; font-size: 2rem; font-weight: 800; margin-bottom: .75rem; }
.cta-section p    { color: rgba(255,255,255,.8); font-size: 1.05rem; margin-bottom: 2rem; }
.btn-cta {
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 10px;
  padding: .75rem 2.25rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transition: background .18s, transform .18s;
}
.btn-cta:hover { background: var(--primary-light); color: var(--primary-dark); transform: translateY(-2px); }

/* ── Välkomstsektionen (inloggad) ───────────────────────────── */
.welcome-section {
  position: relative;
  padding: 3rem 0 2.75rem;
  margin-bottom: 0;
}
.welcome-section::before {
  content: '';
  position: absolute;
  inset: 0;
  left: calc(-50vw + 50%);
  right: calc(-50vw + 50%);
  background: linear-gradient(135deg, #EEF2FF 0%, #EFF6FF 100%);
  border-bottom: 1px solid var(--border);
  z-index: -1;
}
.welcome-section h1 { font-size: 1.875rem; font-weight: 800; margin-bottom: .35rem; }
.welcome-section .welcome-role {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .3rem .75rem;
  border-radius: 50px;
  margin-bottom: .75rem;
}
.role-superadmin { background: #FEE2E2; color: #991B1B; }
.role-skolaadmin  { background: #DBEAFE; color: #1D4ED8; }
.role-larare      { background: #ECFDF5; color: #065F46; }
.role-elev        { background: var(--primary-light); color: var(--primary); }

/* ── Aktionskort (inloggad startsida) ───────────────────────── */
.action-cards-section { padding: 2.5rem 0 4rem; }

.action-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
  transition: box-shadow .22s, transform .22s;
}
.action-card:hover     { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.action-card-disabled  { opacity: .55; pointer-events: none; }
.action-card a.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.action-card .card-stripe { height: 6px; }
.stripe-blue   { background: var(--primary); }
.stripe-green  { background: var(--secondary); }
.stripe-amber  { background: var(--accent); }
.stripe-purple { background: #8B5CF6; }

.action-card .card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.action-card .card-emoji  { font-size: 2.25rem; margin-bottom: .9rem; line-height: 1; }
.action-card h5           { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.action-card p            { font-size: .875rem; color: var(--text-muted); flex: 1; line-height: 1.65; margin: 0; }
.card-go {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .85rem;
  font-weight: 600;
  margin-top: 1.1rem;
}
.go-blue   { color: var(--primary); }
.go-green  { color: var(--secondary); }
.go-amber  { color: var(--accent); }
.go-purple { color: #8B5CF6; }

/* ── Footer ─────────────────────────────────────────────────── */
.ailearn-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-brand { font-weight: 800; color: var(--primary); font-size: 1rem; }

/* ── Sidinnehåll (inne-sidor) ───────────────────────────────── */
.page-body { padding: 2.25rem 0 4rem; }

/* ── Verktyg ─────────────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }

/* ── Responsivitet ──────────────────────────────────────────── */
@media (max-width: 991px) {
  .hero-section { padding: 3rem 0 3rem; }
  .hero-section h1 { font-size: 2.1rem; }
  .hero-image-wrap { margin-top: 2rem; }
  .hero-image-wrap img, .hero-image-placeholder { height: 260px; }
  .section-title { font-size: 1.6rem; }
  .step-connector { display: none; }
  .steps-row { flex-direction: column; gap: 1.75rem; }
  .step-item { padding: 0; }
}

@media (max-width: 575px) {
  .hero-section h1 { font-size: 1.75rem; }
  .hero-tag { font-size: .7rem; }
  .cta-section h2 { font-size: 1.5rem; }
  .welcome-section h1 { font-size: 1.5rem; }
}
