* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

:root {
    --primary-bg: #1a1a2e;
    --secondary-bg: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --success: #00d9ff;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--secondary-bg);
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 1000;
    flex-shrink: 0;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    position: relative;
    background: var(--accent);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
    -webkit-touch-callout: none; /* Disable iOS callout */
}

.icon-btn:hover {
    background: var(--highlight);
    transform: scale(1.1);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--highlight);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Discovery Bar */
.discovery-bar {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--primary-bg);
    border-bottom: 1px solid var(--accent);
    z-index: 999;
    flex-shrink: 0;
}

.search-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--secondary-bg);
    border: 2px solid var(--accent);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

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

.clear-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.clear-btn:hover {
    color: var(--highlight);
}

.filter-toggle-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--secondary-bg);
    border: 2px solid var(--accent);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-toggle-btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.filter-toggle-btn.active {
    background: var(--highlight);
    border-color: var(--highlight);
}

/* Filter Panel */
.filter-panel {
    background: var(--secondary-bg);
    border-bottom: 2px solid var(--accent);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    z-index: 998;
}

.filter-panel:not(.hidden) {
    max-height: 500px;
    padding: 1.5rem 1rem;
    padding-bottom: 200px; /* Extra padding to clear player when it's visible */
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.loading-chips {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

.filter-chip {
    padding: 0.5rem 1rem;
    background: var(--accent);
    border: 2px solid transparent;
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    background: var(--highlight);
    transform: scale(1.05);
}

.filter-chip.active {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.4);
}

.filter-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.filter-select:focus {
    border-color: var(--success);
}

.filter-select option {
    background: var(--secondary-bg);
    color: var(--text-primary);
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--highlight);
    border-color: var(--highlight);
}

.primary-btn {
    padding: 0.75rem 1.5rem;
    background: var(--success);
    border: 2px solid var(--success);
    border-radius: 10px;
    color: var(--primary-bg);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background: var(--highlight);
    border-color: var(--highlight);
    color: white;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.filter-actions button {
    flex: 1;
}

/* Map */
#map {
    flex: 1;
    width: 100%;
    max-width: 100%;
    height: 100%;
    z-index: 1;
    min-height: 0;
    min-width: 0;
    position: relative;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.leaflet-container {
    background: #0a1929;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    margin: 0;
    padding: 0;
}

/* Custom marker styles */
.station-marker {
    background: var(--success);
    border: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
}

.station-marker:hover {
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.9);
}

/* Map Controls - Floating Button */
.map-controls {
    position: fixed;
    bottom: 20px; /* Default: bottom-right of map when no station playing */
    right: 20px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: bottom 0.3s ease;
}

/* Float above player when station is playing - Desktop */
@media (min-width: 769px) {
    body.player-visible .map-controls {
        bottom: 160px !important; /* Increased from 140px and added !important to ensure it applies */
    }
}

/* Raise floating buttons even more when player is visible on mobile */
@media (max-width: 768px) {
    body.player-visible .map-controls {
        bottom: 200px;
    }
}

.floating-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 70px;
    height: 70px;
    padding: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--highlight) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(15, 52, 96, 0.5);
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(15, 52, 96, 0.7);
}

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

.floating-btn .btn-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.floating-btn .btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Quality toggle specific styling */
.quality-toggle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.quality-toggle .btn-label {
    color: #000000;
}

.quality-toggle:hover {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

/* Player */
.player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary-bg);
    border-top: 3px solid var(--accent);
    box-shadow: 0 -4px 20px var(--shadow);
    z-index: 1000;
    transition: all 0.3s ease;
}

.player.hidden {
    transform: translateY(100%);
}

.player-content {
    padding: 1.5rem;
    max-width: 100%;
    position: relative;
}

/* Close Player Button - Top Right */
.close-player-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(233, 69, 96, 0.9);
    border: 2px solid var(--highlight);
    border-radius: 8px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(233, 69, 96, 0.5);
    z-index: 10;
}

