/* style.css - CSPC look: blue, white and yellow, with a light and a dark theme.
   Every colour comes from a variable. To change colours, edit ONLY the two blocks below:
   :root (light theme) and [data-theme="dark"] (dark theme). */
:root {
  color-scheme: light;
  --brand: #0b3b8c;          /* CSPC blue (buttons, active items)          */
  --brand-dark: #082a66;     /* darker blue (button hover)                 */
  --accent: #f6b800;         /* CSPC yellow (highlights)                   */
  --topbar: #0b3b8c;         /* top bar                                    */
  --bg: #f1f5fb; --card: #ffffff; --text: #1f2937; --muted: #5b6676;
  --line: #dbe3f0; --line-strong: #b7c9ea;
  --link: #0b3b8c; --heading: #0b3b8c; --heading-strong: #082a66;
  --surface-2: #e8effc;      /* light blue panels (table heads, thumbnails) */
  --hover: #f4f8ff;
  --input-bg: #ffffff; --input-border: #c3cfe2; --disabled-bg: #eef2f8;
  --green: #16803c; --red: #c9372c; --orange: #c2570a;           /* meaning colours (backgrounds with white text) */
  --red-text: #c9372c;
  --ok-bg: #e3f4ea; --ok-text: #146c35;
  --bad-bg: #fde8e6; --bad-text: #b42e24;
  --warn-bg: #fff3cd; --warn-text: #8a5a00;
  --flash-ok-bg: #dcfce7; --flash-ok-text: #14532d;
  --flash-bad-bg: #fee2e2; --flash-bad-text: #7f1d1d;
  --event-bg: #cbd5e1; --event-text: #1f2937;
  --ev-pending-bg: #fde68a; --ev-pending-text: #3b2a00;
  --ev-out-bg: #bfdbfe; --ev-out-text: #0f2a5c;
  --day-muted-bg: #f3f5f9; --day-muted-text: #5f6b7e;
  --danger-hover: #fef2f2;
  --auth-top: #e8effc; --auth-bottom: #ffffff;
  --shadow: rgba(11, 59, 140, .10);
  --radius: 14px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --brand: #2f65d6; --brand-dark: #2552b5;
  --accent: #f6b800;
  --topbar: #0a2557;
  --bg: #0e1626; --card: #17233a; --text: #e6ebf5; --muted: #9aa8c1;
  --line: #2a3a57; --line-strong: #38507a;
  --link: #8db5ff; --heading: #a9c7ff; --heading-strong: #c9dbff;
  --surface-2: #1f2f4d;
  --hover: #1c2b46;
  --input-bg: #101b30; --input-border: #3a4f78; --disabled-bg: #1a2640;
  --green: #16803c; --red: #c9372c; --orange: #c2570a;
  --red-text: #ff8f86;
  --ok-bg: #12301f; --ok-text: #6ee09a;
  --bad-bg: #3a1c1e; --bad-text: #ff8f86;
  --warn-bg: #3a3010; --warn-text: #f3c85a;
  --flash-ok-bg: #123524; --flash-ok-text: #9be7b8;
  --flash-bad-bg: #3d1b1e; --flash-bad-text: #ffb3ad;
  --event-bg: #2c3e5f; --event-text: #e6ebf5;
  --ev-pending-bg: #5c4c14; --ev-pending-text: #fde68a;
  --ev-out-bg: #1e3a6b; --ev-out-text: #cfe0ff;
  --day-muted-bg: #121c30; --day-muted-text: #7b88a3;
  --danger-hover: #3a1c1e;
  --auth-top: #14264a; --auth-bottom: #0e1626;
  --shadow: rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--link); text-decoration: none; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 9; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }

