/* Austin Dives - CSS Design System */

/* CSS Custom Properties (Design Tokens) */
:root {
    /* Texas Brand Colors */
    --primary-color: #BF5700;        /* Burnt Orange (UT Austin) */
    --secondary-color: #1C3664;      /* Deep Blue */
    --accent-color: #F2A900;         /* Gold */

    /* Texas Theme Colors */
    --texas-red: #BF0A30;            /* Lone Star Red */
    --texas-blue: #002868;           /* Texas Flag Blue */
    --saddle-brown: #8B4513;         /* Saddle Brown */
    --desert-tan: #D2B48C;           /* Desert Tan */
    --cowboy-copper: #B87333;        /* Cowboy Copper */
    --live-music-purple: #9B59B6;    /* Live Music Accent */

    /* UI Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-dark: #1a1a1a;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-light: #ffffff;
    --border-color: #e0e0e0;

    /* Transit Colors */
    --metrorail-color: #BF5700;
    --metrorapid-801: #004990;
    --metrorapid-803: #00A54F;
    --bus-color: #FFC72C;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;

    /* Borders */
    --border-radius: 8px;
    --border-radius-sm: 4px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

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

/* Dark Mode - using data-theme attribute */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --text-primary: #f0f0f0;
    --text-secondary: #aaaaaa;
    --text-light: #ffffff;
    --border-color: #444444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
}

/* Legacy class support */
.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --border-color: #444444;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    padding: 0;
    margin: 0;
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
}

html, body {
    position: absolute;
    height: 100%;
    width: 100vw;
}

/* Map Container */
#map-container {
    position: relative;
    height: 95%;
    width: 100vw;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
}

/* Navigation Bar */
#info {
    position: fixed;
    height: 5%;
    min-height: 44px;
    width: 100vw;
    bottom: 0;
    z-index: 1000;
}

#ul-bar {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    height: 100%;
}

#li-bar {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    height: 100%;
    display: flex;
    align-items: center;
}

#li-bar:last-child {
    border-right: none;
    margin-left: auto;
}

#a-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    transition: background-color var(--transition-fast);
    height: 100%;
}

#a-bar:hover,
#a-bar:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:hover,
.btn:focus {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #a34a00;
}

/* Map Control Buttons */
#findClosestBarButton {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    position: absolute;
    top: 230px;
    left: 10px;
    padding: 10px 16px;
    z-index: 500;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

#findClosestBarButton:hover,
#findClosestBarButton:focus {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

#clearDirectionsButton {
    background-color: #dc3545;
    color: white;
    position: absolute;
    top: 280px;
    left: 10px;
    padding: 8px 14px;
    z-index: 500;
    border: none;
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

#clearDirectionsButton:hover {
    background-color: #c82333;
}

#next-button,
#closest-button {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    position: absolute;
    bottom: 70px;
    left: 10px;
    padding: var(--space-sm) var(--space-md);
    z-index: 400;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-primary);
    cursor: pointer;
    display: none;
    box-shadow: var(--shadow-sm);
}

#next-button:hover,
#next-button:focus,
#closest-button:hover,
#closest-button:focus {
    background-color: var(--primary-color);
    color: var(--text-light);
}

/* Grid Layout Utilities */
.column {
    float: left;
    width: 33.33%;
    padding: 5px;
}

.row::after {
    content: "";
    clear: both;
    display: table;
}

/* Leaflet Overrides */
.leaflet-control-container .leaflet-routing-container-hide {
    width: 40px !important;
    height: 40px !important;
    border-radius: var(--border-radius) !important;
    border: 2px solid var(--primary-color) !important;
}

/* Move Leaflet zoom controls to avoid overlap with our UI */
.leaflet-top.leaflet-left {
    top: 55px;
}

/* Move Leaflet layer controls away from theme toggle */
.leaflet-top.leaflet-right {
    top: 60px;
    right: 10px;
}

/* Popup Styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: var(--space-sm);
}

.leaflet-popup-content h3 {
    margin: 0 0 var(--space-xs);
    color: var(--primary-color);
    font-size: var(--font-size-lg);
}

.leaflet-popup-content p {
    margin: var(--space-xs) 0;
    font-size: var(--font-size-sm);
}

.leaflet-popup-content a {
    color: var(--secondary-color);
    text-decoration: none;
    margin-right: var(--space-sm);
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

.leaflet-popup-tip {
    background: var(--bg-primary);
}

/* Dark Mode Popup */
.dark-mode .leaflet-popup-content-wrapper {
    background: #2c3e50;
    color: var(--text-light);
}

.dark-mode .leaflet-popup-content a {
    color: rgba(255, 255, 255, 0.7);
}

.dark-mode .leaflet-popup-tip {
    background: #2c3e50;
}

