/* ============================================================================
   WHEN IT WAS - MAP CORE STYLES
   Shared styles for both mobile and desktop
   ============================================================================ */

/* ==================== CSS VARIABLES FOR EASY THEMING ==================== */
:root {
    /* Primary Colors */
    --color-primary: #D4A574;           /* Compass Gold */
    --color-primary-dark: #c49563;      /* Darker Gold */
    --color-background: rgba(42, 42, 42, 0.98);
    --color-background-light: rgba(61, 61, 61, 0.98);
    --color-background-dark: #1a1a1a;

    /* Text Colors */
    --color-text: #E8DCC8;              /* Antique Cream */
    --color-text-secondary: #94a3b8;    /* Gray Blue */
    --color-text-dim: rgba(232, 220, 200, 0.6);

    /* Semantic Colors */
    --color-success: #4CAF50;
    --color-error: #F44336;
    --color-warning: #FF9800;
    --color-info: #2196F3;

    /* UI Colors */
    --color-border: rgba(212, 165, 116, 0.2);
    --color-border-strong: rgba(212, 165, 116, 0.4);
    --color-overlay: rgba(0, 0, 0, 0.4);
    --color-overlay-dark: rgba(0, 0, 0, 0.7);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 25px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Z-Index Layers */
    --z-timeline: 3000;
    --z-bottom-sheet: 2500;
    --z-overlay: 2499;
    --z-floating-card: 2000;
    --z-sidebar: 1500;
    --z-header: 1000;
    --z-map: 1;
}

/* ==================== GLOBAL RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--color-background-dark);
    color: var(--color-text);
    overflow: hidden;
}

/* ==================== LAYOUT ==================== */
.container {
    display: flex;
    height: 100vh;
    flex-direction: column;
}

/* ==================== HEADER ==================== */
.header {
    background: rgba(42, 42, 42, 0.95);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
    z-index: var(--z-header);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    background: rgba(61, 90, 107, 0.2);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 25px;
    color: var(--color-text);
    font-size: 14px;
}

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

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--color-background);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-dropdown.active {
    display: block;
}

.search-dropdown-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover,
.search-dropdown-item.selected {
    background: rgba(212, 165, 116, 0.1);
}

.search-dropdown-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 165, 116, 0.2);
    border-radius: 50%;
    font-size: 12px;
}

.search-dropdown-item-content {
    flex: 1;
}

.search-dropdown-item-title {
    color: var(--color-text);
    font-weight: 500;
    margin-bottom: 2px;
}