/* ----- top bar ----- */
.topbar { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; background: var(--topbar); color: #fff;
          border-bottom: 4px solid var(--accent); padding: 8px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.brand-text { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-text span { font-weight: 400; opacity: .85; }
.page-title { font-size: 16px; font-weight: 500; margin: 0; color: var(--accent); }
.topbar-nav { display: flex; gap: 4px; flex: 1; }
.topbar-nav a { color: #fff; padding: 7px 12px; border-radius: 8px; opacity: .9; }
.topbar-nav a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.topbar-nav a.active { background: var(--accent); color: #1f2937; font-weight: 600; opacity: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { background: rgba(255,255,255,.14); padding: 5px 12px; border-radius: 8px; font-weight: 600; }
.user-chip small { color: var(--accent); font-weight: 700; margin-left: 4px; }
.bell { position: relative; font-size: 18px; }
.badge { position: absolute; top: -6px; right: -10px; background: #e11d48; color: #fff; border-radius: 99px;
         font-size: 10px; padding: 1px 5px; }
.topbar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.14); }

/* light / dark button */
.theme-toggle { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 5px 12px;
                background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.theme-toggle:hover { background: rgba(255,255,255,.26); }
.theme-toggle .tt-light { display: none; }
[data-theme="dark"] .theme-toggle .tt-light { display: inline; }
[data-theme="dark"] .theme-toggle .tt-dark { display: none; }
.theme-floating { position: fixed; top: 14px; right: 14px; z-index: 30; background: var(--card); color: var(--text);
                  border-color: var(--line-strong); box-shadow: 0 2px 8px var(--shadow); }
.theme-floating:hover { background: var(--hover); }

.container { max-width: 1200px; margin: 20px auto; padding: 0 16px; }
.auth-wrap { max-width: 440px; margin: 6vh auto; padding: 0 16px; }

/* ----- buttons & forms ----- */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 9px 18px; font: inherit;
       font-weight: 600; cursor: pointer; background: var(--card); color: var(--text); }
.btn-small { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--link); color: var(--link); background: var(--card); } .btn-outline:hover { background: var(--surface-2); }
.btn-ghost { border-color: var(--line); } .btn-danger { background: var(--card); border-color: var(--red-text); color: var(--red-text); }
.btn-danger:hover { background: var(--danger-hover); }
label { display: block; font-weight: 600; font-size: 12.5px; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--link); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:disabled { background: var(--disabled-bg); color: var(--muted); }
input[type=file] { padding: 5px; font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 14px; }
.check input { width: auto; }
#booking-form .btn { margin-top: 16px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0;
            background: transparent; border-radius: 6px; font-size: 18px; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-success { background: var(--flash-ok-bg); color: var(--flash-ok-text); } .flash-error { background: var(--flash-bad-bg); color: var(--flash-bad-text); }

/* ----- cards (login box, booking form, ...) ----- */
.card, .auth-card { background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.auth-card { border-top: 6px solid var(--accent); padding: 26px 28px; box-shadow: 0 10px 30px var(--shadow); }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; color: var(--heading); text-align: center; }
.auth-card > .muted:first-of-type { text-align: center; }
.auth-logo { display: block; width: 96px; height: 96px; object-fit: contain; margin: 0 auto 10px; }
[data-theme="dark"] .auth-logo { background: #fff; border-radius: 50%; padding: 6px; }
.card-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--heading); }
body:has(.auth-card) { background: linear-gradient(180deg, var(--auth-top) 0%, var(--auth-bottom) 70%); min-height: 100vh; }

