/* ============================================================
   Security Awareness Training LMS — Main Stylesheet
   Design inspired by SoSafe (sosafe.de)
   Primary: #00B08D  |  Bg: #F5F7FA  |  Text: #1A1A2E
   ============================================================ */

/* ── Variables (also set inline in layout for cascading) ───── */
:root {
  --lms-primary:      #00B08D;
  --lms-primary-dark: #008f72;
  --lms-primary-light:#e6f8f4;
  --lms-bg:           #F5F7FA;
  --lms-card-bg:      #FFFFFF;
  --lms-text:         #1A1A2E;
  --lms-text-muted:   #6B7280;
  --lms-orange:       #F59E0B;
  --lms-green:        #10B981;
  --lms-red:          #EF4444;
  --lms-border:       #E5E7EB;
  --lms-radius:       10px;
  --lms-radius-sm:    6px;
  --lms-shadow:       0 1px 4px rgba(0,0,0,.08);
  --lms-shadow-md:    0 4px 12px rgba(0,0,0,.10);
}

/* ── Base ───────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body.lms-body {
  background: var(--lms-bg);
  color: var(--lms-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.lms-navbar {
  background: #fff;
  border-bottom: 1px solid var(--lms-border);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.lms-logo { text-decoration: none; }
.lms-logo-icon {
  width: 34px; height: 34px;
  background: var(--lms-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
}
.lms-logo-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--lms-text);
}

.lms-nav-link {
  color: var(--lms-text-muted) !important;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px !important;
  border-radius: var(--lms-radius-sm);
  transition: color .15s, background .15s;
}
.lms-nav-link:hover,
.lms-nav-link.active {
  color: var(--lms-primary) !important;
  background: var(--lms-primary-light);
}

/* Language switcher */
.lms-lang-switch { display: flex; gap: 4px; }
.lms-lang-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--lms-border);
  color: var(--lms-text-muted);
  text-decoration: none;
  transition: all .15s;
}
.lms-lang-btn:hover,
.lms-lang-btn.active {
  background: var(--lms-primary);
  border-color: var(--lms-primary);
  color: #fff;
}

/* Avatar */
.lms-avatar {
  width: 36px; height: 36px;
  background: var(--lms-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lms-avatar-btn { color: var(--lms-text); text-decoration: none; }
.lms-avatar-btn:focus { box-shadow: none; }
.lms-username {
  font-size: 14px;
  font-weight: 500;
  color: var(--lms-text);
}
.lms-chevron { font-size: 11px; color: var(--lms-text-muted); }

/* Dropdown */
.lms-dropdown {
  border: 1px solid var(--lms-border);
  border-radius: var(--lms-radius);
  min-width: 220px;
  padding: 6px 0;
}
.lms-dropdown-header { border-bottom: 1px solid var(--lms-border); }
.lms-dropdown-item {
  font-size: 14px;
  color: var(--lms-text);
  padding: 8px 16px;
}
.lms-dropdown-item:hover { background: var(--lms-primary-light); color: var(--lms-primary); }

/* ── Main content area ──────────────────────────────────────── */
.lms-main {
  flex: 1;
  padding: 28px 0 40px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.lms-card {
  background: var(--lms-card-bg);
  border-radius: var(--lms-radius);
  box-shadow: var(--lms-shadow);
  border: 1px solid var(--lms-border);
  padding: 20px;
}
.lms-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--lms-text);
  margin-bottom: 12px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-lms-primary {
  background: var(--lms-primary);
  color: #fff;
  border: none;
  border-radius: var(--lms-radius-sm);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 20px;
  transition: background .15s, transform .1s;
}
.btn-lms-primary:hover {
  background: var(--lms-primary-dark);
  color: #fff;
  transform: translateY(-1px);
}
.btn-lms-primary:disabled { opacity: .6; transform: none; }

.btn-lms-outline {
  background: transparent;
  color: var(--lms-primary);
  border: 1.5px solid var(--lms-primary);
  border-radius: var(--lms-radius-sm);
  font-weight: 500;
  font-size: 14px;
  padding: 7px 20px;
  transition: all .15s;
}
.btn-lms-outline:hover {
  background: var(--lms-primary);
  color: #fff;
}

/* ── Progress bar ───────────────────────────────────────────── */
.lms-progress {
  height: 5px;
  border-radius: 10px;
  background: var(--lms-border);
  overflow: hidden;
}
.lms-progress-fill {
  height: 100%;
  background: var(--lms-primary);
  border-radius: 10px;
  transition: width .4s ease;
}

/* ── Tags / Badges ──────────────────────────────────────────── */
.lms-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid currentColor;
  line-height: 1.4;
}
.lms-tag-mandatory { color: var(--lms-orange); border-color: var(--lms-orange); }
.lms-tag-overdue   { color: var(--lms-red);    border-color: var(--lms-red); background: #fef2f2; }
.lms-tag-completed { color: var(--lms-green);  border-color: var(--lms-green); background: #ecfdf5; }
.lms-tag-deadline  { color: var(--lms-orange); border-color: var(--lms-orange); }

/* ── XP / Points badge ──────────────────────────────────────── */
.lms-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff3cd;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.lms-xp-badge .bi { color: var(--lms-orange); }

/* ── Shield icon (achievements) ─────────────────────────────── */
.lms-shield {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--lms-primary);
  background: var(--lms-primary-light);
  border-radius: 50%;
  margin: 0 auto 12px;
}

/* Badge grid item */
.lms-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--lms-radius);
  border: 1px solid var(--lms-border);
  background: var(--lms-card-bg);
  cursor: default;
  transition: box-shadow .15s;
}
.lms-badge-item:hover { box-shadow: var(--lms-shadow-md); }
.lms-badge-item.locked { opacity: .45; filter: grayscale(1); }
.lms-badge-item .badge-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--lms-primary-light);
  border-radius: 50%;
  font-size: 24px;
  color: var(--lms-primary);
}
.lms-badge-item.locked .badge-icon { background: var(--lms-border); color: var(--lms-text-muted); }
.lms-badge-item .badge-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--lms-text);
  line-height: 1.3;
}

