/* Main application styles - imports domain-specific styles */
@import url("./calendar.css");
@import url("./progress.css");
@import url("./goals.css");
@import url("./profile.css");
@import url("./palantir.css");
@import url("./wrapped.css");

/* CSS Custom Properties - Color Palette */
:root {
  /* Backgrounds */
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --bg-dark-alt: #2a2a2a;
  --bg-button-dark: #444;
  --bg-modal-overlay: rgba(0, 0, 0, 0.5);
  --bg-modal-dark: rgba(0, 0, 0, 0.95);
  
  /* Accent Colors */
  --accent-gold: #FFD700;
  --text-gold: var(--accent-gold); /* Deprecated: Use --accent-gold instead */
  --accent-blue: #007bff;
  --accent-blue-alt: #2563eb;
  --accent-blue-dark: #1e5aa8;
  --accent-teal: #16c79a;
  --accent-dark-teal: #006048;
  --accent-dark-blue: #0f3460;
  --spring-meadow: #00FF7F;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #ccc;
  --text-muted: #999;
  --text-dim: #aaa;
  --text-black: #000;
  --text-gray-dark: #333;
  --text-gray-medium: #666;
  
  /* Light theme colors (for auth page) */
  --light-bg: #f5f5f5;
  --light-bg-error: #fff5f5;
  --light-bg-success: #f0f9f0;
  --light-border: #ddd;
  --light-border-hover: #777;
  
  /* Status Colors */
  --status-success: #28a745;
  --status-success-light: #51cf66;
  --status-error: #dc3545;
  --status-error-hover: #c82333;
  --status-warning: #ff6b6b;
  
  /* UI Elements */
  --border-gray: #333;
  --border-medium: #555;
  --border-light: #666;
  --border-lighter: #ababab;
  --shadow-dark: #222;
  --bg-button-medium: var(--border-medium);  /* Medium button background (derived from border-medium) */
  
  /* Secondary Colors */
  --secondary-gray: #6c757d;
  --secondary-gray-hover: #545b62;
  --secondary-dark: #404040;
  
  /* Overlay Effects */
  --hover-overlay: rgba(255, 255, 255, 0.1);
  --hover-overlay-light: rgba(255, 255, 255, 0.05);
  --blue-overlay-light: rgba(15, 52, 96, 0.1);  /* Blue overlay/focus ring */
  --gold-glow-light: rgba(255, 215, 0, 0.3);
  --gold-glow-medium: rgba(255, 215, 0, 0.5);
  --gold-glow-strong: rgba(255, 215, 0, 0.7);
  --gold-border-light: rgba(255, 215, 0, 0.6);
  --gold-border-strong: rgba(255, 215, 0, 0.8);
  --blue-overlay: rgba(0, 120, 215, 0.25);
  --blue-border: rgba(0, 123, 255, 0.3);
  --blue-focus-ring: rgba(0, 123, 255, 0.25);
  --dark-overlay: rgba(60, 60, 60, 0.8);
  --dark-bg: rgba(50, 50, 50, 0.95);
  --darker-bg: rgba(45, 45, 45, 0.95);
  --darkest-bg: rgba(55, 55, 55, 0.95);
  --shadow-std: rgba(0, 0, 0, 0.3);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --status-warning-bg: rgba(255, 107, 107, 0.1);
  --status-success-bg: rgba(81, 207, 102, 0.1);
}

/* General application layout */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  width: 100vw;
  position: relative;
  z-index: 2;
  text-align: center;
  margin: 0;
  padding: 2em 0 1em 0;
}

h1 {
  font-size: 2.2em;
  max-width: 100vw;
  word-break: break-word;
  color: var(--accent-gold);
  font-weight: bold;
  text-shadow: 2px 2px 8px var(--border-gray);
  margin: 0;
  padding: 0 70px; /* Prevent overlap with menu icon on mobile */
}

#total-distance-value {
  font-size: 1.7em;
  color: var(--text-primary);
  font-weight: bold;
  letter-spacing: 2px;
  margin-top: 0.5em;
  word-break: break-word;
}


/* Menu icon styles - circular button */
.header-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 1.2rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--shadow-std);
  padding: 0;
  font-family: inherit;
}

.menu-icon:hover {
  background: var(--accent-dark-blue);
  border-color: var(--accent-teal);
  color: var(--text-primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--gold-glow-light);
}

.menu-icon:active {
  transform: scale(0.98);
}

.menu-icon:focus {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}

/* Mobile responsive adjustments for header layout */
@media (max-width: 768px) {
  header {
    padding: 1.5em 0 1em 0;
  }
  
  h1 {
    font-size: 1.8em;
    padding: 0 60px; /* Ensure space for menu icon */
  }
  
  .header-controls {
    top: 0.75rem;
    right: 0.75rem;
  }
  
  .menu-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5em;
    padding: 0 55px; /* Tighter on very small screens */
  }
  
  #total-distance-value {
    font-size: 1.4em;
  }
}

/* ============================================================================
   Party Selector (Fellowship UI) - Story 3.6
   ============================================================================ */

/* Party color palette CSS variables */
:root {
  --party-color-0: #E6194B;
  --party-color-1: #3CB44B;
  --party-color-2: #4363D8;
  --party-color-3: #F58231;
  --party-color-4: #911EB4;
  --party-color-5: #42D4F4;
  --party-color-6: #F032E6;
  --party-color-7: #BFEF45;
  --party-color-8: #FABED4;
  --party-color-9: #469990;
  --party-color-10: #DCBEFF;
  --party-color-11: #9A6324;
}

