/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

/* Full-Screen Map */
#map {
    position: absolute;
    top: 60px; /* Position below navbar */
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    z-index: 1;
}

/* Custom Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.leaflet-popup-content {
    margin: 16px;
}

.bar-popup-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #1f2937; /* Charcoal */
}

.bar-popup-address {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    font-size: 14px;
    color: #666;
}

.loading-indicator.active {
    display: block;
}

/* Custom Bar Icon (Emoji) */
.custom-bar-icon {
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bar-icon-bg {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    border: 2.5px solid rgba(255, 152, 0, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bar-icon {
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.custom-bar-icon:hover .bar-icon-bg {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 152, 0, 0.9);
}

/* Gray out bars without any active taps */
.bar-no-taps .bar-icon-bg {
    border-color: rgba(160, 160, 160, 0.5);
    background: rgba(245, 245, 245, 0.88);
}

.bar-no-taps .bar-icon {
    filter: grayscale(100%);
    opacity: 0.55;
}

.bar-no-taps:hover .bar-icon-bg {
    border-color: rgba(160, 160, 160, 0.7);
}

.bar-no-taps:hover .bar-icon {
    filter: grayscale(50%);
    opacity: 0.75;
}

/* Active marker highlighting */
.marker-active .bar-icon-bg {
    transform: scale(1.3);
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.5);
    border-color: #ff9800;
}

.marker-active.bar-no-taps .bar-icon-bg {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(150, 150, 150, 0.4);
    border-color: rgba(160, 160, 160, 0.7);
}

.marker-active.bar-no-taps .bar-icon {
    filter: grayscale(80%);
    opacity: 0.65;
}

/* Disable transitions during zoom to prevent marker drift */
.leaflet-zoom-anim .bar-icon,
.leaflet-zoom-anim .bar-icon-bg,
.leaflet-zoom-anim .cluster-icon {
    transition: none !important;
}

/* Hover tooltip for markers */
.marker-hover-tooltip {
    position: fixed;
    background: rgba(17, 24, 39, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
}

/* Cluster Icon Styling */
.custom-cluster-icon {
    background: transparent !important;
    border: none !important;
}

.cluster-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 50%;
    box-shadow: 0 3px 12px rgba(255, 152, 0, 0.4);
    border: 3px solid white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cluster-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.6);
}

.cluster-emoji {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 1px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.cluster-count {
    font-size: 12px;
    font-weight: bold;
    color: white;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Override marker cluster default styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: transparent !important;
}

/* Style for clusters containing only bars with no taps */
.cluster-no-taps .cluster-icon {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    box-shadow: 0 3px 12px rgba(160, 160, 160, 0.3);
    border-color: rgba(245, 245, 245, 0.9);
}

.cluster-no-taps .cluster-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(160, 160, 160, 0.4);
}

.cluster-no-taps .cluster-emoji {
    filter: grayscale(100%) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
    opacity: 0.65;
}

.cluster-no-taps .cluster-count {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Quick-Info-Card Styles */
.quick-info-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.quick-info-popup .leaflet-popup-content {
    margin: 0;
    width: 340px !important;
}

.quick-info-card {
    display: flex;
    flex-direction: column;
}

/* Header Section */
.quick-info-header {
    padding: 16px 16px 12px 16px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.quick-info-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.quick-info-title-link {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s;
}

.quick-info-title-link:hover {
    color: #f59e0b;
}

.quick-info-address {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* Opening Hours - compact single line */
.quick-info-opening-hours {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    padding: 10px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.opening-hours-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.opening-hours-label {
    font-weight: 600;
    color: #374151;
    flex-shrink: 0;
}

.opening-hours-text {
    font-weight: 500;
    color: #4b5563;
    line-height: 1.4;
}

/* Body / Tap List Section */
.quick-info-body {
    padding: 0 16px 8px 16px;
}

/* Section Header */
.quick-info-section-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    padding: 14px 0 8px 0;
}

/* Tap List */
.quick-info-taps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tap-item {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

/* Beer image - right side, full row height, rounded corners */
.tap-image {
    width: 56px;
    min-height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    align-self: stretch;
    border: 1px solid #e5e7eb;
}

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

.tap-item.tap-downvoted {
    opacity: 0.65;
}

.tap-item.tap-downvoted .tap-name,
.tap-item.tap-downvoted .tap-time {
    color: #9ca3af;
}

.tap-item.tap-pending {
    opacity: 0.55;
}

.tap-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    margin-top: 6px;
}

.tap-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.tap-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.tap-emoji {
    font-size: 16px;
    flex-shrink: 0;
}

.tap-name {
    font-size: 15px;
    font-weight: 600;
    color: #464a53;
    line-height: 1.4;
}

.tap-beer-type {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.tap-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    padding-left: 22px;
}

.tap-meta-sep {
    color: #d1d5db;
    font-size: 10px;
}

.tap-price {
    font-weight: 700;
    color: #6b7280;
    font-size: 13px;
}

.tap-time {
    color: #9ca3af;
    white-space: nowrap;
    font-size: 13px;
}

/* Voting Buttons (replaces floating confirm buttons) */
.tap-voting {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    padding-left: 22px;
}

.tap-voting-readonly {
    opacity: 0.7;
}

.tap-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #e5e7eb;
    background: white;
    color: #4b5563;
    line-height: 1;
}

.tap-vote-btn.tap-vote-disabled {
    cursor: default;
}

.tap-vote-icon {
    font-weight: 700;
    font-size: 11px;
}

.tap-vote-count {
    font-weight: 600;
    color: #6b7280;
}

.tap-vote-yes:hover:not(.tap-vote-disabled) {
    background: #ecfdf5;
    border-color: #10b981;
    color: #059669;
}

.tap-vote-yes:hover:not(.tap-vote-disabled) .tap-vote-count {
    color: #059669;
}

.tap-vote-no:hover:not(.tap-vote-disabled) {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}

.tap-vote-no:hover:not(.tap-vote-disabled) .tap-vote-count {
    color: #dc2626;
}

.tap-vote-btn.tap-confirm-active {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.tap-vote-btn.tap-vote-anon {
    border-style: dashed;
    opacity: 0.7;
}

.tap-vote-btn.tap-vote-anon:hover {
    opacity: 1;
    border-color: #f59e0b;
    color: #d97706;
}

.quick-info-no-taps {
    text-align: center;
    padding: 20px 16px;
    font-size: 13px;
    color: #9ca3af;
    font-style: normal;
    background: transparent;
    border: 1px dashed #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Inline confirm row (photo + send) */
.tap-confirm-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: slideDown 0.15s ease-out;
}

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

.tap-confirm-photo-label {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.tap-confirm-photo-label:hover {
    background: #dcfce7;
}

.tap-confirm-photo-name {
    font-size: 12px;
    color: #9ca3af;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tap-confirm-photo-name.has-file {
    color: #059669;
}

.tap-confirm-send {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    background: #10b981;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.tap-confirm-send:hover {
    background: #059669;
}

.tap-confirm-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tap-confirm-cancel {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    flex-shrink: 0;
}

.tap-confirm-cancel:hover {
    color: #6b7280;
}

/* Footer - Fixed Action Buttons */
.quick-info-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.quick-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.quick-info-btn .btn-icon {
    font-size: 16px;
}

/* Primary: Add Beer (green) */
.quick-info-btn-add {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.quick-info-btn-add:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.quick-info-btn-add:active {
    transform: translateY(0);
    background: #047857;
}

/* Secondary: Navigate (dark) */
.quick-info-btn-navigate {
    background: #1f2937;
    color: white;
    box-shadow: 0 2px 6px rgba(31, 41, 55, 0.2);
}

.quick-info-btn-navigate:hover {
    background: #374151;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(31, 41, 55, 0.3);
}

.quick-info-btn-navigate:active {
    transform: translateY(0);
    background: #111827;
}

/* Loading and Error States */
.quick-info-loading,
.quick-info-error {
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.quick-info-error {
    color: #ef4444;
}

.quick-info-login-prompt {
    margin: 16px 0;
    padding: 12px;
    background: transparent;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 400;
}

/* Route Info Panel */
.route-info-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
}

.route-info-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 12px;
}

.route-info-details {
    display: flex;
    gap: 14px;
    align-items: center;
}

.route-info-distance,
.route-info-duration {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
}

.route-info-loading {
    font-size: 0.9rem;
    color: #6b7280;
}

.route-info-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.route-info-close:hover {
    background: #f3f4f6;
    color: #4b5563;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    /* Fullscreen map on mobile - map fills entire viewport behind floating search bar */
    html, body {
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
        background: #c8d7c5; /* Match OSM map background to prevent grey bars on notched iPhones */
    }

    body {
        position: fixed;
        width: 100%;
        height: 100%;
    }

    #map {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 0;
    }

    .loading-indicator {
        top: calc(76px + env(safe-area-inset-top, 0px));
    }

    /* Push Leaflet controls below floating search bar + notch */
    .leaflet-top {
        top: calc(72px + env(safe-area-inset-top, 0px));
    }

    .bar-icon-bg {
        width: 36px;
        height: 36px;
        border-width: 2px;
    }

    .bar-icon {
        font-size: 20px;
    }

    .cluster-emoji {
        font-size: 16px;
    }

    .cluster-count {
        font-size: 10px;
    }

    /* Quick-Info-Card Mobile Adjustments */
    .quick-info-popup .leaflet-popup-content {
        width: 300px !important;
    }

    .quick-info-card {
        max-height: calc(100dvh - 140px);
    }

    .quick-info-header {
        padding: 14px 14px 10px 14px;
        flex-shrink: 0;
    }

    .quick-info-title {
        font-size: 18px;
    }

    .quick-info-address {
        font-size: 12px;
    }

    .quick-info-body {
        padding: 0 14px 6px 14px;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .tap-name {
        font-size: 13px;
    }

    .tap-image {
        width: 48px;
        min-height: 48px;
    }

    .tap-meta {
        font-size: 12px;
        padding-left: 20px;
    }

    .tap-voting {
        padding-left: 20px;
        gap: 6px;
    }

    .tap-vote-btn {
        padding: 3px 8px;
        font-size: 11px;
    }

    .quick-info-opening-hours {
        flex-shrink: 0;
    }

    .quick-info-footer {
        padding: 10px 14px 14px 14px;
        flex-shrink: 0;
    }

    .quick-info-btn {
        font-size: 13px;
        padding: 10px 14px;
    }
}