.close-player-btn:hover {
    background: var(--highlight);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.7);
}

.close-player-btn .close-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.close-player-btn .close-text {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .close-player-btn {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .close-player-btn .close-icon {
        font-size: 1.1rem;
    }

    .close-player-btn .close-text {
        font-size: 0.75rem;
    }
}

.station-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.station-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.heart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.heart-btn:hover {
    transform: scale(1.2);
}

.heart-btn.active .heart {
    filter: hue-rotate(0deg);
}

.share-btn {
    background: rgba(var(--primary-rgb), 0.1);
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 1.2rem;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

.share-btn .share-icon {
    line-height: 1;
}

.station-details {
    flex: 1;
    min-width: 0;
    padding-right: 100px; /* Space for close button on the right */
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.station-details:hover {
    opacity: 0.8;
}

.station-details:active {
    opacity: 0.6;
}

.station-details h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.station-details p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .station-details {
        padding-right: 90px; /* Slightly less space on mobile */
    }
}

/* Player Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.play-btn {
    background: var(--highlight);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.volume-icon {
    font-size: 1.2rem;
}

#volumeSlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
    outline: none;
    -webkit-appearance: none;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 217, 255, 0.5);
}

#volumeSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success);
    cursor: pointer;
    border: none;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--highlight);
}

/* Loading */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    color: var(--success);
    font-size: 0.9rem;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--accent);
    border-top-color: var(--success);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Favorites Panel */
.favorites-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: var(--secondary-bg);
    box-shadow: -4px 0 20px var(--shadow);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.favorites-panel.hidden {
    transform: translateX(100%);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--accent);
}

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

.favorites-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.95rem;
}

.favorite-item {
    background: var(--accent);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorite-item:hover {
    background: var(--highlight);
    transform: translateX(-5px);
}

.favorite-item-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.favorite-item-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.remove-fav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.remove-fav-btn:hover {
    opacity: 1;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center toasts and prevent stretching */
    gap: 10px;
    pointer-events: none;
    max-width: 90%;
}

/* Individual Toast */
.toast {
    background: var(--secondary-bg);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--success);
    white-space: nowrap;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease;
    max-width: 400px;
    width: fit-content; /* Maintain natural width based on content */
    flex-shrink: 0; /* Prevent shrinking when container recalculates */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Welcome Toast - Larger and allows wrapping */
.toast.toast-welcome {
    max-width: 600px;
    white-space: normal;
    font-size: 1.1rem;
    padding: 1.25rem 2rem;
    text-align: center;
    line-height: 1.5;
}

.toast.toast-leaving {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* Modal Base Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

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

/* Confirmation Modal */
.confirm-modal {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.confirm-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.confirm-modal p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-buttons .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 100px;
}

.confirm-buttons .btn.secondary {
    background: var(--primary-bg);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.confirm-buttons .btn.secondary:hover {
    background: var(--secondary-bg);
    border-color: var(--primary);
}

.confirm-buttons .btn.danger {
    background: var(--highlight);
    color: white;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

.confirm-buttons .btn.danger:hover {
    background: #d93e60;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.5);
    transform: translateY(-2px);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        bottom: 140px;
        gap: 0.75rem;
    }

    .control-btn {
        width: 100%;
        justify-content: center;
    }

    .btn-text {
        display: inline;
    }

    .favorites-panel {
        max-width: 100%;
    }

    .player-content {
        padding: 1rem;
    }

    .station-details h2 {
        font-size: 1rem;
    }
}

@media (min-width: 769px) {
    .btn-text {
        display: inline;
    }
}

/* Popup customization */
.leaflet-popup-content-wrapper {
    background: var(--secondary-bg);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
}

.popup-station {
    padding: 1rem;
}

.popup-station h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.popup-station p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.popup-play-btn {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--highlight);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-play-btn:hover {
    background: var(--success);
    transform: scale(1.05);
}

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

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    /* Capture all pointer/mouse events to prevent map interaction */
    pointer-events: all;
    /* Note: touch-action blocking is handled via targeted JS to allow button clicks */
}

.auth-modal.hidden {
    display: none;
}

.auth-modal-content {
    background: var(--secondary-bg);
    border-radius: 20px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--accent);
}

.auth-modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-modal-content > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-form > p,
.auth-choice > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.auth-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border: 2px solid var(--accent);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Official Google Sign-In Button */
.google-signin-btn {
    width: 100%;
    padding: 12px 24px;
    background: white;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Roboto', Arial, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
}

.google-signin-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px 0 rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15);
}

