/* ============================================================
   Training Center Management System — Stylesheet
   ============================================================ */

:root {
  --primary:    #1a56db;
  --primary-dk: #1242a8;
  --accent:     #f59e0b;
  --success:    #10b981;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --info:       #3b82f6;
  --bg:         #f1f5f9;
  --sidebar-bg: #0f172a;
  --sidebar-w:  240px;
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --card-bg:    #ffffff;
  --topbar-h:   60px;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 100;
  transition: width .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; color: #fff;
  font-size: 1.1rem; font-weight: 700; letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand i { color: var(--accent); font-size: 1.4rem; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section {
  color: rgba(255,255,255,.35); font-size: .7rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 14px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: rgba(255,255,255,.65);
  font-size: .88rem; transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  color: #fff; background: rgba(255,255,255,.06);
  border-left-color: var(--accent);
  text-decoration: none;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; }

/* ---- Main Wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h); background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.sidebar-toggle { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); }
.topbar-title { font-weight: 600; font-size: 1rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.notif-bell { font-size: 1rem; color: var(--muted); cursor: pointer; }
.user-menu {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; position: relative; font-size: .88rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.user-dropdown {
  display: none; position: absolute; top: 44px; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 160px; z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; color: var(--text); font-size: .85rem;
}
.user-dropdown a:hover { background: var(--bg); text-decoration: none; }

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

/* ---- Flash ---- */
.flash-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; margin: 0 24px 0;
  border-radius: var(--radius); font-size: .88rem; font-weight: 500;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-danger  { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info    { background: #dbeafe; color: #1e40af; }
.flash-msg button { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; }

/* ---- Cards ---- */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .95rem;
}
.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--primary); }
.stat-icon.green  { background: #d1fae5; color: var(--success); }
.stat-icon.amber  { background: #fef3c7; color: var(--warning); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-info { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table th {
  background: #f8fafc; color: var(--muted);
  font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left;
}
table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #f8fafc; }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 600; text-transform: capitalize;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--border); color: var(--muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; border: none;
  font-size: .85rem; font-weight: 500; cursor: pointer;
  transition: all .15s; text-decoration: none;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--border);  color: var(--text); }
.btn-sm        { padding: 5px 10px; font-size: .78rem; }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text); }
.form-group .required::after { content: ' *'; color: var(--danger); }
.form-control {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px;
  font-size: .88rem; background: #fff; color: var(--text);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-control select { cursor: pointer; }
.hint { font-size: .75rem; color: var(--muted); }

/* ---- Page Header ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 1.3rem; font-weight: 700; }
.breadcrumb { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ---- Dashboard Charts placeholder ---- */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-placeholder {
  height: 200px; background: var(--bg); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1a56db 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px 36px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo i { font-size: 2.5rem; color: var(--primary); }
.login-logo h1 { font-size: 1.2rem; font-weight: 700; margin-top: 8px; }
.login-logo p  { color: var(--muted); font-size: .82rem; }

/* ---- Utility ---- */
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-muted  { color: var(--muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* ---- Attendance grid ---- */
.att-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.att-btn {
  padding: 6px 14px; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: .8rem;
  background: #fff; transition: all .1s;
}
.att-btn.present { background: #d1fae5; border-color: var(--success); color: #065f46; }
.att-btn.absent  { background: #fee2e2; border-color: var(--danger);  color: #991b1b; }
.att-btn.late    { background: #fef3c7; border-color: var(--warning); color: #92400e; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: var(--sidebar-w); }
  .main-wrapper { margin-left: 0; }
  .chart-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
