/* ============================================
   GBC Orchestra Management - Complete Stylesheet
   강남중앙침례교회 오케스트라 관리 시스템
   ============================================ */

/* --- CSS Variables --- */
:root {
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a5f;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji',
    'Segoe UI Symbol', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Layout --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-content {
  padding: 80px 0 40px;
  min-height: calc(100vh - 60px);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-700);
  white-space: nowrap;
}

.nav-brand-icon { font-size: 1.3rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--primary-50);
  color: var(--primary-700);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user {
  font-size: 0.8rem;
  color: var(--gray-500);
  white-space: nowrap;
}

/* Hamburger menu */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 8px;
  font-size: 1.5rem;
  color: var(--gray-700);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-inline {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.form-inline .form-group { margin-bottom: 0; flex: 1; }

.form-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 42px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary-600); color: white; }
.btn-primary:hover { background: var(--primary-700); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: 34px; }
.btn-xs { padding: 4px 8px; font-size: 0.75rem; min-height: 28px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; min-height: 48px; }
.btn-icon { padding: 8px; min-width: 42px; }
.btn-block { width: 100%; }

/* --- Attendance Grid --- */
.attendance-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-nav .current-month {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  min-width: 120px;
  text-align: center;
}

.attendance-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
}

.attendance-table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13px;
}

.attendance-table th,
.attendance-table td {
  border: 1px solid var(--gray-200);
  padding: 6px 4px;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.attendance-table th {
  background: var(--primary-50);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gray-700);
  position: sticky;
  top: 0;
  z-index: 20;
}

.attendance-table th.date-header {
  min-width: 68px;
  writing-mode: horizontal-tb;
}

.attendance-table th.date-header .date-label {
  display: block;
  font-size: 0.7rem;
  color: var(--primary-600);
  font-weight: 400;
}

/* Sticky columns */
.sticky-col {
  position: sticky;
  z-index: 10;
  background: white;
}

.sticky-col-name {
  left: 0;
  min-width: 60px;
  max-width: 80px;
  font-weight: 600;
  font-size: 0.8rem;
}

.sticky-col-inst {
  left: 60px;
  min-width: 80px;
  max-width: 100px;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.attendance-table thead .sticky-col { z-index: 30; background: var(--primary-50); }

/* Group header rows */
.group-header-row td {
  background: var(--primary-100) !important;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary-800);
  text-align: left;
  padding: 8px 12px;
}

.group-header-row .group-label-cell {
  z-index: 22;
}

.group-header-row .group-label-fill {
  background: var(--primary-100) !important;
}

/* Summary footer */
.attendance-table tfoot td {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gray-600);
}

/* --- Attendance Status Buttons --- */
.status-cell {
  position: relative;
  padding: 2px !important;
}

.status-btn {
  width: 100%;
  min-width: 56px;
  padding: 6px 2px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
  position: relative;
  font-family: inherit;
}

.status-btn:active { transform: scale(0.92); }

.status-present { background: var(--success); color: white; }
.status-absent { background: var(--danger); color: white; }
.status-late { background: var(--warning); color: white; }
.status-none { background: var(--gray-200); color: var(--gray-400); }

.status-readonly { cursor: default; }
.status-readonly:active { transform: none; }

.memo-indicator {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
}

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active { display: flex; }

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

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
}

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

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

.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  max-width: 360px;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(100px); } }

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary-600); }

/* --- Stats Cards (Dashboard) --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.stat-icon-blue { background: var(--primary-100); }
.stat-icon-green { background: var(--success-light); }
.stat-icon-yellow { background: var(--warning-light); }
.stat-icon-red { background: var(--danger-light); }

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* --- Navigation Cards (Dashboard) --- */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  color: inherit;
}

.nav-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

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

.nav-card-text h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.nav-card-text p {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.4;
}

/* --- Data Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.members-table,
.admin-users-table {
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.875rem;
}

.data-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:hover { background: var(--primary-50); }

.data-table .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* --- Parking Page --- */
.parking-step {
  margin-bottom: 24px;
}

