/* ═══════════════════════════════════════════════════════════════
   Training Management System — Global Styles
   Design: Dark sidebar + Light content area, Premium feel
   ═══════════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 60px;

  --primary: #1a6bae;
  --primary-dark: #0f4c7a;
  --primary-light: #e8f4fd;
  --accent: #00c9a7;
  --accent-dark: #00a688;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --info: #2980b9;

  --sidebar-bg: #0f2240;
  --sidebar-hover: #1a3a5c;
  --sidebar-active: #1a6bae;
  --sidebar-text: #a8c0d6;
  --sidebar-text-active: #ffffff;

  --body-bg: #f0f4f8;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-radius: 12px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.12), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Mukta', sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .sidebar-user-badge { justify-content: center; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  flex-shrink: 0;
}
.brand-title { display: block; font-weight: 700; color: #fff; font-size: 16px; }
.brand-sub { display: block; font-size: 10px; color: var(--sidebar-text); }

/* User badge */
.sidebar-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.user-avatar { font-size: 28px; color: var(--sidebar-text); flex-shrink: 0; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: #fff; }
.user-info { overflow: hidden; }

.badge-admin { background: linear-gradient(135deg, #f39c12, #e74c3c) !important; font-size: 10px; }
.badge-user { background: linear-gradient(135deg, var(--accent), var(--primary)) !important; font-size: 10px; }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-text);
  padding: 14px 10px 6px;
  opacity: .6;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  transform: translateX(3px);
}
.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 4px 12px rgba(26,107,174,.4);
}
.nav-link i { font-size: 16px; flex-shrink: 0; }

