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

:root {
  --bg: #000000;
  --bg-raised: rgba(10, 10, 10, 0.92);
  --bg-card: #0a0a0a;
  --bg-card-hover: #141414;
  --border: rgba(255, 255, 255, 0.14);
  --border-hover: rgba(255, 255, 255, 0.24);
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --text-tertiary: #888888;
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  --accent: #27BDF4;

  /* Content theme tokens (default = dark) */
  --c-bg: #000000;
  --c-surface: rgba(15, 15, 15, 0.85);
  --c-surface-hover: rgba(30, 30, 30, 0.95);
  --c-surface-elevated: #0d0d0d;
  --c-border: rgba(255, 255, 255, 0.14);
  --c-border-hover: rgba(255, 255, 255, 0.24);
  --c-text: #ffffff;
  --c-text-secondary: #b8b8b8;
  --c-text-tertiary: #888888;
  --c-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  --c-shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.light {
  --c-bg: #f5f5f7;
  --c-surface: #ffffff;
  --c-surface-hover: #f5f5f7;
  --c-surface-elevated: #ffffff;
  --c-border: rgba(0, 0, 0, 0.08);
  --c-border-hover: rgba(0, 0, 0, 0.16);
  --c-text: #0a0a0a;
  --c-text-secondary: #555555;
  --c-text-tertiary: #888888;
  --c-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  --c-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
}

body.light {
  background: var(--c-bg);
}

body.light .main {
  background: transparent;
}

body.light .footer {
  background: transparent;
  border-top-color: var(--c-border);
}

body.light .footer p {
  color: var(--c-text-tertiary);
}

/* Light mode: invert the white-on-transparent pattern so it shows on white bg */
body.light .app::before {
  opacity: 0.08;
  filter: invert(1);
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Bold/heavy headings & labels use Lato */
h1, h2, h3, h4,
.section-title,
.dropdown-trigger-btn,
.glow-card-label,
.location-name,
.login-card h1,
strong, b {
  font-family: 'Lato', 'Inter', sans-serif;
}

body {
  min-height: 100vh;
  background: var(--bg);
}

/* ========== LOGIN ========== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  max-width: 400px;
  width: 100%;
  margin: 20px;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: -4px;
}

.login-hint {
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}

.login-hint strong {
  color: var(--text-secondary);
}

.login-error {
  color: #f87171;
  font-size: 13px;
  text-align: center;
  padding: 10px 16px;
  background: rgba(248, 113, 113, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.1);
}

.dev-bypass {
  margin-top: 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: var(--transition);
}

.dev-bypass:hover {
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

/* ========== APP ========== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Pattern background - fixed behind everything */
.app::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('assets/pattern_coral.png');
  background-repeat: repeat;
  background-size: 1200px auto;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

/* Make sure all real content sits above the pattern */
.header,
.top-bar,
.main,
.footer {
  position: relative;
  z-index: 1;
}

/* Header sits above the pattern with its own solid bg */
.header {
  z-index: 2;
  background: var(--bg);
}

/* ========== HEADER ========== */
.header-image {
  position: relative;
  width: 100%;
  height: 280px;
  background: linear-gradient(135deg, #060d18 0%, #000 50%, #06121c 100%);
  overflow: hidden;
}

.header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-image.no-image > img {
  display: none;
}

.header-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo {
  max-height: 180px;
  max-width: 50%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ========== TOP BAR ========== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
}

.top-bar-left {
  margin-right: auto;
}

.top-bar-search {
  display: flex;
  justify-content: flex-end;
}

.top-bar-search .search-wrapper {
  width: 100%;
  max-width: 320px;
  position: relative;
}

.top-bar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.top-bar-search .search-input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.top-bar-search .search-input::placeholder {
  color: var(--text-tertiary);
}

.top-bar-search .search-input:focus {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.07);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-logo {
  height: 16px;
  width: auto;
  opacity: 0.7;
}

.top-bar-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.top-bar-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.sign-out-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}

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

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.theme-toggle svg,
.dropdown-trigger-btn svg,
.sign-out-btn svg {
  pointer-events: none;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
body.light .theme-icon-sun { display: block; }
body.light .theme-icon-moon { display: none; }

/* ========== FULL-WIDTH DROPDOWN TRIGGERS ========== */
.dropdown-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 32px;
}

.dropdown-trigger {
  position: relative;
}

.dropdown-trigger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 20px 24px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  font-family: inherit;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--c-shadow-card);
}

.dropdown-trigger-btn:hover,
.dropdown-trigger.open .dropdown-trigger-btn {
  color: var(--c-text);
  border-color: var(--accent);
}

.trigger-chevron {
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.5;
}

.dropdown-trigger.open .trigger-chevron {
  transform: rotate(180deg);
}

.dropdown-trigger .dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
  pointer-events: none;
}

.dropdown-trigger.open .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Search mode: lay dropdowns out inline instead of floating overlays */
body.search-active .dropdown-trigger.search-empty {
  display: none;
}

body.search-active .dropdown-trigger.search-match .dropdown-panel {
  position: static;
  margin-top: 8px;
  z-index: auto;
}

body.search-active .dropdown-trigger.search-match .dropdown-grid {
  box-shadow: none;
}

