/* ===================================================
   Club Events – College of Idaho  |  style.css
   =================================================== */

/* ---- Variables ---- */
:root {
  /* Mapped to design tokens */
  --coi-blue:    #533860; /* primary - updated to user request */
  --coi-gold:    #FFE432; /* accent */
  --coi-light:   #f8f7f9; /* subtle page background */
  --sidebar-text:#f4f6fb; /* keep sidebar text light for contrast */
  --nav-hover:   rgba(131,96,136,.12);
  --nav-active:  var(--coi-gold);
  --event-radius:6px;
  --hour-h:      60px;     /* pixels per hour on the time grid */
  --day-header-h: 64px; /* per-day header visual height */

  /* surface / semantic tokens */
  --color-surface: #ffffff; /* page / card surface */
  --color-border: #e0e3ec;  /* primary border */
  --color-border-2: #ebedf5; /* subtle border */
  --color-border-3: #f0f2f8; /* very subtle */
  --color-muted: #9ba3b8;   /* muted text */
  --color-muted-2: #6b738e; /* secondary muted */
  --color-strong: #1a1a2e;  /* strong headings / black */
  --color-danger: #e53935;  /* alerts / now indicator */
  --color-scroll: #c0c4d0;  /* scrollbar thumb */
  --color-primary-dark: #382640; /* hover / accent dark */
  --color-background: #533860; /* main page background requested */
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-text, 'Source Sans 3'), system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  overflow-x: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-scroll); border-radius: 3px; }

/* ===================================================
   LAYOUT
   =================================================== */
#app {
  display: flex;
  min-height: 100vh;
}

/* Ensure Bootstrap's .text-primary maps to the project's primary color */
.text-primary{ color: var(--coi-blue) !important; }
.bg-primary { background: var(--coi-blue) !important; }

/* ---- Sidebar (desktop) ---- */
#sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s;
  color: #222;
  height: 100%;
}

/* Sidebar nav container */
#sidebar nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* right align buttons */
  justify-content: center; /* center vertically */
  height: 100%;
  padding-right: 12px;
}

.nav-btn {
  /* square buttons stacked vertically */
  width: 72px;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  margin: 12px 0;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  color: #222;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  text-align: center;
}
.nav-btn .icon-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 6px;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.nav-btn .nav-label { display: block; font-size: .68rem; margin-top: 4px; }
.nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.nav-btn.active {
  background: var(--coi-blue);
  color: var(--color-surface);
}
.nav-btn.active .icon-wrap {
  color: var(--color-surface);
}
.nav-btn.active .nav-label {
  color: var(--color-surface);
}

/* Bootstrap col layout inside content-wrapper */
#main-row {
  flex: 1;
}

/* ---- Page ---- */
.page { display: none; }
.page.active { display: block; }

/* ---- Bottom nav (mobile / tablet) ---- */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--coi-blue);
  z-index: 200;
  border-top: 1px solid rgba(255,255,255,.08);
}
#bottom-nav .bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 6px;
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-size: .65rem;
  cursor: pointer;
  gap: 3px;
  transition: color .2s;
}
#bottom-nav .bnav-btn i { font-size: 1.25rem; }
#bottom-nav .bnav-btn.active { color: var(--coi-gold); }


#content-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 95vh;
  background: var(--color-surface);
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 24px rgba(16,24,50,.04);
  position: relative;
}

/* Make inner pages and cards fit the card width */
#content-wrapper .page {
  width: 100%;
}

/* Make calendar grid fill remaining vertical space so header stays visible */
#cal-grid {
  flex: 1 1 auto;
  min-height: 0;
}


/* ===================================================
   HOME – CALENDAR
   =================================================== */
.calendar-header {
  /* sticky page-level calendar header that sits at the top of #content-wrapper */
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 0; /* vertical centering handled by fixed height */
  flex-wrap: wrap;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-2);
  z-index: 220; /* above day headers and grid content */
}
.calendar-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 160px;
  color: var(--coi-blue);
}
.cal-nav-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--color-border-2);
  background: var(--color-surface);
  font-size: .82rem;
  cursor: pointer;
  color: var(--color-secondary);
  transition: background .15s;
}
.cal-nav-btn:hover { background: var(--coi-light); }
.cal-nav-btn.active {
  background: var(--coi-blue);
  color: var(--color-surface);
  border-color: var(--coi-blue);
}
.view-toggle { display: inline-flex; gap: 8px; align-items: center; }

/* Make the department select and view-toggle-buttons sit inline */
.view-toggle #dept-select { display: inline-flex; vertical-align: middle; }
.view-toggle .view-toggle-buttons { display: inline-flex; gap: 6px; vertical-align: middle; }

