/* ============================================================
   VOBC Course Management System — Shared Styles
   Brand: Navy #0a2240, Gold #c9a227
   ============================================================ */

:root {
  --navy: #0a2240;
  --navy-dark: #061628;
  --navy-light: #1a3a5c;
  --gold: #c9a227;
  --gold-light: #f5e6c8;
  --gold-dark: #a07f1a;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e0e4ea;
  --gray-300: #c8cdd6;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --yellow-light: #fef9c3;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.container, main > .container {
  padding-top: 2rem;
  padding-bottom: 3rem;
  flex: 1;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  gap: 1rem;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-header .logo h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.site-header .logo .subtitle {
  font-size: 0.75rem;
  color: var(--gold-light);
  font-weight: 400;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.site-header nav a {
  color: var(--gold-light);
  font-size: 0.875rem;
  white-space: nowrap;
}

.site-header nav a:hover { color: var(--white); }

/* ============================================================
   BANNER
   ============================================================ */

.banner {
  background: var(--gold);
  color: var(--navy-dark);
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.banner code, .banner strong {
  background: rgba(0,0,0,0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-navy {
  background: var(--navy);
  color: var(--white);
}
.btn-navy:hover { background: var(--navy-light); color: var(--white); }

.btn-gold {
  background: var(--gold);
  color: var(--navy-dark);
}
.btn-gold:hover { background: var(--gold-dark); color: var(--white); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-green {
  background: var(--green);
  color: var(--white);
}
.btn-green:hover { background: #15803d; color: var(--white); }

.btn-red {
  background: var(--red);
  color: var(--white);
}
.btn-red:hover { background: #b91c1c; color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border: 1px solid var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* ============================================================
   QUARTER HEADER (public course sheet)
   ============================================================ */

.quarter-header {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.quarter-header::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 200px; height: 100%;
  background: linear-gradient(135deg, transparent 40%, rgba(201,162,39,0.15));
}

.quarter-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--white);
}

.quarter-header .quarter-dates {
  color: var(--gold-light);
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.quarter-header .enroll-link {
  color: var(--gold);
  font-size: 0.9rem;
}

.quarter-header .enroll-link a {
  color: var(--gold);
  font-weight: 600;
}

.quarter-header .enroll-link a:hover { color: var(--gold-light); }

/* ============================================================
   COURSE SECTIONS
   ============================================================ */

.course-section {
  margin-bottom: 2.5rem;
}

.section-header {
  border-left: 4px solid var(--gold);
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  background: var(--white);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.section-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.section-header .section-meta {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 500;
}

.on-demand-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  padding: 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.on-demand-list .elective-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-700);
}

.on-demand-list .elective-item::before {
  content: '●';
  color: var(--gold);
  font-size: 0.6rem;
  flex-shrink: 0;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.875rem;
}

thead th {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.9rem;
  text-align: left;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius) 0 0; }

tbody tr { border-bottom: 1px solid var(--gray-100); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody tr.inactive { opacity: 0.5; }

tbody td {
  padding: 0.7rem 0.9rem;
  vertical-align: top;
  color: var(--gray-700);
}

tbody td strong { color: var(--gray-900); font-weight: 600; }

.row-num {
  color: var(--gray-300);
  font-size: 0.75rem;
  text-align: center;
  width: 2rem;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pending { background: var(--yellow-light); color: #854d0e; }
.badge-approved { background: var(--green-light); color: #166534; }
.badge-rejected { background: var(--red-light); color: #991b1b; }
.badge-active { background: var(--green-light); color: #166534; }
.badge-inactive { background: var(--gray-100); color: var(--gray-500); }

/* ============================================================
   FORMS
   ============================================================ */

.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem 2.5rem;
  max-width: 780px;
  margin: 0 auto;
}

.form-card h2 {
  color: var(--navy);
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.form-card .form-subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--gray-100);
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gold);
  display: inline-block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}

.form-grid .full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
}

label .required { color: var(--red); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10,34,64,0.08);
}

input.error, select.error, textarea.error {
  border-color: var(--red);
}

textarea { resize: vertical; min-height: 100px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.form-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.field-error {
  font-size: 0.75rem;
  color: var(--red);
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background: var(--green-light);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--red-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.75rem;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  background: var(--navy-dark);
  color: var(--gray-300);
  padding: 1.5rem 0;
  font-size: 0.8rem;
  text-align: center;
  margin-top: auto;
}

footer a { color: var(--gold); }
footer a:hover { color: var(--gold-light); }
footer p + p { margin-top: 0.4rem; }

/* ============================================================
   ADMIN — LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-light) 100%);
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-card .brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.login-card .brand p {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.login-card .gold-bar {
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 0 auto 1.5rem;
  width: 60px;
}

.login-card h2 {
  font-size: 1.1rem;
  color: var(--gray-700);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 600;
}

/* ============================================================
   ADMIN — DASHBOARD
   ============================================================ */

.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  background: var(--navy-dark);
  color: var(--white);
  padding: 0;
}

.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.admin-header .brand { font-weight: 700; font-size: 1rem; color: var(--white); }
.admin-header .brand span { color: var(--gold); font-size: 0.75rem; font-weight: 400; display: block; }

.admin-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-header .user-info {
  font-size: 0.8rem;
  color: var(--gray-300);
}

.admin-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.admin-tabs .container {
  display: flex;
  gap: 0;
}

.tab-btn {
  padding: 1rem 1.5rem;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-btn:hover { color: var(--navy); background: var(--gray-50); }

.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  background: var(--gray-50);
}

.tab-btn .count {
  background: var(--gold);
  color: var(--navy-dark);
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  font-weight: 700;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  color: var(--navy);
  font-weight: 700;
}

/* ============================================================
   ADMIN — FILTER BAR
   ============================================================ */

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ============================================================
   ADMIN — INLINE EDIT
   ============================================================ */

.admin-table td input,
.admin-table td select {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid var(--navy);
  border-radius: 4px;
  font-size: 0.8rem;
  min-width: 80px;
}

.admin-table .actions-col {
  white-space: nowrap;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.admin-table tr.editing { background: #fffbeb !important; }

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: var(--white);
}

.modal-header h3 { font-size: 1.1rem; color: var(--navy); font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover { color: var(--gray-700); }

.modal-body { padding: 1.5rem; }

/* ── Combobox (shared: request form + admin modal) ── */
.combobox-wrap { position: relative; }
.combobox-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--teal);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(10,30,64,0.13);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1200;
}
.combobox-option {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.combobox-option:last-child { border-bottom: none; }
.combobox-option:hover,
.combobox-option.highlighted { background: #EBF5FA; }
.combobox-option .opt-name { flex: 1; }
.combobox-option .opt-tag {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  white-space: nowrap;
}
.combobox-no-results {
  padding: 0.85rem;
  font-size: 0.85rem;
  color: var(--gray-500);
  font-style: italic;
  text-align: center;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ============================================================
   REQUEST DETAIL
   ============================================================ */

.request-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-item label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  font-weight: 600;
}

.detail-item p {
  font-size: 0.9rem;
  color: var(--gray-900);
  font-weight: 500;
}

/* ============================================================
   PAGE-SPECIFIC: SUCCESS PAGE
   ============================================================ */

.success-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 560px;
  margin: 4rem auto;
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.success-card h2 {
  color: var(--navy);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.success-card p { color: var(--gray-500); margin-bottom: 1.5rem; }

/* ============================================================
   SECTION ADD ROW CONTROLS
   ============================================================ */

.add-course-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-select-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .site-header .logo h1 { font-size: 0.9rem; }
  .quarter-header { padding: 1.25rem 1.25rem; }
  .quarter-header h2 { font-size: 1.25rem; }
  .form-card { padding: 1.25rem 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
  .modal { max-width: 100%; margin: 0.5rem; }
  .request-detail-grid { grid-template-columns: 1fr; }
  .admin-tabs .tab-btn { padding: 0.75rem 0.75rem; font-size: 0.8rem; }
  table { font-size: 0.8rem; }
  tbody td, thead th { padding: 0.5rem 0.6rem; }
}

@media (max-width: 480px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .panel-header { flex-direction: column; align-items: flex-start; }
}