.google-signin-btn:active {
    background: #f1f3f4;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
}

.google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.google-btn-text {
    font-size: 14px;
    letter-spacing: 0.25px;
}

.auth-btn.primary {
    background: var(--success);
    border-color: var(--success);
    color: var(--primary-bg);
}

.auth-btn.primary:hover {
    background: var(--highlight);
    border-color: var(--highlight);
    color: white;
}

.auth-btn.secondary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-primary);
}

.auth-btn.secondary:hover {
    background: var(--secondary-bg);
    border-color: var(--success);
    color: var(--success);
}

.back-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    text-align: left;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--success);
}

.auth-choice, .auth-form {
    animation: fadeIn 0.3s ease;
}

.auth-choice.hidden, .auth-form.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-icon {
    font-size: 1.3rem;
}

.auth-input {
    width: 100%;
    padding: 1rem;
    background: var(--accent);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.auth-input:focus {
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

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

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}

.login-prompt {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--accent);
    border-radius: 12px;
    margin: 1rem;
    border: 2px dashed var(--border);
}

.login-prompt p {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.login-btn {
    background: var(--success);
    color: var(--primary-bg);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: var(--highlight);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.divider {
    position: relative;
    text-align: center;
    margin: 0.5rem 0;
}

.divider span {
    background: var(--secondary-bg);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent);
}

.auth-note {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1.5rem;
    font-style: italic;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 1rem;
}

/* Menu Icon */
.menu-icon {
    font-size: 1.4rem;
}

/* Menu Panel */
.menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background: var(--secondary-bg);
    box-shadow: -4px 0 20px var(--shadow);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.menu-panel.hidden {
    transform: translateX(100%);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--accent);
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.5), rgba(22, 33, 62, 0.5));
}

.menu-header h2 {
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.menu-section {
    padding: 0.5rem 1rem;
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--accent);
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.user-avatar {
    font-size: 1.5rem;
}

#menuUserName {
    font-weight: 600;
    color: var(--text-primary);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: var(--accent);
}

.menu-item-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: var(--accent);
    margin: 0.75rem 1rem;
}

/* Toggle Switch in Menu */
.menu-toggle {
    justify-content: space-between;
    cursor: pointer;
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--accent);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.menu-toggle input:checked + .toggle-slider {
    background: var(--success);
}

.menu-toggle input:checked + .toggle-slider::after {
    left: 25px;
    background: white;
}

.menu-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--accent);
    text-align: center;
}

.menu-footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.menu-footer .version {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Menu Panel Mobile */
@media (max-width: 480px) {
    .menu-panel {
        max-width: 100%;
    }
}

/* Passport Panel */
.passport-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    background: var(--secondary-bg);
    box-shadow: -4px 0 20px var(--shadow);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.passport-panel.hidden {
    transform: translateX(100%);
}

.passport-intro {
    padding: 1.5rem;
    border-bottom: 2px solid var(--accent);
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.5), rgba(22, 33, 62, 0.5));
}

