@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #10b981;
  --secondary-hover: #059669;
  --accent: #f43f5e;
  
  --background-start: #eef2ff;
  --background-end: #f5f3ff;
  
  --exchange: #db2777;
  --exchange-bg: #fdf2f8;
  --exchange-border: #fbcfe8;
  
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: rgba(229, 231, 235, 0.6);
  --error: #ef4444;
  
  --radius: 16px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

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

body {
  font-family: 'Kanit', 'Inter', sans-serif;
  background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

header h1 {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  letter-spacing: -0.5px;
}

h1, h2, h3 {
  font-weight: 600;
  color: var(--text-main);
}

.text-muted {
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--glass-shadow);
  margin-bottom: 2rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card h2 {
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.grid-2-col {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  align-items: start;
}

.grid-2-col > .card {
  margin-bottom: 0;
}

@media (min-width: 901px) {
  #section-info {
    grid-column: 1;
    grid-row: 1;
  }
  #section-exchange {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  #section-cart {
    grid-column: 1;
    grid-row: 2;
  }
  #section-requests {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 900px) {
  .grid-2-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

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

.border-primary {
  border-top: 4px solid var(--primary);
}

.w-100 {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-solid);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: var(--primary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  background-color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
  color: var(--text-main);
}

.form-control:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-control:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  background-color: var(--border);
  color: var(--text-main);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Admin Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 0.5rem;
  line-height: 1;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: background-color 0.15s;
}

tbody tr:hover {
  background-color: #f1f5f9;
}

/* Schedule Results Cards inside Grid */
.schedule-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s;
}

.schedule-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
/* Schedule Table Styles */
.schedule-grid-wrapper {
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  margin-top: 1rem;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
  table-layout: fixed;
}

.schedule-table th, 
.schedule-table td {
  border: 1px solid #cbd5e1;
  text-align: center;
  padding: 0.5rem;
  height: 80px;
  vertical-align: middle;
}

.schedule-table tr.period-header th {
  background-color: #f8fafc;
  height: 40px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.schedule-table tr.time-header td {
  background-color: #f1f5f9;
  height: 30px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.schedule-table td.day-label {
  background-color: #f8fafc;
  font-weight: 700;
  width: 100px;
  font-size: 1rem;
}

.schedule-table td.break-cell, .schedule-table td.lunch-cell {
  background-color: #fef2f2;
  color: #ef4444;
  font-weight: 700;
  font-size: 1rem;
  width: 40px;
  text-align: center;
  padding: 0 !important;
  vertical-align: middle;
}

.lunch-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: -2px;
  display: inline-block;
}

.schedule-cell {
  padding: 0.25rem !important;
  font-size: 0.8rem;
  line-height: 1.2;
}

.schedule-cell strong {
  display: block;
  color: var(--primary);
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.schedule-cell .room-info {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* My Schedule Cards */
.my-sched-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.my-sched-card:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  background: #f8faff;
  box-shadow: var(--shadow-sm);
}

.my-sched-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--border);
  transition: background 0.2s;
}

.my-sched-card:hover::before {
  background: var(--primary);
}

.my-sched-card.active {
  border-color: var(--primary);
  background: #f0f4ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.my-sched-card.active::before {
  background: var(--primary);
  width: 6px;
}

.card-period {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.card-subject {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

/* Choice Overlay */
.choice-container {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