/* Hide the week/day toggle buttons on very narrow phones, but keep the department dropdown visible */
@media (max-width: 480px) {
  .view-toggle .view-toggle-buttons { display: none; }
  /* ensure select still fits on small screens */
  .view-toggle #dept-select { min-width: 120px; }
}

/* Time grid */
.calendar-grid-wrap {
  /* do not create a separate vertical scroll container here; let #content-wrapper scroll */
  overflow: visible;
  border-radius: 10px;
  position: relative;
}
.calendar-grid {
  display: flex;
  min-width: 0;
  /* ensure children can overflow and sticky headers can position relative to the wrap */
  overflow: visible;
}

/* Horizontal day headers bar (renders inside calendar header) */
.days-headers {
  display: flex;
  width: calc(100% + 32px); 
  gap: 0;
  padding-left: 52px;
  margin-left: -16px;
  margin-right: -16px;
  border-top: 1px solid var(--color-border-2);
}
.days-headers .day-header {
  flex: 1 1 0; /* allow header cells to shrink and distribute evenly */
  height: var(--day-header-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-right: 1px solid var(--color-border-2);
  background: var(--color-surface);
}
.days-headers .day-header:last-child { border-right: none; }

/* reserve top space inside day-body for the moved header */
.day-body { padding-top: var(--day-header-h); min-height: 300px; }

/* Time label column */
.time-col {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border-2);
  position: relative;
}
.time-label {
  height: var(--hour-h);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px 6px 0 0;
  font-size: .68rem;
  color: var(--color-muted);
  line-height: 1;
}

/* Day columns */
.days-wrap {
  display: flex;
  flex: 1;
  overflow-x: hidden; /* prevent horizontal scrolling; allow columns to shrink */
}
.day-col {
  flex: 1 1 0; /* share space and shrink to fit */
  border-right: 1px solid var(--color-border-2);
  position: relative;
  overflow: visible;
}
.day-col:last-child { border-right: none; }

.day-header {
  /* per-day header that becomes sticky beneath the main calendar header */
  position: sticky;
  top: var(--calendar-header-h);
  background: var(--color-surface);
  z-index: 200; /* sit above events but beneath the calendar header */
  height: var(--day-header-h); /* consistent header height */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px; /* minimal horizontal padding */
  text-align: center;
}
.day-header .day-name {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: .04em;
  margin: 0;
}
.day-header .day-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-strong);
  line-height: 1.2;
  margin: 2px 0 0;
}
.day-header.today .day-num {
  background: var(--coi-blue);
  color: var(--color-surface);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.day-body {
  position: relative;
  height: calc(var(--hour-h) * 24);
}

/* Hour lines */
.hour-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid var(--color-border-3);
}
.hour-line.half { border-top-style: dashed; opacity: .6; }

/* Current time indicator */
.now-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px solid var(--color-danger);
  z-index: 5;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -5px;
  width: 9px; height: 9px;
  background: var(--color-danger);
  border-radius: 50%;
}


/* Event blocks */
.cal-event {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: var(--event-radius);
  padding: 4px 6px;
  font-size: .72rem;
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  transition: filter .15s, transform .15s;
  z-index: 4;
}
.cal-event:hover { filter: brightness(1.08); transform: scale(1.01); }
.cal-event .ev-title { font-weight: 600; }
.cal-event .ev-club  { opacity: .85; font-size: .66rem; }
.cal-event .ev-location { opacity: .9; font-size: .68rem; margin-top: 2px; }

/* Inline carousel nav (for overlapping clusters) */
.cal-event .ev-nav {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 6px;
}
.cal-event .ev-nav button {
  background: rgba(255,255,255,.18);
  border: 0;
  color: #fff;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.cal-event .ev-nav button:focus { outline: 2px solid rgba(255,255,255,.35); }
.cal-event .ev-nav .ev-nav-counter {
  font-size: 11px;
  color: rgba(255,255,255,.95);
  font-weight: 700;
}

/* '+N more' overlay shown when we collapse many events into one slot */
.cal-event .more-overlay {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.18);
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .cal-event .ev-nav button { width: 30px; height: 30px; font-size: 14px; }
  .cal-event .ev-nav { top: 8px; right: 8px; }
}

/* ===================================================
   CLUBS PAGE
   =================================================== */
.clubs-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 16px;
}
.clubs-filter input {
  border-radius: 8px;
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  font-size: .88rem;
  width: 280px;
  outline: none;
  transition: border-color .15s;
}
.clubs-filter input:focus { border-color: var(--coi-blue); }
.clubs-filter .result-count {
  font-size: .82rem;
  color: var(--color-muted);
}

.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 0 16px;
}