.passport-intro p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.passport-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Passport Book Container */
.passport-book {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.passport-pages {
    width: 100%;
    max-width: 450px;
    min-height: 500px;
    background: linear-gradient(145deg, #f5f0e8, #e8dcc8);
    border-radius: 8px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: transform 0.3s ease;
}

.passport-pages.flip-next {
    animation: flipNext 0.3s ease-out;
}

.passport-pages.flip-prev {
    animation: flipPrev 0.3s ease-out;
}

@keyframes flipNext {
    0% { transform: perspective(1000px) rotateY(0deg); }
    50% { transform: perspective(1000px) rotateY(-10deg); }
    100% { transform: perspective(1000px) rotateY(0deg); }
}

@keyframes flipPrev {
    0% { transform: perspective(1000px) rotateY(0deg); }
    50% { transform: perspective(1000px) rotateY(10deg); }
    100% { transform: perspective(1000px) rotateY(0deg); }
}

/* Page Navigation */
.page-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: var(--text-primary);
    border: 2px solid var(--success);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-nav:hover:not(:disabled) {
    background: var(--success);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

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

.page-nav.prev {
    left: 0.5rem;
}

.page-nav.next {
    right: 0.5rem;
}

.page-indicator {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Passport Pages */
.passport-page {
    width: 100%;
    height: 100%;
    min-height: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #333;
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 3rem;
}

/* Cover Page */
.cover-page {
    background: linear-gradient(145deg, #f5f0e8, #e8dcc8);
}

.passport-cover {
    text-align: center;
}

.passport-emblem {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: grayscale(100%) opacity(0.4);
}

.passport-title {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.passport-subtitle {
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: #666;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.passport-holder {
    border: 3px solid #333;
    padding: 1.5rem;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.3);
}

.holder-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: #666;
    margin-bottom: 0.5rem;
}

.holder-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.passport-intro-text {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #444;
    margin: 2rem 0;
    text-align: justify;
    padding: 0 1rem;
}

.passport-intro-text p {
    margin-bottom: 0.8rem;
    color: #444;
}

.passport-seal {
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 1.5rem;
    color: #666 !important;
    font-size: 0.7rem !important;
}

.passport-stamp-count {
    margin-top: 2rem;
}

.count-box {
    border: 2px solid #333;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.3);
}

.count-number {
    font-size: 3rem;
    font-weight: 900;
    color: #1a1a1a;
    font-family: 'Courier New', monospace;
}

.count-label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: #666;
    text-transform: uppercase;
}

/* Stamp Page */
.stamp-page {
    background: linear-gradient(145deg, #f5f0e8, #e8dcc8);
}

.stamp-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Black Rubber Stamp Effect */
.rubber-stamp {
    position: relative;
    padding: 2rem;
    text-align: center;
    transform: rotate(-3deg);
    filter:
        drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.2))
        drop-shadow(-1px -1px 1px rgba(0, 0, 0, 0.1));
}

.rubber-stamp::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 4px solid rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    transform: scale(1.1);
}

.stamp-flag {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    filter: grayscale(100%) brightness(0.3);
    mix-blend-mode: multiply;
}

.stamp-country {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    margin-bottom: 0.3rem;
    font-family: 'Courier New', monospace;
    mix-blend-mode: multiply;
}

.stamp-date {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 0.7);
    text-transform: uppercase;
    mix-blend-mode: multiply;
}

.stamp-code {
    position: absolute;
    bottom: -0.5rem;
    right: 1rem;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: rgba(0, 0, 0, 0.6);
    font-family: 'Courier New', monospace;
    mix-blend-mode: multiply;
}

/* Listening Details */
.listening-details {
    width: 100%;
    border-top: 2px solid rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
    padding: 1rem 0;
}

.detail-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
}

.detail-line:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #666;
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
}

/* Passport Teaser (Not Logged In) */
.passport-teaser {
    text-align: center;
    padding: 3rem 2rem;
    padding-bottom: 6rem; /* Extra bottom padding to prevent cutoff on mobile when login prompt shows */
    color: var(--text-primary);
}