.dropdown-grid {
  background: var(--c-surface-elevated);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--c-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--c-text-secondary);
  font-size: 14px;
  transition: var(--transition);
}

.dropdown-link:hover {
  color: var(--c-text);
  background: var(--c-surface-hover);
}

.dropdown-link-text {
  flex: 1;
}

.arrow-icon {
  opacity: 0;
  transform: translateX(-4px);
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.dropdown-link:hover .arrow-icon {
  opacity: 0.5;
  transform: translateX(0);
}

/* ========== MAIN ========== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px 80px;
  width: 100%;
}

/* ========== SECTIONS ========== */
.section {
  margin-top: 48px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-text-tertiary);
  margin-bottom: 20px;
  padding-left: 2px;
}

/* ========== QUICK LINKS - GLOW CARDS ========== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.glow-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--c-shadow-card);
}

.glow-card::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
  z-index: 0;
}

.glow-card:hover::before {
  opacity: 1;
}

.glow-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Glow colors (icon + bg radial only) */
.glow-purple::before { background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%); }
.glow-blue::before { background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%); }
.glow-green::before { background: radial-gradient(circle, rgba(34, 197, 94, 0.12) 0%, transparent 70%); }
.glow-cyan::before { background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%); }
.glow-orange::before { background: radial-gradient(circle, rgba(249, 115, 22, 0.12) 0%, transparent 70%); }
.glow-pink::before { background: radial-gradient(circle, rgba(236, 72, 153, 0.12) 0%, transparent 70%); }

.glow-purple .glow-card-icon { color: #a855f7; }
.glow-blue .glow-card-icon { color: #3b82f6; }
.glow-green .glow-card-icon { color: #22c55e; }
.glow-cyan .glow-card-icon { color: #06b6d4; }
.glow-orange .glow-card-icon { color: #f97316; }
.glow-pink .glow-card-icon { color: #ec4899; }

.glow-card-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}

.glow-card-label {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.glow-card-desc {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--c-text-tertiary);
  margin-top: -6px;
}

/* ========== GRID & CARDS ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--c-shadow-card);
}

.card:hover {
  background: var(--c-surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.card.hidden,
.glow-card.hidden {
  display: none;
}

/* ========== LOCATION CARDS ========== */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.location-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: #ffffff;
  border: 1px solid var(--c-border);
  transition: all 350ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.location-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.location-img {
  position: relative;
  height: 200px;
  background: linear-gradient(135deg, #0a1628 0%, #0a0a0a 100%);
  overflow: hidden;
}

.location-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.location-card:hover .location-img img {
  transform: scale(1.05);
}

.location-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 30%);
}

.location-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  z-index: 1;
}

.location-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.location-detail {
  font-size: 13px;
  color: #d8d8d8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 1px 2px rgba(0, 0, 0, 0.5);
}

.location-card-placeholder {
  opacity: 0.6;
}

.location-card-placeholder:hover {
  transform: none;
  box-shadow: none;
}

/* Location card with hover dropdown (blue glow) */
.location-card-hover {
  position: relative;
  cursor: pointer;
  overflow: visible;
}

.location-card-hover .location-img {
  border-radius: 18px;
  overflow: hidden;
}

.location-card-hover:hover,
.location-card-hover.open {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.3),
    0 16px 48px rgba(56, 189, 248, 0.25),
    0 0 60px rgba(56, 189, 248, 0.2);
}

.location-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
  pointer-events: none;
}

.location-card-hover.open .location-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.location-panel-inner {
  background: var(--c-surface-elevated);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--c-shadow), 0 0 40px rgba(56, 189, 248, 0.18);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ========== CALENDAR EMBED ========== */
.calendar-embed {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.calendar-embed iframe {
  display: block;
  width: 100%;
  height: 600px;
  border: 0;
}

@media (max-width: 768px) {
  .calendar-embed iframe {
    height: 480px;
  }
}

/* ========== FOOTER ========== */
.footer {
  margin-top: auto;
  padding: 32px 40px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header-image {
    height: 200px;
  }

  .top-bar-inner {
    padding: 0 12px;
    gap: 12px;
  }

  .top-bar-search .search-wrapper {
    max-width: 250px;
  }

  .main {
    padding: 0 20px 60px;
  }

  .dropdown-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dropdown-trigger-btn {
    padding: 16px 20px;
  }

  .dropdown-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .glow-card {
    padding: 18px 16px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

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

  .location-img {
    height: 160px;
  }
}

@media (max-width: 480px) {
  .quick-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
  }

  .user-name {
    display: none;
  }
}

/* Firebase Auth login button (replaces the old Google Identity Services widget) */
.login-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #1f1f1f;
  border: 1px solid #1f1f1f;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.login-google-btn:hover { background: #2d2d2d; }
.login-google-btn:active { transform: scale(0.98); }
.login-google-btn svg { display: block; background: #fff; border-radius: 50%; padding: 2px; }

/* ========== DRIVE SEARCH ========== */
.drive-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.drive-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(39, 189, 244, 0.15);
}
.drive-search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--c-text);
  font-size: 14px;
  font-family: inherit;
}
.drive-search-input::placeholder { opacity: 0.45; }
.drive-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}
.drive-search-btn:hover { opacity: 0.85; }
.dropdown-divider {
  height: 1px;
  background: var(--c-border);
  margin: 4px 8px;
}