/* ── Training course card ───────────────────────────────────── */
.lms-course-card {
  background: var(--lms-card-bg);
  border-radius: var(--lms-radius);
  box-shadow: var(--lms-shadow);
  border: 1px solid var(--lms-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: box-shadow .2s, transform .2s;
}
.lms-course-card:hover {
  box-shadow: var(--lms-shadow-md);
  transform: translateY(-2px);
}
.lms-course-thumb {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, var(--lms-primary-light) 0%, #d1fae5 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  color: var(--lms-primary);
  flex-shrink: 0;
}
.lms-course-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.lms-course-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.lms-course-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--lms-text);
  margin-bottom: 8px;
  line-height: 1.4;
}
.lms-course-meta {
  font-size: 12px;
  color: var(--lms-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.lms-course-footer {
  margin-top: auto;
  padding-top: 12px;
}

/* ── Sidebar widgets ─────────────────────────────────────────── */
.lms-sidebar { width: 285px; flex-shrink: 0; }

/* Welcome banner */
.lms-welcome-banner {
  background: var(--lms-primary);
  border-radius: var(--lms-radius);
  padding: 18px 16px;
  color: #fff;
  margin-bottom: 16px;
}
.lms-welcome-banner h6 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.lms-welcome-banner p {
  font-size: 13px;
  opacity: .9;
  margin: 0;
}

/* XP level widget */
.lms-level-card {
  background: var(--lms-card-bg);
  border-radius: var(--lms-radius);
  box-shadow: var(--lms-shadow);
  border: 1px solid var(--lms-border);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}
.lms-level-card .level-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--lms-primary);
  margin: 8px 0 4px;
}
.lms-level-card .xp-text {
  font-size: 13px;
  color: var(--lms-text-muted);
  margin-bottom: 10px;
}
.lms-mini-badges { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.lms-mini-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--lms-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--lms-text-muted);
}
.lms-mini-badge.earned {
  background: var(--lms-primary-light);
  color: var(--lms-primary);
}

/* "Did you know?" card */
.lms-fact-card {
  background: var(--lms-card-bg);
  border-radius: var(--lms-radius);
  box-shadow: var(--lms-shadow);
  border: 1px solid var(--lms-border);
  padding: 16px;
}
.lms-fact-card .fact-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--lms-text);
  margin-bottom: 8px;
}
.lms-fact-card .fact-text {
  font-size: 13px;
  color: var(--lms-text-muted);
  line-height: 1.5;
  min-height: 60px;
}
.lms-fact-card .fact-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.lms-fact-card .fact-counter {
  font-size: 11px;
  color: var(--lms-text-muted);
}
.lms-fact-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--lms-border);
  background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--lms-text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
}
.lms-fact-btn:hover { background: var(--lms-primary); color: #fff; border-color: var(--lms-primary); }

/* ── Section headers ────────────────────────────────────────── */
.lms-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.lms-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--lms-text);
  margin: 0;
}

