/* -------------------------------------------------------------
 * FunFinder PWA Map - Premium Styling & Design System
 * ------------------------------------------------------------- */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-dark: #07090e;
  --bg-base: #0d111d;
  --bg-surface: rgba(20, 27, 45, 0.65);
  --bg-surface-solid: #141b2d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-glow: rgba(6, 182, 212, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-purple: #8b5cf6;
  
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #ec4899 100%);
  --gradient-accent-hover: linear-gradient(135deg, #22d3ee 0%, #f472b6 100%);
  --gradient-dark: linear-gradient(180deg, rgba(13, 17, 29, 0) 0%, rgba(13, 17, 29, 0.95) 100%);
  
  /* Layout Constants */
  --sidebar-width: 380px;
  --header-height: 70px;
  
  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  /* Shadows & Glass */
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --glass-blur: blur(16px);
  --transition-speed: 0.3s;
}

/* Reset & Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--accent-pink);
}

/* -------------------------------------------------------------
 * Layout Structure
 * ------------------------------------------------------------- */
#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Fullscreen Map container */
#map-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
}

/* Overlay UI layer (headers, cards, sidebars sit above the map) */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Let clicks pass to map except for UI components */
  display: flex;
  flex-direction: column;
}

/* Make UI components clickable again */
.interactive {
  pointer-events: auto;
}

/* -------------------------------------------------------------
 * Header UI
 * ------------------------------------------------------------- */
header.app-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(7, 9, 14, 0.85) 0%, rgba(7, 9, 14, 0) 100%);
  z-index: 20;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(6, 182, 212, 0.2));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Styled Button Bases */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--glass-shadow);
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  backdrop-filter: var(--glass-blur);
}
.btn-icon:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}
.btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* -------------------------------------------------------------
 * Category Filter Strip
 * ------------------------------------------------------------- */
.filters-bar {
  padding: 0 24px 16px 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for clean look */
  z-index: 15;
}
.filters-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  transition: all var(--transition-speed) ease;
}

.filter-chip:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* -------------------------------------------------------------
 * Desktop Sidebar Layout
 * ------------------------------------------------------------- */
.sidebar-panel {
  position: absolute;
  top: 100px;
  left: 24px;
  bottom: 24px;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-panel.hidden {
  transform: translateX(calc(-100% - 40px));
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 1.3rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed);
}
.btn-close:hover {
  color: var(--text-primary);
}
.btn-close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.panel-content::-webkit-scrollbar {
  width: 6px;
}
.panel-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Details Section inside Panel */
.details-image {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
}

.details-category {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
  margin-bottom: 12px;
}

.details-title {
  font-size: 1.6rem;
  margin-bottom: 12px;
  line-height: 1.2;
}

.details-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #fbbf24; /* Amber star */
}
.details-rating svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.details-rating span {
  color: var(--text-secondary);
}

.details-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Info Grid (address, phone, hours) */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-bottom: 24px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.info-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}
.info-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 2px;
}

.info-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-word;
}

/* Places List (when no place is selected) */
.places-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.place-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.place-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
}

.place-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.place-card-category {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 600;
}

/* -------------------------------------------------------------
 * Mobile Bottom Sheet Layout
 * ------------------------------------------------------------- */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface-solid); /* Solid background on mobile for better visibility over map */
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  z-index: 30;
  transform: translateY(100%);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.bottom-sheet.visible {
  transform: translateY(0);
}

/* For Glassmorphic look if supported */
@supports (backdrop-filter: blur(10px)) {
  .bottom-sheet {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color);
  }
}

.sheet-handle-container {
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Hide desktop elements on mobile */
.desktop-only {
  display: block;
}
.mobile-only {
  display: none;
}

/* -------------------------------------------------------------
 * Custom Install App / PWA Promotion Banner
 * ------------------------------------------------------------- */
.pwa-install-banner {
  position: absolute;
  top: 90px;
  right: 24px;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.install-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.install-logo svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.install-text {
  flex: 1;
}

.install-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.install-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-install-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  align-self: flex-start;
}
.btn-install-close:hover {
  color: var(--text-primary);
}
.btn-install-close svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* -------------------------------------------------------------
 * Settings Modal & Setup Overlay (For Google Maps API Key)
 * ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 500px;
  background: #101625;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  transform: translateY(20px);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-overlay.visible .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Install Guide Tabs */
.install-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition-speed);
}

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

.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

.steps-list {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.steps-list li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.share-icon-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-speed);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Map Setup Overlay (When API key is missing) */
.map-setup-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color-glow);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.map-setup-icon {
  width: 60px;
  height: 60px;
  background: rgba(6, 182, 212, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  margin-bottom: 8px;
}
.map-setup-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.map-setup-overlay h3 {
  font-size: 1.4rem;
}

.map-setup-overlay p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Custom Styled Google Map Markers */
/* The standard google map markers will be styled where possible, or custom overlay elements will be used. */
.map-custom-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-accent);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s;
}
.map-custom-marker:hover {
  transform: scale(1.15);
}

/* -------------------------------------------------------------
 * Media Queries for Mobile Responsiveness
 * ------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  
  header.app-header {
    padding: 0 16px;
  }
  
  .logo-text {
    font-size: 1.3rem;
  }
  
  .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  
  .logo-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .filters-bar {
    padding: 0 16px 12px 16px;
  }
  
  .filter-chip {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  /* Desktop sidebar is hidden on mobile */
  .sidebar-panel {
    display: none;
  }
  
  /* PWA install banner styles on mobile */
  .pwa-install-banner {
    top: auto;
    bottom: 24px;
    left: 16px;
    right: 16px;
    width: auto;
  }

  /* Desktop/Mobile specific content triggers */
  .desktop-only {
    display: none;
  }
  .mobile-only {
    display: block;
  }
}
