/* БЕРФОРТ LMS — Component vocabulary */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  font-family: inherit;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }

.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-surface-2); border-color: var(--c-text-muted); }

.btn-ghost { background: transparent; color: var(--c-text-muted); }
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #065f46; }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #991b1b; }

.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); }
.btn-lg { padding: 14px 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }

/* ─── Card ─── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card-hover:hover { box-shadow: var(--sh-md); border-color: var(--c-border-strong); }
.card-body { padding: var(--s-6); }
.card-header {
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { margin: 0; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--r-full);
  white-space: nowrap;
  line-height: 1.4;
}
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary-text); }
.badge-success { background: var(--c-success-soft); color: var(--c-success-text); }
.badge-warning { background: var(--c-warning-soft); color: var(--c-warning-text); }
.badge-danger  { background: var(--c-danger-soft); color: var(--c-danger-text); }
.badge-neutral { background: var(--c-neutral-soft); color: var(--c-neutral-text); }

/* ─── Progress bar ─── */
.progress {
  position: relative;
  width: 100%;
  height: 6px;
  background: var(--c-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--c-primary);
  border-radius: inherit;
  transition: width var(--t-base);
}
.progress-bar.success { background: var(--c-success); }
.progress-bar.warning { background: var(--c-warning); }

/* ─── Inputs ─── */
.input, select.input, textarea.input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text); margin-bottom: 6px; }
.field { margin-bottom: var(--s-4); }
.field-help { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 4px; }

/* ─── App layout (sidebar + main) ─── */
.app-shell { display: flex; min-height: 100vh; background: var(--c-bg); }
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  flex-shrink: 0;
  padding: var(--s-5) 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-sidebar-brand {
  padding: 0 var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-3);
}
.app-sidebar-brand .logo {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--c-primary);
  letter-spacing: 0.02em;
}
.app-sidebar-brand .sub {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.app-sidebar-section {
  padding: var(--s-3) var(--s-5) var(--s-2);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  color: var(--c-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px var(--s-5);
  color: var(--c-text-muted);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.sidebar-link:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.sidebar-link.active {
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
  border-left-color: var(--c-primary);
}
.sidebar-link .ico { width: 18px; flex-shrink: 0; opacity: 0.85; text-align: center; }
.sidebar-footer { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--c-border); margin-top: auto; }

.app-main {
  flex: 1;
  min-width: 0;
  padding: var(--s-8) var(--s-10);
  max-width: var(--content-max);
}
.app-main.app-main--full {
  max-width: none;
}

.page-header { margin-bottom: var(--s-8); }
.page-header h1 { font-size: var(--fs-2xl); }
.page-header .subtitle { color: var(--c-text-muted); margin-top: 4px; }

/* ─── Course card ─── */
.course-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--c-text);
  transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base);
}
.course-card:hover { box-shadow: var(--sh-md); border-color: var(--c-border-strong); text-decoration: none; transform: translateY(-1px); }
.course-card-cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  position: relative;
}
.course-card-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.15)); }
.course-card-tag {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 1;
}
.course-card-body { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.course-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card-meta {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.course-card-meta span { display: flex; align-items: center; gap: 4px; }
.course-card-progress { display: flex; flex-direction: column; gap: 4px; }
.course-card-progress-row { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--c-text-muted); }
.course-card-footer {
  padding: var(--s-3) var(--s-5);
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
}

/* ─── Hero (Continue Learning) ─── */
.hero-continue {
  background: linear-gradient(135deg, var(--c-primary), #2563eb);
  color: #fff;
  border-radius: var(--r-xl);
  padding: var(--s-8);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-6);
  align-items: center;
}
.hero-continue h2 { color: #fff; font-size: var(--fs-xl); margin-bottom: 4px; }
.hero-continue .hero-eyebrow { font-size: var(--fs-sm); opacity: 0.85; letter-spacing: 0.06em; text-transform: uppercase; }
.hero-continue .hero-next { font-size: var(--fs-md); opacity: 0.95; margin-top: var(--s-3); }
.hero-continue .progress { background: rgba(255,255,255,0.2); margin-top: var(--s-4); max-width: 360px; }
.hero-continue .progress-bar { background: #fff; }
.hero-continue .btn-primary { background: #fff; color: var(--c-primary); }
.hero-continue .btn-primary:hover { background: rgba(255,255,255,0.92); }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  color: var(--c-text-muted);
}
.empty-state h3 { color: var(--c-text); margin-bottom: var(--s-2); }
.empty-state .btn { margin-top: var(--s-4); }

/* ─── Compliance panel ─── */
.compliance-list { display: grid; gap: var(--s-3); }
.compliance-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  border-left-width: 4px;
}
.compliance-item.critical { border-left-color: var(--c-danger); background: var(--c-danger-soft); }
.compliance-item.warning  { border-left-color: var(--c-warning); background: var(--c-warning-soft); }
.compliance-item.normal   { border-left-color: var(--c-success); }
.compliance-item-strip { display: none; } /* the left-border handles it */

/* ─── Tables ─── */
.table {
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.table th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-weight: var(--fw-semibold);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-border); color: var(--c-text); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--c-surface-2); }