/* ── Carousel arrows ─────────────────────────────────────────── */
.lms-carousel-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--lms-card-bg);
  border: 1px solid var(--lms-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--lms-text-muted);
  cursor: pointer;
  box-shadow: var(--lms-shadow);
  transition: all .15s;
}
.lms-carousel-btn:hover { background: var(--lms-primary); color: #fff; border-color: var(--lms-primary); }
.lms-carousel-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.lms-carousel-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lms-border);
  cursor: pointer;
  transition: background .15s;
}
.lms-carousel-dot.active { background: var(--lms-primary); }

/* ── Auth form ───────────────────────────────────────────────── */
.lms-auth-logo {
  width: 56px; height: 56px;
  background: var(--lms-primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
}
.lms-auth-card {
  border-radius: var(--lms-radius) !important;
}
.lms-form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--lms-text);
  margin-bottom: 6px;
}
.lms-form-control {
  border: 1.5px solid var(--lms-border);
  border-radius: var(--lms-radius-sm);
  font-size: 14px;
  padding: 9px 12px;
  color: var(--lms-text);
  transition: border-color .15s, box-shadow .15s;
}
.lms-form-control:focus {
  border-color: var(--lms-primary);
  box-shadow: 0 0 0 3px rgba(0,176,141,.15);
  outline: none;
}
.lms-form-control.is-invalid { border-color: var(--lms-red); }
.lms-form-select {
  border: 1.5px solid var(--lms-border);
  border-radius: var(--lms-radius-sm);
  font-size: 14px;
  padding: 9px 12px;
}
.lms-form-select:focus {
  border-color: var(--lms-primary);
  box-shadow: 0 0 0 3px rgba(0,176,141,.15);
  outline: none;
}

/* ── Timeline (achievements) ─────────────────────────────────── */
.lms-timeline { position: relative; padding-left: 28px; }
.lms-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--lms-border);
}
.lms-timeline-item { position: relative; margin-bottom: 20px; }
.lms-timeline-dot {
  position: absolute;
  left: -25px;
  top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--lms-green);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--lms-green);
}
.lms-timeline-dot.level-up { background: var(--lms-primary); box-shadow: 0 0 0 2px var(--lms-primary); }
.lms-timeline-date {
  font-size: 11px;
  color: var(--lms-text-muted);
  margin-bottom: 4px;
}
.lms-timeline-card {
  background: var(--lms-card-bg);
  border: 1px solid var(--lms-border);
  border-radius: var(--lms-radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

/* ── Leaderboard table ───────────────────────────────────────── */
.lms-leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--lms-border);
}
.lms-leaderboard-row:last-child { border-bottom: none; }
.lms-leaderboard-row.current-user,
.lms-leaderboard-row.is-me { background: var(--lms-primary-light); border-radius: var(--lms-radius-sm); padding: 10px 8px; }
.lms-rank-badge {
  width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--lms-text-muted);
}
.lms-rank-badge.top1 { color: #f59e0b; }
.lms-rank-badge.top2 { color: #94a3b8; }
.lms-rank-badge.top3 { color: #cd7c2e; }

/* ── Footer ──────────────────────────────────────────────────── */
.lms-footer {
  border-top: 1px solid var(--lms-border);
  background: #fff;
  margin-top: auto;
}
.lms-footer-link {
  font-size: 12px;
  color: var(--lms-text-muted);
  text-decoration: none;
}
.lms-footer-link:hover { color: var(--lms-primary); }

/* ── Alert ───────────────────────────────────────────────────── */
.lms-alert { border-radius: var(--lms-radius-sm); font-size: 14px; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.lms-tabs { border-bottom: 2px solid var(--lms-border); display: flex; gap: 4px; margin-bottom: 16px; }
.lms-tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lms-text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: color .15s;
}
.lms-tab:hover { color: var(--lms-primary); }
.lms-tab.active {
  color: var(--lms-primary);
  border-bottom-color: var(--lms-primary);
  font-weight: 600;
}

/* ── Utilities ───────────────────────────────────────────────── */
.text-lms-primary  { color: var(--lms-primary) !important; }
.text-lms-muted    { color: var(--lms-text-muted) !important; }
.bg-lms-primary    { background: var(--lms-primary) !important; }
.bg-lms-light      { background: var(--lms-primary-light) !important; }
.border-lms        { border-color: var(--lms-border) !important; }

/* ── Badge Gallery (Achievements) ───────────────────────────── */
.lms-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
}
.lms-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.lms-badge-shield {
  width: 48px;
  height: 48px;
  border-radius: 10px 10px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform .15s;
}
.lms-badge-item.earned .lms-badge-shield {
  background: linear-gradient(135deg, var(--lms-primary), #00c9a7);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,176,141,.3);
}
.lms-badge-item.locked .lms-badge-shield {
  background: var(--lms-border);
  color: #bbb;
  filter: grayscale(1);
}
.lms-badge-item.earned:hover .lms-badge-shield { transform: scale(1.1); }
.lms-badge-name {
  font-size: 10px;
  text-align: center;
  color: var(--lms-text-muted);
  line-height: 1.2;
  word-break: break-word;
}
.lms-badge-item.earned .lms-badge-name { color: var(--lms-text); font-weight: 500; }

/* ── Activity Timeline ───────────────────────────────────────── */
.lms-timeline {
  position: relative;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}
.lms-timeline::-webkit-scrollbar { width: 4px; }
.lms-timeline::-webkit-scrollbar-track { background: transparent; }
.lms-timeline::-webkit-scrollbar-thumb { background: var(--lms-border); border-radius: 2px; }

.lms-timeline-date {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--lms-text-muted);
  padding: 12px 0 6px 24px;
}
.lms-timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 0 0 14px 24px;
}
.lms-timeline-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--lms-border);
}
.lms-timeline-item:last-child::before { display: none; }
.lms-timeline-dot {
  position: absolute;
  left: 2px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lms-green);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--lms-green);
  flex-shrink: 0;
}
.lms-timeline-item.level-up .lms-timeline-dot {
  background: var(--lms-primary);
  box-shadow: 0 0 0 1px var(--lms-primary);
}
.lms-timeline-body {
  flex: 1;
  min-width: 0;
  background: var(--lms-bg);
  border-radius: var(--lms-radius-sm);
  padding: 8px 10px;
  border: 1px solid var(--lms-border);
}
.lms-timeline-item.level-up .lms-timeline-body {
  border-color: var(--lms-primary);
  background: var(--lms-primary-light);
}