.search-dropdown-item-subtitle {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.search-dropdown-no-results {
    padding: 20px;
    text-align: center;
    color: var(--color-text-secondary);
}

/* Photo Carousel */
.photo-carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.photo-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-carousel-container:hover .photo-controls {
    opacity: 1;
}

.photo-nav {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    transition: background 0.2s ease;
}

.photo-nav:hover {
    background: rgba(0, 0, 0, 0.9);
}

.photo-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-counter {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    pointer-events: none;
}

.photo-timeline-controls {
    position: absolute;
    top: 10px;
    right: 50px;
    display: none;
}

.photo-carousel-container:hover .photo-timeline-controls {
    display: block;
}

.photo-timeline-btn {
    background: rgba(212, 165, 116, 0.9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.photo-timeline-btn:hover {
    background: rgba(212, 165, 116, 1);
}

/* Photo Upload Button */
.photo-upload-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.photo-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
}

.photo-upload-btn:active {
    transform: translateY(0);
}

/* Login Modal Benefits */
.login-modal-benefits {
    margin: 20px 0;
    padding: 15px;
    background: rgba(212, 165, 116, 0.1);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 165, 116, 0.2);
}

.benefit-item {
    padding: 8px 0;
    color: var(--color-text);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.benefit-item::before {
    color: var(--color-primary);
    font-weight: bold;
}

.category-filter {
    padding: 10px 15px;
    background: rgba(42, 42, 42, 0.95);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 25px;
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
}

.category-filter option {
    background: #2a2a2a;
    color: var(--color-text);
    padding: 10px;
}

.user-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-link {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(212, 165, 116, 0.5);
    border-radius: 20px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(212, 165, 116, 0.1);
}

/* ==================== HAMBURGER MENU (Mobile) ==================== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1100;
}

.hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--color-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1050;
}

.mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    backdrop-filter: blur(10px);
    border-left: 2px solid rgba(246, 211, 101, 0.3);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 80px 20px 20px;
}

.mobile-menu.open {
    right: 0;
}

.mobile-menu-item {
    padding: 15px;
    border-bottom: 1px solid rgba(246, 211, 101, 0.1);
    color: var(--color-text);
}

.mobile-menu-item label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-item select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(246, 211, 101, 0.3);
    border-radius: 10px;
    color: var(--color-text);
    font-size: 14px;
    transition: all 0.2s ease;
}

.mobile-menu-item select:focus {
    border-color: rgba(246, 211, 101, 0.7);
    box-shadow: 0 0 0 3px rgba(246, 211, 101, 0.1);
}

.mobile-menu-links {
    padding: 20px 15px;
}

.mobile-menu-links a {
    display: block;
    padding: 16px 18px;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 12px;
    background: rgba(246, 211, 101, 0.1);
    border: 2px solid rgba(246, 211, 101, 0.3);
    transition: all 0.2s ease;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-menu-links a:hover {
    background: rgba(246, 211, 101, 0.2);
    border-color: rgba(246, 211, 101, 0.5);
    transform: translateX(-4px);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ==================== SIDEBAR (Desktop Left Nav) ==================== */
.sidebar {
    width: 250px;
    background: rgba(42, 42, 42, 0.95);
    padding: 20px;
    border-right: 1px solid rgba(212, 165, 116, 0.2);
    overflow-y: auto;
}

.sidebar h3 {
    color: var(--color-primary);
    font-size: 18px;
    margin-bottom: 20px;
}

.sidebar-link {
    display: block;
    padding: 12px 15px;
    margin-bottom: 5px;
    background: rgba(61, 90, 107, 0.1);
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-link:hover {
    background: rgba(61, 90, 107, 0.3);
}

/* ==================== MAP AREA ==================== */
.map-container {
    flex: 1;
    position: relative;
}

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

.map-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(212, 165, 116, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    color: #1a1a1a;
    font-weight: bold;
    font-size: 14px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gps-btn {
    position: absolute;
    bottom: 220px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s;
}

.gps-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.gps-btn:active {
    transform: scale(0.95);
}

.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(42, 42, 42, 0.95);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(212, 165, 116, 0.3);
    z-index: 100;
}

.legend h4 {
    color: var(--color-primary);
    font-size: 14px;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

/* ==================== TIMELINE SLIDER ==================== */
.timeline-container {
    background: rgba(42, 42, 42, 0.95);
    padding: 20px;
    border-top: 1px solid rgba(212, 165, 116, 0.2);
    pointer-events: auto !important;
    z-index: var(--z-timeline) !important;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.timeline-label {
    font-size: 16px;
    color: var(--color-primary);
    font-weight: bold;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(61, 90, 107, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.toggle-switch-track {
    width: 40px;
    height: 20px;
    background: #3D5A6B;
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-switch-track.active {
    background: var(--color-primary);
}

.toggle-switch-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-switch-track.active .toggle-switch-thumb {
    left: 22px;
}

.slider-area {
    transition: all 0.3s ease;
}

.slider-area.dimmed {
    opacity: 0.3;
    pointer-events: none;
}

.slider-wrapper {
    position: relative;
    padding: 10px 0;
}

.slider-track {
    width: 100%;
    height: 6px;
    background: rgba(61, 90, 107, 0.5);
    border-radius: 3px;
    position: relative;
}

.slider-progress {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    position: absolute;
    left: 0;
    top: 0;
}

.slider-thumb {
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 50%;
    position: absolute;
    top: -7px;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
    z-index: 10;
}

.slider-thumb:active {
    cursor: grabbing;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* ==================== SHARED COMPONENTS ==================== */

/* Business items */
.business-item {
    background: rgba(61, 90, 107, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--color-primary);
}

.business-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.edit-btn {
    background: #4A5568;
    color: white;
}

.edit-btn:hover {
    background: #2D3748;
}

.photo-btn {
    background: var(--color-primary);
    color: #1a1a1a;
}

.photo-btn:hover {
    background: #C4956A;
}

.business-name {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 8px;
}

.business-years {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
}

.business-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-style: italic;
    line-height: 1.5;
}

.vacant-notice {
    background: rgba(239, 68, 68, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #ef4444;
    margin-bottom: 12px;
}

.vacant-notice .icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.vacant-notice .title {
    font-size: 16px;
    font-weight: bold;
    color: #ef4444;
    margin-bottom: 8px;
}

.vacant-notice .message {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.vacant-notice .context {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.add-business-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #D4A574 0%, #3D5A6B 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin-bottom: 10px;
}

.add-business-btn:hover {
    transform: translateY(-2px);
}

.add-photo-btn {
    width: 100%;
    padding: 12px;
    background: rgba(61, 90, 107, 0.8);
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-photo-btn:hover {
    background: rgba(61, 90, 107, 1);
    transform: translateY(-2px);
}

.trivia-placeholder {
    text-align: center;
    padding: 20px;
    background: rgba(61, 90, 107, 0.1);
    border-radius: 8px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* ==================== LOGIN MODAL ==================== */
.login-modal {
    background: rgba(42, 42, 42, 0.98);
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(212, 165, 116, 0.3);
}

.login-modal h3 {
    font-size: 22px;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.login-modal p {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
}

.login-modal-buttons {
    display: flex;
    gap: 10px;
}

.login-modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-modal-btn.primary {
    background: var(--color-primary);
    color: #1a1a1a;
}

.login-modal-btn.secondary {
    background: transparent;
    border: 1px solid rgba(212, 165, 116, 0.5);
    color: var(--color-primary);
}

/* ==================== POPUP STYLES ==================== */
.popup-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.popup-btn-time {
    background: var(--color-primary);
    color: #1a1a1a;
}

.popup-btn-time:hover {
    background: #E5B684;
    transform: translateY(-1px);
}

.popup-btn-details {
    background: #3D5A6B;
    color: var(--color-text);
}

.popup-btn-details:hover {
    background: #4D6A7B;
    transform: translateY(-1px);
}

.popup-btn.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-primary);
}

/* ==================== LOADING SPINNER ==================== */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(42, 42, 42, 0.95);
    padding: 30px 40px;
    border-radius: 12px;
    border: 1px solid rgba(212, 165, 116, 0.3);
    z-index: 3000;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(212, 165, 116, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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