.club-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  text-align: center;
}
.club-tile:hover {
  box-shadow: 0 1px 2px rgba(0,48,135,.12);
  transform: translateY(-1px);
}
.club-tile img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--coi-light);
  margin-bottom: 10px;
}
.club-tile .club-logo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--coi-blue), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-strong);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.club-tile .club-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--color-strong);
  line-height: 1.3;
}

/* Logged-in club banner */
.club-logged-in-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--coi-light);
  border: 1px solid var(--color-border-2);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.club-logged-in-banner .club-badge {
  background: var(--coi-blue);
  color: var(--color-surface);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: .8rem;
  font-weight: 600;
}

/* ===================================================
   EVENT CREATION FORM
   =================================================== */
.event-form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  margin-top: 16px;
}
.event-form-card h5 {
  font-weight: 700;
  color: var(--coi-blue);
  margin-bottom: 16px;
}
.form-label { font-size: .85rem; font-weight: 600; color: var(--color-secondary); }
.form-control:focus, .form-select:focus {
  border-color: var(--coi-blue);
  box-shadow: 0 0 0 .2rem rgba(0,48,135,.15);
}

/* ===================================================
   SENATE PAGE
   =================================================== */
.senate-login-card {
  max-width: 570px;
  margin: 200px auto;
  background: var(--color-surface);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0,48,135,.1);
  text-align: center;
}
.senate-login-card .icon-lock {
  font-size: 2.8rem;
  color: var(--coi-blue);
  margin-bottom: 12px;
}
.senate-login-card h3 {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-strong);
}
.senate-login-card p {
  color: var(--color-muted-2);
  font-size: .88rem;
  margin-bottom: 20px;
}

.senate-panel h4 {
  font-weight: 700;
  color: var(--coi-blue);
  margin-bottom: 4px;
}
.senate-panel .section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
}
#senate-actions{
  margin-left: 0px;
  margin-right: 0px;
}

/* ===================================================
   ABOUT PAGE
   =================================================== */
.about-hero {
  background: var(--coi-blue);
  color: var(--color-surface);
  border-radius: 16px;
  padding: 36px 32px;
  margin-bottom: 24px;
}
.about-hero h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.about-hero p { opacity: .88; font-size: 1rem; margin: 0; }

.about-section { margin-bottom: 28px; }
.about-section h4 {
  font-weight: 700;
  color: var(--coi-blue);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.about-section p { color: var(--color-secondary); line-height: 1.7; }
.about-section ul { color: var(--color-secondary); line-height: 2; padding-left: 1.2rem; }

.about-builder-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.about-builder-card .avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #5fcf80;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-surface); font-size: 1.5rem; font-weight: 700; flex-shrink: 0;
}
.about-builder-card a { color: var(--coi-strong);}

/* ===================================================
   MODALS
   =================================================== */
.event-detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}
.event-meta { font-size: .85rem; color: var(--color-muted-2); }
.event-meta strong { color: var(--color-strong); }

/* ===================================================
   UTILITY / MISC
   =================================================== */
.page-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  background: var(--color-surface);
}
.page-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--coi-blue);
  margin: 0;
}
.page-header p { color: var(--color-muted-2); font-size: .88rem; margin: 4px 0 0; }

.btn-coi-primary {
  background: var(--coi-blue);
  color: var(--color-surface);
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-coi-primary:hover { background: var(--color-primary-dark); }

.btn-coi-secondary {
  background: var(--coi-gold);
  color: var(--color-strong);
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: filter .15s;
}
.btn-coi-secondary:hover { filter: brightness(1.08); }

.spinner-sm {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--color-surface);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert-inline {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-top: 10px;
}

/* Events list in senate / manage panel */
.event-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-3);
}
.event-list-item:last-child { border-bottom: none; }
.event-list-item .ev-info { flex: 1; }
.event-list-item .ev-title-txt { font-weight: 600; font-size: .9rem; color: var(--color-strong); }
.event-list-item .ev-meta-txt { font-size: .78rem; color: var(--color-muted); }

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 991px) {
  #sidebar { display: none; }
  #content-wrapper { height: 87vh;}
  #bottom-nav { display: flex; }

  .clubs-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  /* Hide the calendar title on smaller screens to save horizontal space */
  .calendar-header h2 { font-size: .88rem; }
}

/* Explicitly hide bottom nav on desktop to avoid any cascade showing it */
@media (min-width: 992px) {
  #bottom-nav { display: none !important; }
}

@media (max-width: 575px) {
  .clubs-grid { grid-template-columns: repeat(2, 1fr); }
  .day-col { min-width: 80px; }
  .clubs-filter input { width: 100%; }
  /* Hide calendar title and view toggle on small phones */
  #cal-title { display: none !important; }
  /* Keep the view-toggle container visible so the department select is always accessible.
     Only hide the week/day buttons on phones. */
  .view-toggle .view-toggle-buttons { display: none !important; }
}
