/* ============================================================
   Pod-O-Gym Occupancy Tracker — Minimal Professional Dark Theme
   ============================================================ */

/* ---- Custom Properties ---- */
:root {
  /* Backgrounds & Panels */
  --bg-deep:       #09090b; /* zinc-950 */
  --bg-card:       #18181b; /* zinc-900 */
  --border-color:  #27272a; /* zinc-800 */
  --border-hover:  #3f3f46; /* zinc-700 */

  /* Theme Accent Colors (Solid, Professional) */
  --primary:       #3b82f6; /* blue-500 */
  --indigo:        #6366f1; /* indigo-500 */
  --amber:         #f59e0b; /* amber-500 */
  --emerald:       #10b981; /* emerald-500 */
  --red:           #ef4444; /* red-500 */

  /* Text Colors */
  --text-primary:   #f4f4f5; /* zinc-100 */
  --text-secondary: #a1a1aa; /* zinc-400 */
  --text-tertiary:  #71717a; /* zinc-500 */

  /* Typography */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-xs:     4px;

  /* Transitions */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--text-primary);
  background-color: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Firefox */
html {
  scrollbar-color: var(--border-color) var(--bg-deep);
  scrollbar-width: thin;
}

/* ---- Container ---- */
.container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ---- Card Base ---- */
.glass-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease-out),
              transform 0.2s var(--ease-out),
              box-shadow 0.2s var(--ease-out);
}

.glass-card:hover {
  border-color: var(--border-hover);
}

/* ---- Fade-in Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUp 0.5s var(--ease-out) forwards;
}
.fade-in--delay-1 { animation-delay: 0.08s; }
.fade-in--delay-2 { animation-delay: 0.16s; }
.fade-in--delay-3 { animation-delay: 0.24s; }
.fade-in--delay-4 { animation-delay: 0.32s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 28px;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header__title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
}

.header__subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.header__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.header__live-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---- Live Dot ---- */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}

.live-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--emerald);
  opacity: 0.4;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50%      { transform: scale(1.6); opacity: 0; }
}

.live-dot--error {
  background: var(--red);
}
.live-dot--error::before {
  background: var(--red);
}

/* ---- Hero Section ---- */
.hero {
  text-align: center;
  padding: 44px 24px 36px;
  margin-bottom: 24px;
}

.hero__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hero__count-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.hero__count {
  font-size: clamp(4.5rem, 11vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #ffffff;
  transition: transform 0.3s var(--ease-out);
}

.hero__count.bump {
  transform: scale(1.05);
}

.hero__unit {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.hero__timestamp {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

/* ---- Hero Progress Bar ---- */
.hero__bar-wrap {
  max-width: 380px;
  margin: 0 auto;
}

.hero__bar {
  width: 100%;
  height: 6px;
  background: #27272a; /* zinc-800 */
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.hero__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background-color: var(--primary); /* fallback */
  transition: width 0.6s var(--ease-out), background-color 0.3s ease;
}

/* Professional solid colors based on occupancy level */
.hero__bar-fill--low {
  background-color: var(--emerald);
}
.hero__bar-fill--mid {
  background-color: var(--amber);
}
.hero__bar-fill--high {
  background-color: var(--red);
}

.hero__bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Hero Error ---- */
.hero__error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 500;
}

.hero__error[hidden] {
  display: none;
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px 20px;
  cursor: default;
  border-left: 4px solid transparent;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

/* Left accent solid colors */
.stat-card:nth-child(1) { border-left-color: var(--primary); }
.stat-card:nth-child(2) { border-left-color: var(--indigo); }
.stat-card:nth-child(3) { border-left-color: var(--amber); }
.stat-card:nth-child(4) { border-left-color: var(--emerald); }

.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-card__icon--cyan   { background: rgba(59, 130, 246, 0.08); color: var(--primary); }
.stat-card__icon--purple { background: rgba(99, 102, 241, 0.08); color: var(--indigo); }
.stat-card__icon--amber  { background: rgba(245, 158, 11, 0.08); color: var(--amber); }
.stat-card__icon--green  { background: rgba(16, 185, 129, 0.08); color: var(--emerald); }

.stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
  line-height: 1.2;
  color: #ffffff;
}

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Chart Section ---- */
.chart-section {
  padding: 24px 24px 20px;
  margin-bottom: 24px;
}

.chart-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-section__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.chart-section__badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--indigo);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---- Time Range Buttons ---- */
.time-range-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-deep);
  border-radius: var(--radius-xs);
  padding: 3px;
  border: 1px solid var(--border-color);
}

.time-btn {
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.time-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.time-btn.active {
  background-color: var(--primary);
  color: #ffffff;
}

/* ---- Footer ---- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 0;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.footer__refresh-icon {
  opacity: 0.4;
  flex-shrink: 0;
}

.footer__refresh-icon.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.footer__copy {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .container {
    padding: 20px 16px 40px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 20px;
  }

  .hero {
    padding: 32px 16px 28px;
  }

  .hero__count {
    font-size: clamp(3.5rem, 12vw, 5rem);
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px 14px;
    padding: 16px;
  }

  .stat-card__icon {
    grid-row: 1 / 3;
    margin-bottom: 0;
  }

  .stat-card__value {
    font-size: 1.3rem;
    align-self: end;
  }

  .stat-card__label {
    align-self: start;
  }

  .chart-section {
    padding: 20px 16px 16px;
  }

  .chart-section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-wrap {
    height: 220px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Features Grid Layout ---- */
.features-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  margin-bottom: 24px;
}

.features-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feature-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.feature-card__title svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* ---- Smart Recommendations Styling ---- */
.rec-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rec-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  white-space: nowrap;
}

.rec-badge--quiet {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.rec-badge--normal {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.rec-badge--busy {
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.rec-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.rec-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec-slots__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rec-slots__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rec-slot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.rec-slot-item__time {
  font-weight: 600;
  color: var(--text-primary);
}

.rec-slot-item__day {
  color: var(--text-tertiary);
  font-size: 0.72rem;
  margin-left: 6px;
  text-transform: uppercase;
}

.rec-slot-item__count {
  font-weight: 700;
  color: var(--primary);
}

/* ---- Other Facilities Styling ---- */
.facilities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.facility-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease-out);
}

.facility-item:hover {
  border-color: var(--border-hover);
}

.facility-item__name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  display: block;
}

.facility-item__sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: block;
  margin-top: 1px;
}

.facility-item__status {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.facility-item__count {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.facility-item__label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* ---- Events List Styling ---- */
.events-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.events-list__loading {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-align: center;
  padding: 20px 0;
}

.event-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.event-item__time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--indigo);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.event-item__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

/* Responsive grid */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Olymp Button ---- */
.olymp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all 0.2s var(--ease-out);
}

.olymp-btn:hover {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
}