/* ── Training card (catalog grid) ────────────────────────────── */
.lms-training-card {
  background: var(--lms-card-bg);
  border-radius: var(--lms-radius);
  box-shadow: var(--lms-shadow);
  border: 1px solid var(--lms-border);
  overflow: hidden;
  color: var(--lms-text);
  transition: box-shadow .2s, transform .15s;
}
.lms-training-card:hover {
  box-shadow: var(--lms-shadow-md);
  transform: translateY(-2px);
}
.lms-training-card.border-danger  { border-color: var(--lms-red)   !important; }
.lms-training-card.border-success { border-color: var(--lms-green) !important; }

/* Thumbnail area */
.lms-card-thumb {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: var(--lms-bg);
}
.lms-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.lms-card-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#00B08D 0%,#007a62 100%);
  font-size: 2.5rem;
  color: rgba(255,255,255,.75);
}
.lms-thumb-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .85rem;
}

/* Card body */
.lms-card-body {
  padding: 14px 16px 16px;
}
.lms-card-title {
  font-weight: 600;
  font-size: .925rem;
  margin-bottom: 4px;
  color: var(--lms-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Points badge */
.lms-points-badge {
  display: inline-flex;
  align-items: center;
  background: var(--lms-primary-light);
  color: var(--lms-primary);
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

/* lms-tag extras */
.lms-tag-expires  { color: var(--lms-orange); border-color: var(--lms-orange); }
.lms-tag-duration { color: var(--lms-text-muted); border-color: var(--lms-border); background: #f8f9fa; }

/* ── Training detail: prose content ─────────────────────────── */
.lms-prose { line-height: 1.75; color: var(--lms-text); }
.lms-prose p  { margin-bottom: .85em; }
.lms-prose ul,
.lms-prose ol { padding-left: 1.4em; margin-bottom: .85em; }
.lms-prose li { margin-bottom: .25em; }
.lms-prose h2, .lms-prose h3 { color: var(--lms-primary); margin-top: 1.2em; margin-bottom: .4em; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .lms-sidebar { width: 100%; }
  .lms-course-thumb { height: 120px; }
  .lms-badge-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
  .lms-card-thumb { height: 110px; }
}
