/* ════════════════════════════════════════════════════════════════
   QuietSpace — two distinct skins
   Student view  → "Studio Pulse"  (paper / magazine)
   Staff view    → "Control Deck"  (dark dashboard)
   ════════════════════════════════════════════════════════════════ */

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

:root {
  /* shared tokens */
  --green:       #0f6b34;
  --green-soft:  #d8efe1;
  --red:         #9a1d1d;
  --red-soft:    #f5dada;
  --amber:       #a8590e;
  --amber-soft:  #fbe5c7;
  --radius:      10px;
}

/* ═══════════════════════════════════════════════════
   STUDENT VIEW — "Studio Pulse"
   ═══════════════════════════════════════════════════ */

body {
  font-family: 'League Spartan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4eee0;
  color: #1a1715;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(26,23,21,0.06) 1px, transparent 0);
  background-size: 18px 18px;
  font-feature-settings: 'kern' 1;
}

.brand-text h1,
.floor-section-title,
.admin-main-title {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-optical-sizing: auto;
}

/* ── Header ── */
header {
  background: #1a1715;
  color: #f4eee0;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 4px solid #1a1715;
}

.header-left  { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 14px; }

.header-logo {
  height: 46px;
  width: auto;
  display: block;
  filter: invert(1) brightness(1.1);
}

.brand-text h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand-text .tag {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c9bd9c;
  margin-top: 4px;
}