.party-selector {
  text-align: center;
  padding: 0.5em 1em;
}

.party-selector--journey {
  margin: 0 auto;
  max-width: 500px;
}

.party-selector--map {
  position: absolute;
  top: 0.5em;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 12px;
  box-shadow: 0 2px 12px var(--shadow-std);
  backdrop-filter: blur(8px);
}

.party-selector__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.party-selector__label {
  color: var(--text-dim);
  font-size: 0.9em;
  white-space: nowrap;
}

.party-selector__dropdown {
  background: var(--bg-dark-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-gray);
  border-radius: 6px;
  padding: 0.35em 0.7em;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  max-width: 200px;
  text-overflow: ellipsis;
}

.party-selector__dropdown:focus {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
}

.party-selector__dropdown:disabled {
  opacity: 0.6;
  cursor: wait;
}

.party-selector__loading {
  color: var(--accent-gold);
  font-size: 0.85em;
}

.party-selector__members {
  color: var(--text-dim);
  font-weight: normal;
  font-size: 0.9em;
  margin-left: 0.3em;
}

/* Map party selector button (toggle) — also used as social toggle */
.map-party-toggle,
.map-social-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--shadow-std);
  padding: 0;
  font-family: inherit;
}

.map-party-toggle:hover,
.map-social-toggle:hover {
  background: var(--accent-dark-blue);
  border-color: var(--accent-teal);
  color: var(--text-primary);
  transform: scale(1.05);
}

.map-party-toggle.active,
.map-social-toggle.active {
  background: var(--accent-dark-blue);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

/* Map party selection panel (dropdown from toggle button) — positioning in map.css */
.map-party-panel,
.map-social-panel {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 15;
  box-shadow: 0 4px 12px var(--shadow-std);
  max-height: 300px;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.map-party-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s;
  font-family: inherit;
}

.map-party-option:hover {
  background: var(--accent-dark-blue);
}

.map-party-option.selected {
  background: var(--accent-dark-blue);
  color: var(--accent-gold);
  font-weight: 600;
}

/* Social panel sections */
.social-panel-section {
  padding: 8px 10px;
}

.social-panel-section + .social-panel-section {
  border-top: 1px solid var(--border-gray);
}

.social-panel-section h4 {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  font-weight: 600;
}

/* Friends toggle row */
.friends-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friends-toggle-row + .friends-toggle-row {
  margin-top: 8px;
}

.friends-toggle-row span {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Toggle switch for "Friends on Map" */
.friends-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.friends-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.friends-toggle .toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark-alt);
  border-radius: 20px;
  transition: background 0.25s;
}

.friends-toggle .toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}

.friends-toggle input:checked + .toggle-slider {
  background: var(--accent-teal);
}

.friends-toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: var(--text-primary);
}

.friends-toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

/* Hint text below toggle */
.friends-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Friend mini-card popup */
.friend-mini-card {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  padding: 12px;
  z-index: 20;
  box-shadow: 0 4px 12px var(--shadow-std);
  min-width: 180px;
  max-width: 240px;
}

.friend-mini-card-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.friend-mini-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--accent-gold);
}

.friend-mini-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-mini-card-avatar .friend-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.friend-mini-card-info {
  flex: 1;
  min-width: 0;
}

.friend-mini-card-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-mini-card-distance {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.friend-mini-card-link {
  font-size: 0.85rem;
  color: var(--accent-teal);
  text-decoration: none;
}

.friend-mini-card-link:hover {
  text-decoration: underline;
}

/* Map legend (member colors overlay) */
.map-legend {
  position: absolute;
  bottom: 5em;
  left: 12px;
  background: rgba(20, 20, 30, 0.92);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  padding: 8px 10px;
  z-index: 12;
  max-width: 200px;
  box-shadow: 0 2px 8px var(--shadow-std);
}

.map-legend-title {
  color: var(--accent-gold);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.map-legend-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-legend-member {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-primary);
}

.map-legend-member.departed {
  opacity: 0.6;
}

.map-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.map-legend-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-legend-distance {
  color: var(--text-secondary);
  font-size: 0.72rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .party-selector--map {
    max-width: 90vw;
  }
  
}

/* ============================================================================
   PWA Install Banner
   ============================================================================ */

.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--accent-gold);
  box-shadow: 0 -2px 12px var(--shadow-std);
  animation: pwa-slide-up 0.3s ease-out;
}

@keyframes pwa-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.pwa-install-banner__content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pwa-install-banner__icon {
  font-size: 1.4rem;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.pwa-install-banner__text {
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.3;
}

.pwa-install-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-banner__install {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent-gold);
  color: var(--text-black);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  white-space: nowrap;
}

.pwa-install-banner__install:hover {
  background: #ffe44d;
  transform: scale(1.03);
}

.pwa-install-banner__install:active {
  transform: scale(0.97);
}

.pwa-install-banner__install:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.pwa-install-banner__dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  font-family: inherit;
}

.pwa-install-banner__dismiss:hover {
  color: var(--text-primary);
  background: var(--hover-overlay);
}

.pwa-install-banner__dismiss:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}
