/* ══════════════════════════════════════════════════════════════
   IT Day 2025 — Main Stylesheet
   วิทยาลัยเทคโนโลยีภาคตะวันออก (อี.เทค)
   Integration: Bootstrap 5 + Custom Charcoal/Gold Dashboard Layout
   ════════════════════════════════════════════════════════════ */

:root {
  --primary: #2d3238;
  --primary-dark: #1a1d20;
  --primary-light: #495057;
  --accent: #eab308;
  --accent-light: #fde047;
  --accent-dark: #ca8a04;
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #dee2e6;
  
  --font-body: 'Kanit', sans-serif;
  --font-display: 'Prompt', sans-serif;
  
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
}

/* ─── Global Font Adjustments ─── */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: #212529;
}

h1, h2, h3, h4, h5, h6, .page-title, .brand-text, .nav-section {
  font-family: var(--font-display);
}

/* ─── Dashboard Layout ─── */
.main-wrap {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--primary-dark);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.content-area {
  flex: 1;
  padding: 2rem;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex-grow: 1;
}

/* ─── Sidebar Components ─── */
.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand .brand-logo {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.3);
}

.sidebar-brand .brand-text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.sidebar-user {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

.sidebar-user .user-name {
  font-weight: 600;
  color: #fff;
  font-size: 0.875rem;
}

.sidebar-user .user-role {
  color: var(--accent-light);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.sidebar-user .user-school {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-section {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--accent-light);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(234, 179, 8, 0.12);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-nav .nav-link .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .logout-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  transition: color var(--transition);
  text-decoration: none;
}

.sidebar-footer .logout-btn:hover {
  color: var(--accent-light);
}

/* ─── Topbar ─── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  margin: -2rem -2rem 2rem;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: #6c757d;
}

/* ─── Custom Stat Cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: #e0f2fe; color: #0369a1; }
.stat-card .stat-icon.gold { background: #fef9c3; color: #a16207; }
.stat-card .stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-card .stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-card .stat-icon.red { background: #fee2e2; color: #b91c1c; }

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

/* ─── Custom Badges (Bootstrap 5 Override Bridge) ─── */
.badge {
  font-weight: 600;
  border-radius: 6px;
  font-size: 0.75rem;
  padding: 0.3em 0.6em;
}

.badge-pending { background-color: #ffc107 !important; color: #000 !important; }
.badge-approved { background-color: #198754 !important; color: #fff !important; }
.badge-rejected { background-color: #dc3545 !important; color: #fff !important; }
.badge-cancelled { background-color: #6c757d !important; color: #fff !important; }
.badge-open { background-color: #198754 !important; color: #fff !important; }
.badge-closed { background-color: #dc3545 !important; color: #fff !important; }
.badge-junior { background-color: #0d6efd !important; color: #fff !important; }
.badge-senior { background-color: #6f42c1 !important; color: #fff !important; }

/* ─── Custom Form Layout Enhancements ─── */
.form-section {
  background: #f8f9fa;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.form-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
}

.form-row, .form-row-3 {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group, .form-row-3 .form-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.4rem;
  display: block;
}

.form-group .req {
  color: #dc3545;
  margin-left: 2px;
}

/* ─── Custom Table Wrappers ─── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.01);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  vertical-align: middle;
}

.table-wrap th {
  background-color: var(--primary-dark);
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table-wrap td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.table-wrap tbody tr:hover {
  background-color: var(--surface-2);
}

/* ─── Timeline / Progress ─── */
.status-timeline {
  display: flex;
  width: 100%;
  margin-bottom: 1.5rem;
}

.status-step {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 0.5rem;
}

.status-step::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.status-step:last-child::before {
  display: none;
}

.status-step .step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--border);
  margin: 0 auto 0.5rem;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
}

.status-step.done .step-dot { background: #198754; }
.status-step.active .step-dot { background: #ffc107; }

.status-step .step-label {
  font-size: 0.75rem;
  color: #6c757d;
}

.status-step.done .step-label { color: #198754; font-weight: 600; }
.status-step.active .step-label { color: #ffc107; font-weight: 600; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6c757d;
}

.empty-state .empty-icon {
  font-size: 3rem;
  color: #dee2e6;
  margin-bottom: 1rem;
}

.empty-state h4 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

/* ─── Auth Page Layout (Clean modern style) ─── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-circle {
  width: 56px;
  height: 56px;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.2);
}

.auth-logo h2 {
  font-family: var(--font-display);
  color: var(--primary-dark);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.auth-logo p {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 0;
}

.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.auth-links a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.auth-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ─── Quota bars ─── */
.quota-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quota-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.quota-label {
  width: 55px;
  color: #6c757d;
  font-weight: 600;
  flex-shrink: 0;
}

.quota-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.quota-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #facc15);
  border-radius: 99px;
  transition: width 0.4s;
}

.quota-num {
  font-size: 0.75rem;
  color: #6c757d;
  white-space: nowrap;
}

/* ─── Print overrides ─── */
@media print {
  .sidebar, .topbar, .btn, .no-print {
    display: none !important;
  }
  .content-area {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ─── Mobile Responsiveness ─── */
@media (max-width: 768px) {
  .sidebar {
    display: none; /* simple sidebar hide, Bootstrap navbar can be used or hamburger built later */
  }

  .content-area {
    padding: 1.25rem;
  }

  .topbar {
    margin: -1.25rem -1.25rem 1.25rem;
    padding: 0.75rem 1.25rem;
  }

  .form-row, .form-row-3 {
    flex-direction: column;
    gap: 0;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}