.parking-step h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary-600);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.member-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
}

.member-check-item:hover { background: var(--gray-50); }
.member-check-item.checked { background: var(--primary-50); border-color: var(--primary-300); }

.member-check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-600);
  cursor: pointer;
}

.member-check-info { flex: 1; }
.member-check-info .member-name { font-weight: 600; font-size: 0.9rem; }
.member-check-info .member-inst { font-size: 0.8rem; color: var(--gray-500); }

.vehicle-list {
  margin-left: 30px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vehicle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 0.85rem;
}

.vehicle-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-600);
}

.temp-vehicle-input {
  display: flex;
  gap: 6px;
  margin-left: 30px;
  margin-top: 4px;
}

.temp-vehicle-input input {
  flex: 1;
  height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
}

/* Template selector */
.template-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.template-option:hover { background: var(--gray-50); }
.template-option.selected { background: var(--primary-50); border-color: var(--primary-500); }

.template-option input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--primary-600);
}

.template-option .template-name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.template-option .template-preview {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-family: 'D2Coding', monospace;
}

/* Parking preview */
.parking-preview {
  background: var(--gray-900);
  color: #e5e7eb;
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'D2Coding', 'SF Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.copy-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.copy-count {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* --- Instrument Group Colors --- */
.inst-group-strings { color: #b45309; }
.inst-group-woodwind { color: #047857; }
.inst-group-brass { color: #7c3aed; }
.inst-group-percussion { color: #dc2626; }
.inst-group-keyboard { color: #0369a1; }

/* --- Badge / Tag --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--primary-100); color: var(--primary-800); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

/* --- Search Bar --- */
.search-bar {
  position: relative;
  max-width: 280px;
}

.search-bar input {
  width: 100%;
  height: 38px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  background: white;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
}

.tab {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: inherit;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary-600); border-bottom-color: var(--primary-600); font-weight: 600; }

/* --- Login Page --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 20px;
}

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

.login-card h2 {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.login-card .subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 24px;
}

.login-error {
  background: var(--danger-light);
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px 16px;
  font-size: 0.75rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  margin-top: 40px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; margin-bottom: 16px; }

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--gray-500); }
.font-mono { font-family: 'D2Coding', 'SF Mono', monospace; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-toggle-label { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 8px;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--gray-200);
  }

  .nav-toggle:checked ~ .nav-links { display: flex; }

  .nav-links a { padding: 12px 16px; width: 100%; }

  .nav-right { display: none; }
  .nav-toggle:checked ~ .nav-right {
    display: flex;
    position: absolute;
    top: calc(60px + var(--nav-links-height, 200px));
    left: 0;
    right: 0;
    background: white;
    padding: 8px 16px;
    border-bottom: 1px solid var(--gray-200);
  }

  .page-content { padding: 70px 0 24px; }
  .container { padding: 0 12px; }
  .card { padding: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  .stat-info h3 { font-size: 1.2rem; }

  .nav-cards { grid-template-columns: 1fr; }

  .sticky-col-name { min-width: 50px; max-width: 60px; font-size: 0.75rem; }
  .sticky-col-inst { left: 50px; min-width: 60px; max-width: 70px; }

  .attendance-table th.date-header { min-width: 58px; }
  .status-btn { min-width: 48px; padding: 5px 1px; font-size: 0.68rem; }

  .modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }

  .login-card { padding: 24px; }

  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { flex-direction: column; text-align: center; padding: 12px 8px; }
}

@media (min-width: 1024px) {
  .attendance-table th.date-header { min-width: 76px; }
  .sticky-col-name { min-width: 70px; }
  .sticky-col-inst { left: 70px; min-width: 90px; }
}

/* --- Print Styles --- */
@media print {
  .navbar, .footer, .btn, .modal-overlay, .toast-container { display: none !important; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .attendance-wrapper { overflow: visible; }
  .sticky-col { position: static; }
}