/* ----- four summary cards ----- */
/* (class names kept from the first version: stat-green is now blue, stat-red is red, stat-amber is yellow/orange) */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { position: relative; color: #fff; border-radius: 10px; padding: 14px 18px; min-height: 84px; display: block; overflow: hidden; }
.stat:hover { filter: brightness(.95); color: #fff; }
.stat.is-active { outline: 3px solid var(--text); outline-offset: 2px; }
.stat-green { background: var(--brand); }
.stat-red { background: var(--red); }
.stat-amber { background: var(--accent); color: #1f2937; } .stat-amber:hover { color: #1f2937; }
.stat-amber + .stat-amber { background: var(--orange); color: #fff; } .stat-amber + .stat-amber:hover { color: #fff; }
.stat-label { display: block; font-size: 13px; } .stat-num { display: block; font-size: 28px; font-weight: 700; }
.stat-icon { position: absolute; right: 14px; bottom: 8px; font-size: 38px; opacity: .35; }

/* ----- filters ----- */
.filters-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 150px; } .filters input[type=search] { width: 260px; }
.filter-by { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--muted); }
.toolbar { display: flex; gap: 6px; }

/* ----- tables ----- */
.table-wrap { background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; padding: 14px 16px; border-bottom: 2px solid var(--accent); white-space: nowrap;
            background: var(--surface-2); color: var(--heading-strong); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td input, .table td select { min-width: 110px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.link { font-weight: 500; }
.overdue { color: var(--red-text); font-weight: 600; }
.avatar { display: inline-flex; width: 20px; height: 20px; border-radius: 4px; background: var(--brand); color: #fff; font-size: 11px;
          align-items: center; justify-content: center; margin-right: 4px; }
.pill { display: inline-block; padding: 4px 14px; border-radius: 99px; color: #3b2a00; font-weight: 600; font-size: 12.5px; background: var(--accent); }
.pill-approved { background: var(--green); color: #fff; } .pill-declined { background: var(--red); color: #fff; }
.pill-checked_out { background: var(--brand); color: #fff; } .pill-returned { background: #475569; color: #fff; }
.pill-cancelled { background: #6b7280; color: #fff; }
.actions { display: flex; align-items: center; gap: 8px; } .actions form { margin: 0; }

/* equipment photos in the admin table */
.photo-cell { min-width: 190px; }
.thumb { display: block; width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 6px; }
.photo-form { display: flex; flex-direction: column; gap: 4px; margin: 0 0 4px; } .photo-cell form { margin: 0 0 4px; }

/* kebab dropdown */
.menu { position: relative; }
.kebab { border: 0; background: transparent; color: var(--text); font-size: 20px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.kebab:hover { background: var(--surface-2); }
.menu-list { position: absolute; right: 0; top: 100%; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
             box-shadow: 0 8px 24px var(--shadow); min-width: 140px; padding: 4px; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 8px 12px; font: inherit; cursor: pointer; border-radius: 6px; }
.menu-item:hover { background: var(--surface-2); } .menu-item.danger { color: var(--red-text); }

/* ----- booking page ----- */
.booking-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 4px; } .cal-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--heading); }
.seg { display: flex; border: 1px solid var(--input-border); border-radius: 6px; overflow: hidden; }
.seg a { padding: 5px 14px; color: var(--text); font-size: 13px; } .seg a.on { background: var(--brand); color: #fff; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { text-align: center; font-weight: 600; font-size: 12px; padding: 6px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--heading-strong); }
.cal-day { min-height: 96px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.cal-day.tall { min-height: 320px; } .cal-day:hover { background: var(--hover); }
.cal-day.muted { background: var(--day-muted-bg); color: var(--day-muted-text); }
.cal-num { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; font-size: 12px; border-radius: 99px; }
.cal-day.today .cal-num { background: var(--accent); color: #1f2937; font-weight: 700; }
.cal-event { font-size: 11px; background: var(--event-bg); color: var(--event-text); border-radius: 3px; padding: 1px 5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.mine { background: var(--brand); color: #fff; }
.cal-event.ev-in_approval:not(.mine) { background: var(--ev-pending-bg); color: var(--ev-pending-text); }
.cal-event.ev-checked_out:not(.mine) { background: var(--ev-out-bg); color: var(--ev-out-text); }
.cal-more { font-size: 11px; color: var(--muted); margin-top: 2px; }
.inline-form { display: grid; grid-template-columns: repeat(6, 1fr) auto; gap: 12px; align-items: end; }

/* ----- student equipment page ----- */
.intro { margin: 0 0 14px; }
.college-banner { color: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; border-bottom: 4px solid var(--accent); }
.college-banner h2 { margin: 0; font-size: 22px; } .college-banner p { margin: 4px 0 0; }
.college-CCS { background: #f3db03; } .college-CEA { background: #585656; } .college-CHS { background: #7f04b8; }
.college-CAS { background: #d408b9; } .college-CTHBM { background: #0ba012; } .college-CTDE { background: #0c30cf; }
.college-tag { display: inline-block; color: #fff; font-weight: 700; font-size: 11.5px; padding: 2px 9px; border-radius: 6px; }
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.equip-card { background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
              box-shadow: 0 2px 8px var(--shadow); }
.equip-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.equip-body { padding: 12px 14px 14px; }
.equip-body h3 { margin: 0 0 2px; font-size: 14.5px; font-weight: 600; color: var(--heading-strong); }
.equip-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* stock numbers: Total / Maintenance / Borrowed / Available */
.stock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 0; }
.stock > div { background: var(--surface-2); border-radius: 8px; padding: 6px 4px; text-align: center; }
.stock-num { display: block; font-size: 18px; font-weight: 700; color: var(--heading-strong); }
.stock-label { display: block; font-size: 11px; color: var(--muted); }
.stock-ok { background: var(--ok-bg) !important; } .stock-ok .stock-num { color: var(--ok-text); }
.stock-zero { background: var(--bad-bg) !important; } .stock-zero .stock-num { color: var(--bad-text); }
.stock-maint { background: var(--warn-bg) !important; } .stock-maint .stock-num { color: var(--warn-text); }
.maint-note { margin: 8px 0 0; color: var(--warn-text); }
.qty-input { min-width: 70px !important; width: 80px; }

/* ----- admin Assets page: one tab per college ----- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { display: flex; flex-direction: column; min-width: 130px; padding: 8px 14px; background: var(--card); color: var(--text);
       border: 1.5px solid var(--line-strong); border-radius: 10px; }
.tab strong { font-size: 15px; color: var(--heading-strong); } .tab span { font-size: 11.5px; color: var(--muted); }
.tab:hover { background: var(--surface-2); }
.tab.on { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 -4px 0 var(--accent); }
.tab.on strong, .tab.on span { color: #fff; }
.add-box { background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.add-box summary { list-style: none; cursor: pointer; display: inline-block; }
.add-box summary::-webkit-details-marker { display: none; }
.add-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
.add-note { grid-column: 1 / -1; margin: 0; }

/* notes column on the Reservations table */
.notes-cell { min-width: 160px; max-width: 280px; white-space: normal; word-break: break-word; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); } .booking-grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr 1fr; } .cal-day { min-height: 64px; }
}