/* ============================================================
 * ServHub Training | v4 stylesheet
 * Mobile-first responsive | shared between public form, student portal, admin
 * ============================================================ */

* { box-sizing: border-box; }

:root {
  --primary: #1A5276;
  --primary-dark: #154360;
  --primary-light: #EBF5FB;
  --accent: #27ae60;
  --warn: #f39c12;
  --danger: #c0392b;
  --text: #2c3e50;
  --text-muted: #6c757d;
  --border: #e9ecef;
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-sm: 4px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ============================================================
 * TOPBAR
 * ============================================================ */
.topbar {
  background: linear-gradient(135deg, #154360 0%, #1A5276 100%);
  color: #fff;
  padding: 14px 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar-logo { display: flex; align-items: center; gap: 12px; color: #fff; }
.topbar-logo img { height: 40px; width: 40px; object-fit: contain; border-radius: 6px; background: rgba(255,255,255,0.1); padding: 4px; }
.topbar-logo .name { font-size: 16px; font-weight: 700; line-height: 1.2; }
.topbar-logo .sub { font-size: 11px; opacity: 0.8; letter-spacing: 0.5px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-track {
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-track:hover { background: rgba(255,255,255,0.28); text-decoration: none; }
.btn-track-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.3); }

/* ============================================================
 * HERO
 * ============================================================ */
.hero {
  background: linear-gradient(135deg, #1A5276 0%, #154360 100%);
  color: #fff;
  padding: 40px 20px 50px;
  text-align: center;
}
.hero h1 { font-size: 28px; margin: 0 0 12px; font-weight: 700; line-height: 1.2; }
.hero p { font-size: 15px; opacity: 0.92; max-width: 720px; margin: 0 auto 20px; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.badge-pill {
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ============================================================
 * LAYOUT WRAPPERS
 * ============================================================ */
.wrap {
  max-width: 920px;
  margin: -20px auto 40px;
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

/* ============================================================
 * CARDS
 * ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  background: linear-gradient(180deg, #fff 0%, #f8f9fa 100%);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body { padding: 20px; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
 * FORMS
 * ============================================================ */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.field.full, .form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; }
.field label {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 6px;
}
.field .req { color: var(--danger); }
.field .hint, .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.field .hint-inline, .hint-inline {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: normal;
}
.field .err-msg {
  display: none;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}
.field.error .err-msg { display: block; }
.field.error input, .field.error select, .field.error textarea {
  border-color: var(--danger);
  background: #fef5f5;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], input[type="file"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}
input[readonly] { background: #f8f9fa; cursor: not-allowed; }
textarea { min-height: 80px; resize: vertical; }
input[type="file"] { padding: 8px; background: #f8f9fa; }

/* Checkbox styling */
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-row.error span { color: var(--danger); }

/* ============================================================
 * BUTTONS
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  text-decoration: none;
  font-family: inherit;
  min-height: 40px;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #545b62; text-decoration: none; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: #1e8449; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #962d22; text-decoration: none; }
.btn-link { background: transparent; color: var(--primary); padding: 4px 0; min-height: 0; font-size: 12px; text-decoration: underline; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.actions {
  padding: 16px 20px;
  background: #f8f9fa;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; }
}

/* ============================================================
 * NIN BLOCK
 * ============================================================ */
.nin-block {
  background: var(--primary-light);
  border: 1px solid #cce0ec;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.nin-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--primary-dark);
}
.nin-row { display: flex; gap: 8px; }
.nin-row input { flex: 1; }
@media (max-width: 480px) {
  .nin-row { flex-direction: column; }
  .nin-row .btn { width: 100%; }
}

/* Photo preview */
.photo-preview-block { margin-bottom: 20px; }
.photo-preview-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background: #f0f9f4;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}
.photo-preview-img-wrap {
  width: 110px;
  height: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #e9ecef;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}
.photo-preview-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-meta { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.photo-preview-meta strong { color: var(--accent); font-size: 14px; }

/* Referral row */
.referral-row { display: flex; gap: 8px; }
.referral-row input { flex: 1; }
@media (max-width: 480px) {
  .referral-row { flex-direction: column; }
  .referral-row .btn { width: 100%; }
}

/* Price summary */
#price-summary {
  margin-top: 16px;
  padding: 14px 18px;
  background: #eafaf1;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}
.price-summary-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.price-summary-label { font-size: 13px; color: #1e6e3e; }
.price-summary-original { font-size: 13px; color: var(--text-muted); text-decoration: line-through; }
.price-summary-final-label { font-size: 12px; color: var(--text-muted); }
.price-summary-final-amount { font-size: 22px; font-weight: 700; color: #1e6e3e; }

/* ============================================================
 * LEVEL CARDS
 * ============================================================ */
.level-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
@media (max-width: 600px) {
  .level-select { grid-template-columns: 1fr; }
}
.level-card {
  border: 2px solid #d1d5db;
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}
.level-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.level-card.selected { border-color: var(--accent); background: #eafaf1; box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15); }
.level-card h4 { margin: 0 0 8px; color: var(--primary-dark); font-size: 16px; font-weight: 700; }
.level-card .price { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.level-card .desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* Advanced level placement notice */
.advanced-notice {
  margin-top: 14px;
  padding: 16px;
  background: #fff8e1;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.advanced-notice-icon { font-size: 24px; flex-shrink: 0; }
.advanced-notice strong { color: #856404; display: block; margin-bottom: 6px; font-size: 14px; }
.advanced-notice p { margin: 0 0 8px; font-size: 13px; color: #856404; line-height: 1.5; }
.advanced-notice p:last-child { margin-bottom: 0; }

/* ============================================================
 * ALERTS
 * ============================================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--accent); }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warn); }
.alert-danger { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }

/* ============================================================
 * BADGES
 * ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-paid { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-failed { background: #f8d7da; color: #721c24; }
.badge-active { background: var(--primary-light); color: var(--primary-dark); }

/* ============================================================
 * TABLES
 * ============================================================ */
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table th { background: #f8f9fa; font-weight: 600; font-size: 13px; color: var(--text-muted); }
table tbody tr:hover { background: #f8f9fa; }
@media (max-width: 768px) {
  table { font-size: 13px; }
  table th, table td { padding: 8px; }
}

/* ============================================================
 * FOOTER
 * ============================================================ */
.site-footer {
  background: #2c3e50;
  color: #bdc3c7;
  padding: 32px 20px 20px;
  margin-top: 40px;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 768px) {
  .site-footer-inner { grid-template-columns: 1fr; gap: 18px; text-align: center; }
}
.site-footer-links { display: flex; flex-direction: column; gap: 6px; }
.site-footer-links a { color: #bdc3c7; }
.site-footer-links a:hover { color: #fff; }
.site-footer-social { display: flex; flex-direction: column; gap: 8px; }
.site-footer-social .hint { color: #95a5a6; margin-bottom: 4px; }
.social-link {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  margin-right: 6px;
}
.social-link:hover { background: rgba(255,255,255,0.18); text-decoration: none; }
.site-footer-bottom {
  max-width: 1200px;
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 12px;
  color: #7f8c8d;
}

/* ============================================================
 * ADMIN SHELL
 * ============================================================ */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.admin-sidebar {
  background: var(--primary-dark);
  color: #fff;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .brand { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 16px; }
.admin-sidebar .brand img { height: 36px; }
.admin-sidebar .brand .name { font-size: 14px; font-weight: 600; margin-top: 8px; opacity: 0.9; }
.admin-sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.admin-sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
  color: #fff;
}
.admin-content { padding: 24px; min-width: 0; }

/* Mobile admin */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.25s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  }
  .admin-sidebar.open { left: 0; }
  .admin-content { padding: 64px 16px 24px; }
  .mobile-menu-toggle { display: block; }
  .admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
  }
  .admin-sidebar-backdrop.open { display: block; }
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-box {
  background: #fff;
  padding: 18px;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
.stat-box .num { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-box .lbl { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.3px; }

/* ============================================================
 * STUDENT PORTAL
 * ============================================================ */
.student-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.student-sidebar {
  background: linear-gradient(180deg, #1A5276 0%, #154360 100%);
  color: #fff;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.student-sidebar .brand { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 16px; }
.student-sidebar .brand img { height: 36px; }
.student-sidebar .brand .name { font-size: 14px; font-weight: 600; margin-top: 8px; opacity: 0.9; }
.student-sidebar nav a {
  display: block;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13px;
}
.student-sidebar nav a:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.student-sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
  color: #fff;
}
.student-content { padding: 24px; min-width: 0; }
.student-greeting {
  background: linear-gradient(135deg, #1A5276 0%, #154360 100%);
  color: #fff;
  padding: 24px 28px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.student-greeting h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.student-greeting p { margin: 0; opacity: 0.9; font-size: 14px; }

@media (max-width: 900px) {
  .student-shell { grid-template-columns: 1fr; }
  .student-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.25s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  }
  .student-sidebar.open { left: 0; }
  .student-content { padding: 64px 16px 24px; }
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 600px) {
  .hero { padding: 30px 16px 40px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .topbar-inner { padding: 0 12px; }
  .topbar-logo .name { font-size: 14px; }
  .topbar-logo .sub { font-size: 10px; }
  .btn-track { font-size: 12px; padding: 6px 10px; }
  .wrap { padding: 0 12px; margin-top: -12px; }
  .card-body { padding: 16px; }
  .card-header { padding: 12px 16px; font-size: 14px; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .hero h1 { font-size: 20px; }
  .topbar-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}

/* Print */
@media print {
  .topbar, .site-footer, .admin-sidebar, .student-sidebar, .actions { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