/* ─── KPI tile ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-4); }
.kpi-tile {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-5);
}
.kpi-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--c-text-muted); margin-bottom: 6px; }
.kpi-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--c-text); line-height: 1.1; }
.kpi-sub { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 4px; }

/* ─── Alerts ─── */
.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  font-size: var(--fs-base);
  border: 1px solid;
  margin-bottom: var(--s-4);
}
.alert-success { background: var(--c-success-soft); color: var(--c-success-text); border-color: rgba(4, 120, 87, 0.2); }
.alert-error   { background: var(--c-danger-soft);  color: var(--c-danger-text);  border-color: rgba(185, 28, 28, 0.2); }
.alert-info    { background: var(--c-primary-soft); color: var(--c-primary-text); border-color: rgba(30, 64, 175, 0.2); }

/* ─── Top nav (used on public pages) ─── */
.topnav {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  height: var(--header-h);
}
.topnav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--s-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
}
.topnav-brand { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--c-primary); }
.topnav-links { display: flex; gap: var(--s-2); align-items: center; }
.topnav-links a {
  padding: 6px 12px;
  color: var(--c-text-muted);
  font-weight: var(--fw-medium);
  border-radius: var(--r);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.topnav-links a:hover { background: var(--c-surface-2); color: var(--c-text); }
.topnav-links a.active { color: var(--c-primary); background: var(--c-primary-soft); }

/* ─── Container for public pages ─── */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s-6); }

/* ─── Mobile ─── */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -100%;
    z-index: 100;
    transition: left var(--t-base);
  }
  .app-sidebar.open { left: 0; }
  .app-main { padding: var(--s-5) var(--s-4); }
  .hero-continue { grid-template-columns: 1fr; }
  .hero-continue .btn { justify-self: stretch; }
}
@media (max-width: 600px) {
  :root { --fs-2xl: 22px; --fs-xl: 18px; --fs-lg: 16px; }
  .app-main { padding: var(--s-4) var(--s-3); }
  .card-body { padding: var(--s-4); }
  .topnav-inner { padding: 0 var(--s-3); gap: var(--s-2); }
  .topnav-links a { padding: 6px 8px; font-size: var(--fs-sm); }
}

/* ─── Mobile bottom tab bar ─── */
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .mobile-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 4px; text-decoration: none;
    color: var(--c-text-muted);
    transition: color var(--t-fast);
  }
  .mobile-nav-item:hover, .mobile-nav-item.active { color: var(--c-primary); text-decoration: none; }
  .mobile-nav-item.active { background: var(--c-primary-soft); }
  .mobile-nav-ico { font-size: 18px; line-height: 1; }
  .mobile-nav-label { font-size: 10px; font-weight: var(--fw-medium); }
  /* Page padding to avoid content hidden behind bottom nav */
  .app-main { padding-bottom: 80px !important; }
  body { padding-bottom: 0; }
}
