/* ===================================================
   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-w:   220px;
  --sidebar-bg:  #533860; /* deep accent (0137d90) */
  --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 */

  /* 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: #00236b; /* 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: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-scroll); border-radius: 3px; }

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

/* ---- Sidebar (desktop) ---- */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform .3s;
}

#sidebar .brand {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
#sidebar .brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--coi-gold);
  margin: 0 0 2px;
  line-height: 1.2;
}
#sidebar .brand p {
  font-size: .7rem;
  color: var(--color-muted);
  margin: 0;
}

#sidebar nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 4px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s;
  text-align: left;
}
.nav-btn .icon-wrap {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.07);
  border-radius: 8px;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background .2s;
}
.nav-btn:hover { background: var(--nav-hover); color: var(--color-surface); }
.nav-btn.active {
  background: var(--coi-gold);
  color: var(--color-strong);
}
.nav-btn.active .icon-wrap { background: rgba(0,0,0,.15); }

#sidebar .sidebar-footer {
  padding: 12px 16px;
  font-size: .72rem;
  color: var(--color-muted-2);
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ---- Main content wrapper ---- */
#content-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: visible; /* allow sticky headers to be visible */
}

/* 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(--sidebar-bg);
  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); }

/* ===================================================
   HOME – CALENDAR
   =================================================== */
.calendar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0 10px;
  flex-wrap: wrap;
}
.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: flex; gap: 4px; }

/* Time grid */
.calendar-grid-wrap {
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  position: relative; /* make this the reference for sticky day headers */
  -webkit-overflow-scrolling: touch; /* smoother scrolling on iOS */
}
.calendar-grid {
  display: flex;
  min-width: 0;
  /* ensure children can overflow and sticky headers can position relative to the wrap */
  overflow: visible;
}

/* 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: auto;
}
.day-col {
  flex: 1;
  min-width: 100px;
  border-right: 1px solid var(--color-border-2);
  position: relative;
  overflow: visible;
}
.day-col:last-child { border-right: none; }

.day-header {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 100; /* above events and grid lines */
  height: 56px; /* consistent header height */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 6px; /* minimal horizontal padding; vertical centered by flex */
  text-align: center;
  border-bottom: 1px solid var(--color-border-2);
}
.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%;
}

  :root {
    /* Colors */
  --color-primary: #533860; /* e-global-color-primary (updated) */
  --color-secondary: #54595F; /* e-global-color-secondary */
  --color-text: #7A7A7A; /* e-global-color-text */
  --color-accent: #FFE432; /* e-global-color-accent */
  --color-0137d90: #420C31; /* e-global-color-0137d90 */

    /* Typography */
    --font-primary: 'Roboto Slab', serif; /* e-global-typography-primary-font-family */
    --font-primary-weight: 700;          /* e-global-typography-primary-font-weight */
    --font-secondary: 'Source Sans 3', sans-serif; /* e-global-typography-secondary-font-family */
    --font-secondary-weight: 700;       /* e-global-typography-secondary-font-weight */
    --font-text: 'Source Sans 3', sans-serif;      /* e-global-typography-text-font-family */
    --font-text-weight: 400;            /* e-global-typography-text-font-weight */
    --font-accent: 'Roboto', sans-serif;           /* e-global-typography-accent-font-family */
    --font-accent-weight: 500;          /* e-global-typography-accent-font-weight */

    font-size: 16px;
  }


/* 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; }

/* ===================================================
   CLUBS PAGE
   =================================================== */
.clubs-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  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;
}

.club-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px 14px;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  text-align: center;
}
.club-tile:hover {
  box-shadow: 0 4px 18px rgba(0,48,135,.12);
  transform: translateY(-2px);
}
.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-surface);
  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: 420px;
  margin: 40px 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;
}

/* ===================================================
   ABOUT PAGE
   =================================================== */
.about-hero {
  background: linear-gradient(135deg, var(--coi-blue) 0%, var(--color-secondary) 100%);
  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: linear-gradient(135deg, var(--coi-blue), var(--coi-gold));
  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-blue); font-weight: 600; }

/* ===================================================
   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 0 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}
.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 { margin-left: 0; padding-bottom: 70px; }
  #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 only on small phones */
  #cal-title { display: none !important; }
}