/* Footer */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.logout-link { color: #e74c3c !important; }
.logout-link:hover { background: rgba(231,76,60,.15) !important; }

/* ─── Main Wrapper ──────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.main-wrapper.expanded { margin-left: var(--sidebar-collapsed-width); }

/* ─── Top Navbar ────────────────────────────────────────────────── */
.top-navbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--primary-light); color: var(--primary); }
.navbar-breadcrumb { flex: 1; font-weight: 600; color: var(--text-primary); font-size: 15px; }
.date-badge {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Flash / Alerts ────────────────────────────────────────────── */
.flash-container { padding: 0 24px; margin-top: 12px; }
.flash-alert {
  border-radius: var(--border-radius-sm);
  border: none;
  box-shadow: var(--shadow);
}

/* ─── Page Content ──────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ─── Page Header ───────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.page-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ─── Stat Cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  position: relative;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 32px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Stat card color variants */
.stat-blue  { --card-accent: var(--primary); }
.stat-blue .stat-icon  { background: #ebf4ff; color: var(--primary); }
.stat-green { --card-accent: var(--success); }
.stat-green .stat-icon { background: #eafaf1; color: var(--success); }
.stat-orange{ --card-accent: var(--warning); }
.stat-orange .stat-icon{ background: #fef9e7; color: var(--warning); }
.stat-red   { --card-accent: var(--danger); }
.stat-red .stat-icon   { background: #fdedec; color: var(--danger); }
.stat-teal  { --card-accent: var(--accent); }
.stat-teal .stat-icon  { background: #e8fdf8; color: var(--accent); }

/* ─── Cards ─────────────────────────────────────────────────────── */
.tms-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tms-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, #fafbfc, var(--card-bg));
}
.tms-card-header h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tms-card-body { padding: 20px; }

/* ─── Tables ─────────────────────────────────────────────────────── */
.tms-table-wrapper { overflow-x: auto; border-radius: var(--border-radius-sm); }
.tms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tms-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tms-table tbody tr {
  border-bottom: 1px solid var(--card-border);
  transition: background .15s;
}
.tms-table tbody tr:hover { background: var(--primary-light); }
.tms-table tbody td { padding: 10px 14px; color: var(--text-primary); vertical-align: middle; }
.tms-table .matrix-1 {
  background: #eafaf1; color: var(--success); font-weight: 700;
  border-radius: 4px; padding: 2px 8px;
}
.tms-table .matrix-0 {
  background: #fdedec; color: var(--danger); font-weight: 700;
  border-radius: 4px; padding: 2px 8px;
}

/* ─── Badges & Status ────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status-pending  { background: #fef9e7; color: #b7770d; border: 1px solid #f9d948; }
.status-approved { background: #eafaf1; color: #1a8a3d; border: 1px solid #82e0aa; }
.status-rejected { background: #fdedec; color: #c0392b; border: 1px solid #f1948a; }

/* ─── Forms ──────────────────────────────────────────────────────── */
.tms-form-group { margin-bottom: 16px; }
.tms-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.tms-form-group .form-control,
.tms-form-group .form-select {
  border: 1.5px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  transition: var(--transition);
  background: var(--card-bg);
}
.tms-form-group .form-control:focus,
.tms-form-group .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,174,.15);
  outline: none;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn-tms {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-tms:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary-tms { background: var(--primary); color: white; }
.btn-primary-tms:hover { background: var(--primary-dark); color: white; }
.btn-success-tms { background: var(--success); color: white; }
.btn-success-tms:hover { background: #219150; color: white; }
.btn-danger-tms { background: var(--danger); color: white; }
.btn-danger-tms:hover { background: #c0392b; color: white; }
.btn-warning-tms { background: var(--warning); color: white; }
.btn-outline-tms { background: transparent; border: 1.5px solid var(--card-border); color: var(--text-secondary); }
.btn-outline-tms:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ─── Progress Bars ──────────────────────────────────────────────── */
.tms-progress {
  height: 8px;
  border-radius: 4px;
  background: #e9ecef;
  overflow: hidden;
}
.tms-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .6s ease;
}

/* ─── Auth Page ──────────────────────────────────────────────────── */
.auth-page {
  background: linear-gradient(135deg, #0f2240 0%, #1a6bae 50%, #00c9a7 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.auth-logo {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: white;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(26,107,174,.4);
}
.auth-title { font-size: 22px; font-weight: 800; text-align: center; color: var(--text-primary); }
.auth-subtitle { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }

/* ─── Priority Score Badge ───────────────────────────────────────── */
.priority-high   { background: #fdedec; color: #c0392b; border: 1px solid #f1948a; }
.priority-medium { background: #fef9e7; color: #b7770d; border: 1px solid #f9d948; }
.priority-low    { background: #eafaf1; color: #1a8a3d; border: 1px solid #82e0aa; }

/* ─── Modal ──────────────────────────────────────────────────────── */
.tms-modal .modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}
.tms-modal .modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.tms-modal .modal-header .btn-close { filter: invert(1); }

/* ─── Nepali Datepicker Override ─────────────────────────────────── */
.nepali-date-input {
  width: 100%;
  border: 1.5px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card-bg);
  transition: var(--transition);
}
.nepali-date-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,174,.15);
  outline: none;
}

/* ─── Worker Profile Card ────────────────────────────────────────── */
.worker-avatar {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  color: white;
  font-weight: 700;
}
.profile-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--card-border);
}
.profile-detail-item:last-child { border-bottom: none; }
.profile-detail-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; min-width: 130px; }
.profile-detail-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }

/* ─── AI Suggestion Card ─────────────────────────────────────────── */
.suggestion-card {
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.suggestion-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.suggestion-rank {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.suggestion-info { flex: 1; }
.suggestion-name { font-weight: 700; font-size: 14px; }
.suggestion-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.suggestion-score {
  text-align: right;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}
.suggestion-score span { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-value { font-size: 24px; }
}

/* ─── Animations ─────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .4s ease forwards; }
.animate-delay-1 { animation-delay: .1s; opacity: 0; }
.animate-delay-2 { animation-delay: .2s; opacity: 0; }
.animate-delay-3 { animation-delay: .3s; opacity: 0; }
.animate-delay-4 { animation-delay: .4s; opacity: 0; }

/* ─── Utility ────────────────────────────────────────────────────── */
.text-primary-tms { color: var(--primary) !important; }
.text-accent      { color: var(--accent) !important; }
.bg-primary-light { background: var(--primary-light) !important; }
.gap-2 { gap: 8px; }
.rounded-tms { border-radius: var(--border-radius); }
.cursor-pointer { cursor: pointer; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
