/* 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 {
    font-size: 36px;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.custom-bar-icon:hover .bar-icon {
    transform: scale(1.1);
}

/* Active marker highlighting */
.marker-active .bar-icon {
    transform: scale(1.3);
    filter: drop-shadow(0 0 8px rgba(255, 152, 0, 0.8));
}

/* Disable transitions during zoom to prevent marker drift */
.leaflet-zoom-anim .bar-icon,
.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;
}

/* Quick-Info-Card Styles */
.quick-info-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

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

/* Content Section */
.quick-info-content {
    padding: 20px;
}

.quick-info-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937; /* Charcoal */
    margin: 0 0 4px 0;
    line-height: 1.3;
}

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

.quick-info-title-link:hover {
    color: #f59e0b; /* Golden Amber */
    text-decoration: underline;
}

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

/* Tap List */
.quick-info-taps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.tap-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    gap: 12px;
}

.tap-item:last-child {
    margin-bottom: 0;
}

.tap-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.tap-item.tap-stale {
    opacity: 0.7;
}

.tap-item.tap-stale .tap-name,
.tap-item.tap-stale .tap-time {
    font-style: italic;
    color: #999;
}

.tap-item.tap-pending {
    opacity: 0.55;
    border-style: dashed;
    border-color: #d1d5db;
    background: #f3f4f6;
}

.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;
}

/* Tap Image */
.tap-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

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

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

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

.tap-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.tap-status-pill.status-available {
    background: #ecfdf5;
    color: #059669;
}

.tap-status-pill.status-low {
    background: #fffbeb;
    color: #d97706;
}

.tap-status-pill.status-empty {
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
}

.tap-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937; /* Charcoal */
    line-height: 1.4;
}

.tap-beer-type {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    display: block;
    margin-top: 2px;
}

.tap-price {
    font-weight: 700;
    color: #1f2937; /* Charcoal */
    font-size: 14px;
}

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

.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: 20px;
}

/* Tap Action Buttons (Add/Confirm) */
.tap-action-btn-add {
    width: 100%;
    margin-bottom: 12px;
}

/* Quick confirm/deny buttons */
.tap-confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    align-self: center;
}

.tap-confirm-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tap-confirm-btn:hover {
    transform: scale(1.1);
}

.tap-confirm-yes:hover {
    background: #ecfdf5;
    border-color: #10b981;
}

.tap-confirm-no:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.tap-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

/* Confirmation score badge */
.tap-score {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #6b7280;
}

.tap-score.score-positive {
    background: #ecfdf5;
    color: #059669;
}

.tap-score.score-negative {
    background: #fef2f2;
    color: #dc2626;
}

/* 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;
}

/* Action Buttons */
.quick-info-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.quick-info-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    background: white;
    color: #4b5563; /* Slate Grey */
}

.quick-info-btn-navigate {
    background: #1f2937; /* Charcoal */
    color: white;
    border-color: #1f2937;
}

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

/* 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;
}

/* Add Beer Section */
.quick-info-add-section {
    margin: 20px 0 16px 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.tap-action-btn-large {
    width: 100%;
    padding: 12px 16px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: center;
    border: none !important;
    background: #10b981 !important; /* Fresh Hop - solid color */
    color: white !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.tap-action-btn-large:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    background: #059669 !important;
}

.tap-action-btn-large:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
    background: #047857 !important;
}

.tap-action-btn-large .btn-icon {
    font-size: 18px;
}

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

/* 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 {
        font-size: 24px;
    }

    .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-content {
        padding: 16px;
    }

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

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

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

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

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

    .tap-item {
        flex-wrap: wrap;
    }

    .tap-confirm-buttons {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid #e5e7eb;
    }

    .tap-confirm-btn {
        width: 36px;
        height: 32px;
        font-size: 16px;
    }

    .tap-action-btn-large {
        padding: 9px 14px !important;
        font-size: 13px !important;
    }

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