.hero-clock {
  display: flex;
  align-items: center;
  gap: 18px;
}
.clock-time {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f4eee0;
  line-height: 1;
}
.clock-date {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9bd9c;
  margin-top: 4px;
}
.staff-link {
  background: #f4eee0;
  color: #1a1715;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.staff-link:hover { background: #fff; }

.refresh-label {
  font-size: 0.7rem;
  color: #c9bd9c;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Stat strip (3 big counters) ── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 22px 32px 0;
}
.stat {
  padding: 22px 26px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  border: 3px solid #1a1715;
  border-radius: 22px;
}
.stat-num {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.stat-open    { background: var(--green-soft); color: var(--green); }
.stat-empty   { background: var(--red-soft);   color: var(--red); }
.stat-meeting { background: var(--amber-soft); color: var(--amber); }

/* ── Main layout ── */
main { padding: 28px 32px 60px; }

/* ── Search bar ── */
.search-bar-wrap { padding: 0; }
.search-bar-wrap input {
  width: 100%;
  padding: 14px 24px;
  border: 3px solid #1a1715;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  background: #fffdf8;
  font-family: inherit;
  transition: box-shadow 0.12s, transform 0.12s;
}
.search-bar-wrap input:focus {
  background: #fff;
  box-shadow: 5px 5px 0 #1a1715;
  transform: translate(-2px, -2px);
}

/* ── Filter row ── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 22px 0 0;
  align-items: center;
}
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-label {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  white-space: nowrap;
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
  border: 3px solid #1a1715;
  background: #fffdf8;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: #1a1715;
  font-family: inherit;
  transition: background 0.12s;
}
.filter-btn:hover  { background: #f4eee0; }
.filter-btn.active { background: #1a1715; color: #f4eee0; }

/* ── Floor sections ── */
.floor-sections { display: flex; flex-direction: column; gap: 36px; margin-top: 28px; }
.floor-section-header {
  display: flex; align-items: center; gap: 18px; margin-bottom: 16px;
}
.floor-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 22px;
  color: #1a1715;
  background: #fffdf8;
  border: 3px solid #1a1715;
  border-radius: 999px;
}
.floor-section-title:hover { background: #1a1715; color: #f4eee0; }
.floor-section-divider { flex: 1; height: 3px; background: #1a1715; border-radius: 999px; }

/* ── Room grid ── */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.loading {
  color: #1a1715;
  font-size: 0.9rem;
  padding: 22px 0;
  font-style: italic;
  opacity: 0.6;
}

/* ── Room cards (student view) ── */
.room-card {
  background: #fffdf8;
  border: 3px solid #1a1715;
  border-radius: 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s;
  cursor: default;
  overflow: hidden;
}
.room-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #1a1715;
}

.card-stripe {
  height: 14px;
  width: 100%;
}
.card-stripe.open    { background: var(--green); }
.card-stripe.closed  { background: var(--red); }
.card-stripe.meeting { background: var(--amber); }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.card-top-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: #1a1715;
}
.card-floor {
  background: #1a1715;
  color: #f4eee0;
  padding: 3px 10px;
  border-radius: 999px;
}
.room-name-tag {
  background: #f4eee0;
  border: 2px solid #1a1715;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 999px;
}

.room-number {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  text-align: center;
  color: #1a1715;
  padding: 4px 0;
}

.status-badge {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 8px 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 2px solid #1a1715;
  border-radius: 999px;
}
.status-badge.open    { background: var(--green); color: #fff; border-color: var(--green); }
.status-badge.closed  { background: var(--red);   color: #fff; border-color: var(--red); }
.status-badge.meeting { background: var(--amber); color: #fff; border-color: var(--amber); }

.card-details {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 4px;
  font-size: 0.78rem;
}
.card-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.detail-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #6b6256;
}
.detail-value { font-weight: 600; text-align: right; font-style: italic; }

/* ═══════════════════════════════════════════════════
   STAFF VIEW — "Control Deck"
   ═══════════════════════════════════════════════════ */

body.admin-body {
  background: #0d0e12;
  color: #e7e9ee;
  background-image: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.admin-body header {
  background: #0d0e12;
  color: #e7e9ee;
  border-bottom: 1px solid #262932;
  padding: 16px 32px;
}
body.admin-body .header-logo { filter: invert(1) brightness(1.1); }
body.admin-body .tagline {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #797f8a;
  margin-left: 6px;
}

.teacher-badge {
  font-size: 0.78rem;
  color: #e7e9ee;
  background: #15171c;
  border: 1px solid #262932;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
}
.teacher-badge .role-pill {
  background: #f59e0b;
  color: #0d0e12;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.admin-body main { padding: 0; }

/* ── Login screen — kept simple per request ── */
.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 75vh;
  padding: 40px 20px;
}
.login-card {
  background: #15171c;
  border: 1px solid #262932;
  border-radius: 14px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e7e9ee;
}
.login-card p {
  font-size: 0.85rem;
  color: #797f8a;
  line-height: 1.5;
}
#login-form { display: flex; flex-direction: column; gap: 10px; }
input[type="password"], input[type="text"], input[type="time"] {
  padding: 11px 14px;
  border: 1px solid #262932;
  border-radius: 8px;
  font-size: 0.92rem;
  outline: none;
  background: #0d0e12;
  color: #e7e9ee;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus { border-color: #3b82f6; }
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.05s;
  font-family: inherit;
}
.btn:hover  { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-ghost   {
  background: transparent;
  color: #e7e9ee;
  border: 1px solid #262932;
}
.btn-ghost:hover { background: #15171c; }
.back-link {
  font-size: 0.82rem;
  color: #797f8a;
  text-decoration: none;
  text-align: center;
  padding-top: 4px;
}
.back-link:hover { color: #e7e9ee; }

/* ── Admin panel: sidebar layout ── */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 76px);
}
.admin-sidebar {
  background: #15171c;
  border-right: 1px solid #262932;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  overflow-y: auto;
}
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-section-title {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #797f8a;
  font-weight: 800;
}
.sidebar-list { display: flex; flex-direction: column; gap: 4px; }
.sidebar-btn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #c5c8cf;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
  font-family: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-btn:hover  { background: #1c1f25; color: #e7e9ee; }
.sidebar-btn.active {
  background: #1c1f25;
  border-color: #3b82f6;
  color: #fff;
}
.sidebar-btn .count {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.78rem;
  color: #797f8a;
  background: #0d0e12;
  padding: 1px 7px;
  border-radius: 999px;
}

.admin-main { padding: 28px 32px 60px; }
.admin-main-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-main-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.admin-main-subtitle {
  color: #797f8a;
  font-size: 0.85rem;
}

/* ── Admin room rows (dense list) ── */
.admin-room-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-row {
  background: #15171c;
  border: 1px solid #262932;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 4px 90px 1fr 1fr 220px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 14px 0;
  position: relative;
  transition: border-color 0.15s;
}
.admin-row:hover { border-color: #3a3f4a; }
.admin-row .row-stripe {
  width: 4px;
  height: 100%;
  border-radius: 12px 0 0 12px;
}
.admin-row.open    .row-stripe { background: #22c55e; }
.admin-row.closed  .row-stripe { background: #ef4444; }
.admin-row.meeting .row-stripe { background: #f59e0b; }

.row-room-num {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}
.row-floor {
  display: block;
  font-family: -apple-system, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #797f8a;
  font-weight: 700;
  margin-top: 4px;
}

.row-status-block { display: flex; flex-direction: column; gap: 4px; }
.row-status-pill {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.row-status-pill.open    { background: rgba(34,197,94,0.15);  color: #4ade80; }
.row-status-pill.closed  { background: rgba(239,68,68,0.15);  color: #f87171; }
.row-status-pill.meeting { background: rgba(245,158,11,0.15); color: #fbbf24; }
.row-time { font-size: 0.78rem; color: #c5c8cf; font-weight: 500; }
.row-time.muted { color: #797f8a; font-style: italic; }

.row-supervisor {
  font-size: 0.86rem;
  color: #e7e9ee;
}
.row-supervisor .you-tag {
  background: rgba(59,130,246,0.18);
  color: #60a5fa;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 6px;
}
.row-supervisor.empty { color: #797f8a; font-style: italic; }

.row-action {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 10px;
}
.row-btn {
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.row-btn.open-btn  { background: #22c55e; color: #07140c; }
.row-btn.close-btn { background: #1c1f25; color: #e7e9ee; border: 1px solid #2f343f; }
.row-btn.open-btn:hover  { background: #4ade80; }
.row-btn.close-btn:hover { border-color: #ef4444; color: #fca5a5; }
.row-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row-locked {
  font-size: 0.74rem;
  color: #797f8a;
  font-style: italic;
}

/* ── Inline open form (expanded row) ── */
.row-form {
  grid-column: 1 / -1;
  background: #0d0e12;
  border-top: 1px solid #262932;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: end;
  border-radius: 0 0 12px 12px;
  margin: 14px -16px -14px 0;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #797f8a;
  font-weight: 700;
}
.form-field input[type="time"] {
  width: 130px;
  padding: 8px 10px;
}
.form-meeting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.form-meeting-toggle input { accent-color: #f59e0b; width: 16px; height: 16px; }
.form-meeting-toggle .toggle-label {
  font-size: 0.82rem;
  color: #fbbf24;
  font-weight: 600;
}
.form-meeting-toggle .toggle-hint {
  font-size: 0.7rem;
  color: #a98735;
  display: block;
  margin-top: 2px;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.btn-confirm {
  background: #22c55e;
  color: #07140c;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-confirm:hover { background: #4ade80; }
.btn-cancel {
  background: transparent;
  color: #797f8a;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid #262932;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
}
.btn-cancel:hover { border-color: #3a3f4a; color: #c5c8cf; }

/* ── Misc ── */
.hidden    { display: none !important; }
.error-msg {
  color: #f87171;
  font-size: 0.82rem;
  background: rgba(239,68,68,0.1);
  padding: 8px 12px;
  border-radius: 6px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #262932;
  }
  .admin-row {
    grid-template-columns: 4px 1fr;
    gap: 8px;
  }
  .row-status-block, .row-supervisor, .row-action {
    grid-column: 2 / -1;
    padding-left: 4px;
  }
  .stat-strip { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  header { padding: 14px 18px; }
  main { padding: 20px 18px 40px; }
  .stat-num { font-size: 2.2rem; }
  .room-number { font-size: 3.4rem; }
}