.teaser-emblem {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    filter: grayscale(0);
}

.teaser-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.teaser-text {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.teaser-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.teaser-feature {
    background: var(--accent);
    padding: 1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    border: 1px solid var(--success);
    transition: all 0.3s ease;
}

.teaser-feature:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 217, 255, 0.3);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .passport-panel {
        max-width: 100%;
    }

    .passport-book {
        padding: 1rem 0.5rem;
    }

    .passport-pages {
        max-width: 100%;
        min-height: 450px;
    }

    .passport-page {
        min-height: 450px;
        padding: 1.5rem;
    }

    .passport-title {
        font-size: 1.5rem;
    }

    .holder-name {
        font-size: 1.2rem;
    }

    .passport-intro-text {
        font-size: 0.7rem;
        padding: 0 0.5rem;
    }

    .stamp-flag {
        font-size: 4rem;
    }

    .stamp-country {
        font-size: 1.1rem;
    }

    .page-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .teaser-title {
        font-size: 1.4rem;
    }

    .teaser-text {
        font-size: 0.9rem;
    }

    .passport-teaser {
        padding: 2rem 1.5rem;
        padding-bottom: 8rem; /* Extra bottom padding on mobile to prevent cutoff when login prompt shows */
    }
}

/* Install Prompt Banner */
.install-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(150px);
    background: var(--secondary-bg);
    border: 2px solid var(--success);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.3);
    z-index: 9999;
    max-width: 450px;
    width: calc(100% - 2rem);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.install-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
}

.install-banner-icon {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.install-banner-text {
    flex: 1;
}

.install-banner-text strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.install-banner-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.install-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.install-btn-primary,
.install-btn-secondary {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.install-btn-primary {
    background: linear-gradient(135deg, var(--success), var(--highlight));
    color: white;
}

.install-btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.4);
}

.install-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--accent);
}

.install-btn-secondary:hover {
    background: var(--accent);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .install-banner {
        bottom: 70px;
        max-width: calc(100% - 1rem);
    }

    .install-banner-content {
        padding: 1rem;
        gap: 0.75rem;
    }

    .install-banner-icon {
        font-size: 2rem;
    }

    .install-banner-text strong {
        font-size: 1rem;
    }

    .install-banner-text p {
        font-size: 0.85rem;
    }
}

/* Privacy Notice */
.privacy-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--secondary-bg), var(--primary-bg));
    border-top: 2px solid var(--success);
    box-shadow: 0 -4px 30px rgba(0, 217, 255, 0.2);
    z-index: 10000;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.4s ease;
}

.privacy-notice.visible {
    opacity: 1;
    transform: translateY(0);
}

.privacy-notice-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.privacy-notice-greeting {
    margin-bottom: 1rem;
    text-align: center;
}

.privacy-notice-greeting h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.privacy-notice-content p {
    margin: 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
}

.privacy-notice-content p strong {
    color: var(--text-primary);
}

.privacy-notice-content a {
    color: var(--success);
    text-decoration: none;
    font-weight: 600;
}

.privacy-notice-content a:hover {
    text-decoration: underline;
}

.privacy-notice-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.25rem;
}

.analytics-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.analytics-consent-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.analytics-consent-label span {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Hide mobile-only line breaks on larger screens */
.mobile-only {
    display: none;
}

@media (max-width: 480px) {
    .mobile-only {
        display: inline;
    }
}

.privacy-accept-btn {
    padding: 0.85rem 2.5rem;
    background: linear-gradient(135deg, var(--success), var(--highlight));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.privacy-accept-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.5);
}

@media (max-width: 768px) {
    .privacy-notice-content {
        padding: 1.5rem 1rem;
    }

    .privacy-notice-greeting h3 {
        font-size: 1.3rem;
    }

    .privacy-notice-content p {
        font-size: 0.9rem;
    }

    .privacy-accept-btn {
        width: 100%;
        padding: 1rem;
    }
}