/* Accessibility - Visually Hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--text-light);
    padding: var(--space-sm) var(--space-md);
    z-index: 9999;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #info {
        min-height: 50px;
    }

    #a-bar {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-sm);
    }

    #findClosestBarButton {
        font-size: var(--font-size-sm);
        padding: var(--space-xs) var(--space-sm);
        top: 270px;
    }

    #clearDirectionsButton {
        top: 315px;
    }

    .search-container {
        width: calc(100% - 70px) !important;
        left: 10px !important;
        right: 60px !important;
    }

    .map-controls {
        top: 140px;
        flex-direction: row;
        gap: 6px;
        max-width: calc(100% - 20px);
    }

    .filter-btn {
        padding: 4px 10px;
        font-size: 12px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 70px;
    max-width: 320px;
    z-index: 998;
}

#bar-search {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

#bar-search:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

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

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

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

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

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

.search-result-item:hover,
.search-result-item:focus {
    background: var(--bg-secondary);
}

.search-result-item .bar-name {
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-item .bar-meta {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.search-result-item .bar-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}

.bar-status.open {
    background: #28a745;
    color: white;
}

.bar-status.closed {
    background: #dc3545;
    color: white;
}

/* =====================================================
   FILTER CONTROLS
   ===================================================== */
.map-controls {
    position: absolute;
    top: 140px;
    left: 10px;
    z-index: 400;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 280px;
}

.filter-btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: var(--font-size-sm);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover,
.filter-btn:focus {
    background: var(--bg-secondary);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

.filter-btn .count {
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* =====================================================
   BAR COUNT INDICATOR
   ===================================================== */
.bar-count-indicator {
    position: absolute;
    bottom: 60px;
    right: 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-sm);
    z-index: 400;
}

/* =====================================================
   LOADING OVERLAY
   ===================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(26, 26, 26, 0.9);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

/* =====================================================
   LOCATION PROMPT
   ===================================================== */
.location-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: var(--space-xl);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    z-index: 500;
    max-width: 320px;
}

.location-prompt h2 {
    color: var(--primary-color);
    margin: 0 0 var(--space-sm);
}

.location-prompt p {
    color: var(--text-secondary);
    margin: 0 0 var(--space-md);
    font-size: var(--font-size-sm);
}

.location-prompt .btn {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.location-prompt .skip-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
}

.location-prompt .skip-btn:hover {
    color: var(--text-primary);
}

/* =====================================================
   THEME TOGGLE
   ===================================================== */
.theme-toggle {
    position: fixed !important;
    top: 10px;
    right: 10px;
    z-index: 9999;
    background: var(--bg-primary);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    font-size: 20px;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    transform: scale(1.05);
}

/* =====================================================
   DARK MODE - MAP TILES
   ===================================================== */
[data-theme="dark"] .leaflet-tile-pane {
    filter: none; /* Remove old filter approach */
}

[data-theme="dark"] .leaflet-control-zoom a {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.8);
    color: var(--text-secondary);
}

[data-theme="dark"] .leaflet-control-attribution a {
    color: var(--text-secondary);
}

/* Dark mode popups */
[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .leaflet-popup-content h3 {
    color: var(--accent-color);
}

[data-theme="dark"] .leaflet-popup-content a {
    color: var(--accent-color);
}

[data-theme="dark"] .leaflet-popup-tip {
    background: var(--bg-secondary);
}

/* Dark mode controls */
[data-theme="dark"] #findClosestBarButton,
[data-theme="dark"] #next-button,
[data-theme="dark"] #closest-button,
[data-theme="dark"] .filter-btn,
[data-theme="dark"] #bar-search,
[data-theme="dark"] .search-results,
[data-theme="dark"] .bar-count-indicator,
[data-theme="dark"] .theme-toggle {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* =====================================================
   LIVE MUSIC FILTER
   ===================================================== */
.filter-btn[data-filter="livemusic"] {
    background: var(--bg-primary);
}

.filter-btn[data-filter="livemusic"].active {
    background: var(--live-music-purple);
    border-color: var(--live-music-purple);
}

.filter-btn[data-filter="livemusic"]:hover:not(.active) {
    background: rgba(155, 89, 182, 0.1);
}

/* =====================================================
   TEXAS THEMED ACHIEVEMENTS
   ===================================================== */
.achievements-container {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.achievements-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 5px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-badge:hover {
    transform: scale(1.05);
}

.achievement-badge.earned {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(191, 87, 0, 0.3);
}

.achievement-badge.locked {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    opacity: 0.6;
}

.achievement-badge .badge-icon {
    font-size: 1.3em;
}

/* =====================================================
   YEEHAW EASTER EGG ANIMATION
   ===================================================== */
@keyframes yeehaw {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(-10deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-15px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes starBurst {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1.5); }
}

.yeehaw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(191, 87, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.yeehaw-text {
    font-size: 4em;
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 0 var(--accent-color);
    animation: yeehaw 0.5s ease infinite;
}

.yeehaw-stars {
    position: absolute;
    font-size: 3em;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =====================================================
   BAR TYPE BADGES IN POPUPS
   ===================================================== */
.bar-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    margin-right: 5px;
}

.bar-type-badge.divebar {
    background: var(--saddle-brown);
    color: white;
}

.bar-type-badge.livemusic {
    background: var(--live-music-purple);
    color: white;
}

.bar-type-badge.honkytonk {
    background: var(--cowboy-copper);
    color: white;
}
