:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #697386;
  --border: #e4e8ef;
  --primary: #315efb;
  --primary-dark: #2449c9;
  --available: #2e9d61;
  --occupied: #dc4d4d;
  --reserved: #e1a928;
  --shadow: 0 8px 30px rgba(23, 32, 51, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }

.topbar {
  min-height: 76px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 6%;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; background: var(--primary);
  color: #fff; font-weight: 800;
}
.brand h1 { margin: 0; font-size: 21px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

nav { display: flex; gap: 7px; align-items: center; }
nav a {
  text-decoration: none; color: var(--muted); padding: 10px 13px;
  border-radius: 9px; font-weight: 600;
}
nav a.active, nav a:hover { background: #eef2ff; color: var(--primary); }

.signout {
  background: #fff0f0; color: #c83b3b; margin-left: 4px;
}

/* Wider dashboard container so the student seat map uses the free space */
.container { width: min(1680px, 96%); margin: 28px auto 60px; }

.hero {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px; display: flex; align-items: center;
  justify-content: space-between; gap: 25px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.hero h2 { margin: 10px 0 8px; font-size: 30px; }
.hero p { margin: 0; color: var(--muted); line-height: 1.5; }
.badge {
  display: inline-block; background: #eef2ff; color: var(--primary);
  padding: 6px 10px; border-radius: 99px; font-size: 11px; font-weight: 700;
}
.hero-time { font-size: 17px; font-weight: 700; white-space: nowrap; }

.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card, .section-card, .login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 15px; box-shadow: var(--shadow);
}
.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 7px; font-size: 29px; }

.section-card { padding: 22px; margin-bottom: 20px; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; margin-bottom: 18px;
}
.section-header h3, .section-card h3 { margin: 0 0 6px; }
.section-header p, .muted { color: var(--muted); margin: 0; font-size: 13px; }

.progress {
  width: 260px; height: 10px; background: #edf0f5;
  border-radius: 20px; overflow: hidden;
}
.progress div {
  height: 100%; width: 0; background: var(--primary); transition: width .3s;
}

.content-grid, .admin-grid {
  display: grid; grid-template-columns: 1.7fr .8fr; gap: 20px; align-items: start;
}

.library-layout {
  border: 1px dashed #ccd3df; border-radius: 13px; padding: 15px;
  background: #fafbfe;
}
.layout-label {
  text-align: center; color: var(--muted); font-size: 10px;
  font-weight: 700; letter-spacing: 1px; padding: 8px;
}
.entrance { border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.bookshelf { border-top: 1px solid var(--border); margin-top: 15px; }

.seat-map {
  display: grid; grid-template-columns: repeat(6, minmax(55px, 1fr)); gap: 12px;
}
.seat-map.compact { grid-template-columns: repeat(5, 1fr); }

.seat {
  border: 1px solid var(--border); border-radius: 10px; min-height: 62px;
  cursor: pointer; background: #fff; font-weight: 700; transition: .15s;
}
.seat:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,.08); }
.seat.available { border-color: #9ed4b8; background: #f1fbf5; color: #23774a; }
.seat.occupied { border-color: #e6a5a5; background: #fff2f2; color: #b63636; cursor: not-allowed; }
.seat.reserved { border-color: #ead18d; background: #fff9e8; color: #9a7212; cursor: not-allowed; }
.seat.selected { outline: 3px solid rgba(49,94,251,.25); border-color: var(--primary); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.available { background: var(--available); }
.dot.occupied { background: var(--occupied); }
.dot.reserved { background: var(--reserved); }

.booking-card { position: sticky; top: 15px; }
.booking-card label, .login-card label {
  display: block; font-size: 12px; font-weight: 700; margin: 15px 0 7px;
}
input, select {
  width: 100%; border: 1px solid var(--border); padding: 11px 12px;
  border-radius: 9px; outline: none; background: #fff;
}
input:focus, select:focus { border-color: var(--primary); }

button {
  border: 0; border-radius: 9px; padding: 11px 14px;
  cursor: pointer; font-weight: 700;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--primary); color: white; width: 100%; margin-top: 14px; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #eef2ff; color: var(--primary); width: 100%; margin-top: 10px; }
.danger { background: #fff0f0; color: #c83b3b; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.message { margin-top: 13px; font-size: 13px; min-height: 18px; }
.message.success { color: var(--available); }
.message.error { color: var(--occupied); }

.booking-list { display: grid; gap: 10px; }
.booking-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
}
.booking-item strong { display: block; margin-bottom: 4px; }
.booking-item small { color: var(--muted); }

.big-number { font-size: 48px; font-weight: 800; margin: 15px 0 3px; }
.chart { height: 170px; display: flex; align-items: end; gap: 8px; padding-top: 20px; }
.bar-wrap { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.bar { background: var(--primary); border-radius: 5px 5px 0 0; min-height: 5px; margin-bottom: 5px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(430px, 100%); padding: 30px; }
.centered { justify-content: center; margin-bottom: 25px; }
.login-card h2 { margin-bottom: 6px; }
.demo-note {
  background: #f5f7fb; border: 1px solid var(--border); padding: 12px;
  border-radius: 9px; font-size: 12px; color: var(--muted); margin-top: 18px; line-height: 1.5;
}

@media (max-width: 850px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .admin-grid { grid-template-columns: 1fr; }
  .booking-card { position: static; }
}
@media (max-width: 600px) {
  .topbar, .hero { align-items: flex-start; flex-direction: column; }
  nav { width: 100%; flex-wrap: wrap; }
  .seat-map { grid-template-columns: repeat(3, 1fr); }
  .seat-map.compact { grid-template-columns: repeat(4, 1fr); }
  .section-header { align-items: flex-start; flex-direction: column; }
  .progress { width: 100%; }
}

/* Refined, light library theme — green and warm neutrals, no dark/purple UI. */
:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --text: #1d2b25;
  --muted: #68766f;
  --border: #dfe8e2;
  --primary: #21845a;
  --primary-dark: #176844;
  --available: #21845a;
  --occupied: #c94b4b;
  --reserved: #c58a1b;
  --shadow: 0 8px 26px rgba(26, 55, 39, .06);
}
body { background: var(--bg); line-height: 1.5; }
.topbar { padding-inline: max(4%, calc((100% - 1240px) / 2)); }
.brand-icon { background: var(--primary); border-radius: 12px; }
nav a.active, nav a:hover { background: #e8f5ed; color: var(--primary-dark); }
.hero { border-radius: 16px; border-color: #dce9df; }
.badge { background: #e8f5ed; color: var(--primary-dark); letter-spacing: .04em; }
.stat-card, .section-card, .login-card { border-radius: 14px; }
.stat-card strong { color: var(--primary-dark); }
.progress div, .bar { background: var(--primary); }
.library-layout { background: #fbfdfb; border-color: #cbd9cf; }
.seat { min-height: 58px; border-radius: 11px; }
.seat.available { background: #edf8f1; border-color: #a9d8bb; color: #176844; }
.seat.occupied { background: #fff1f0; border-color: #e8b2ae; color: #a83737; }
.seat.reserved { background: #fff8e8; border-color: #e8d19b; color: #8d6513; }
.seat.selected { outline: 3px solid rgba(33, 132, 90, .22); border-color: var(--primary); }
.primary { background: var(--primary); }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #e8f5ed; color: var(--primary-dark); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(33, 132, 90, .10); }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(33, 132, 90, .35); outline-offset: 2px; }
.booking-item { background: #fff; }
.empty-state { padding: 18px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); text-align: center; }
.message { min-height: 20px; }
@media (max-width: 600px) {
  .container { width: min(100% - 24px, 1180px); margin-top: 16px; }
  .hero, .section-card { padding: 18px; }
  .seat-map { gap: 8px; }
  .seat { min-height: 48px; padding: 8px 5px; font-size: 13px; }
}

/* Detailed 132-seat floor plan */
.content-grid { align-items: stretch; }
.content-grid > .section-card { min-width: 0; height: 100%; }
.content-grid > .section-card:first-child { display: flex; flex-direction: column; }
.content-grid .library-layout { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 18px 14px; }
.booking-card { position: relative; top: auto; display: flex; flex-direction: column; }
.booking-card #message { margin-top: auto; padding-top: 12px; }
.floor-plan { width: 100%; flex: 1; display: flex; align-items: center; min-height: 520px; }
.floor-plan-grid { width: 100%; display: grid; gap: 13px; }
.floor-plan-row { display: grid; grid-template-columns: minmax(190px, 1fr) 34px minmax(190px, 1fr) minmax(220px, 1.12fr); align-items: stretch; gap: 10px; }
.pair-zone { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.desk-group, .long-table-group { min-width: 0; padding: 8px 6px; border: 1px solid #e1ebe4; border-radius: 12px; background: #fff; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.desk-group-title { color: #68766f; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: center; white-space: nowrap; }
.desk-seat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.seat { min-width: 0; min-height: 34px; padding: 5px 2px; border-radius: 7px; font-size: 11px; }
.shared-desk, .long-shared-desk { min-height: 22px; display: grid; place-items: center; border: 1px solid #d9e4dc; border-radius: 5px; background: #f0f5f1; color: #738078; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.walking-aisle { border-left: 2px dashed #c4d2c8; border-right: 2px dashed #c4d2c8; display: grid; place-items: center; color: #819087; background: repeating-linear-gradient(135deg, #f5f8f5, #f5f8f5 7px, #edf3ee 7px, #edf3ee 14px); border-radius: 8px; }
.walking-aisle span { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 8px; font-weight: 800; letter-spacing: .12em; line-height: 1.5; }
.aisle-continuation { min-height: 100%; }
.right-zone { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.long-table-group { padding: 8px 5px; gap: 6px; }
.long-seat-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.long-seat-row .seat { font-size: 9px; min-height: 29px; }
.long-shared-desk { min-height: 28px; font-size: 8px; }
.seat-placeholder { display: grid; place-items: center; min-height: 34px; border: 1px dashed #d8e1da; border-radius: 7px; color: #a2ada5; font-size: 10px; }
@media (max-width: 1120px) {
  .floor-plan { overflow-x: auto; align-items: flex-start; }
  .floor-plan-grid { min-width: 760px; }
  .floor-plan-row { grid-template-columns: 190px 28px 190px 220px; }
}
@media (max-width: 850px) {
  .content-grid > .section-card { height: auto; }
  .floor-plan { min-height: 0; overflow-x: auto; }
  .floor-plan-grid { min-width: 760px; }
  .booking-card { min-height: 0; }
}
@media (max-width: 600px) {
  .floor-plan-grid { min-width: 720px; }
  .floor-plan-row { grid-template-columns: 180px 25px 180px 210px; }
}


/* The student page now has only one item inside .content-grid.
   Make that single seat-map card span the entire grid instead of
   occupying only the first column of the old two-column layout. */
.content-grid {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

/* Student layout: full-width seat plan with the complete action panel below it */
.student-actions-row {
  display: block;
  margin-top: 20px;
}
.student-actions-row .booking-card {
  width: 100%;
  position: static;
  min-height: 0;
}
.student-actions-row .booking-card #message {
  margin-top: 0;
  padding-top: 0;
}

/* Admin dashboard no longer contains a seat map; analytics spans the full row. */
.admin-grid {
  grid-template-columns: minmax(0, 1fr);
}


/* Admin slot-wise occupancy panel */
.slot-occupancy-panel { margin: 18px 0 22px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }
.slot-occupancy-panel label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.slot-occupancy-panel select { width: 100%; max-width: 340px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.slot-occupancy-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.slot-occupancy-results > div { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 9px; background: #fff; border: 1px solid var(--border); }
.slot-occupancy-results span { color: var(--muted); font-size: 12px; }
.slot-occupancy-results strong { font-size: 22px; }
.slot-help { margin: 12px 0 0; font-size: 12px; }
@media (max-width: 600px) { .slot-occupancy-results { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
