/* Reset and global variables - Rome Bag Storage */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Official Rome Bag Storage colors */
    --primary: #176391;
    --primary-dark: #0d4a6e;
    --primary-light: #1e7bb0;
    --accent: #FCDF03;
    --accent-dark: #e5c900;
    --accent-light: #fff033;
    --white: #FFFFFF;
    --background: #f0f4f7;
    --surface: #FFFFFF;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-light: #718096;
    --border: #e2e8f0;
    --success: #10b981;
    --shadow-sm: 0 2px 4px rgba(23, 99, 145, 0.1);
    --shadow-md: 0 4px 12px rgba(23, 99, 145, 0.15);
    --shadow-lg: 0 8px 32px rgba(23, 99, 145, 0.2);
    --shadow-xl: 0 16px 48px rgba(23, 99, 145, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body, html {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    height: 100%;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Full-screen map */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    animation: bounce 1.2s ease-in-out infinite;
}

.loading-logo {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.loading-overlay p {
    color: var(--white);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

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

/* ===== SHOP MARKERS (original RBS logo image + pointer + pulse) ===== */
.shop-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.shop-marker {
    position: relative;
    width: 56px;
    height: 72px;
    cursor: pointer;
    filter: drop-shadow(0 4px 12px rgba(23, 99, 145, 0.4));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.shop-marker:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 6px 16px rgba(23, 99, 145, 0.5));
}

.shop-marker-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--accent);
}

.shop-marker-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-marker-pointer {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid var(--primary);
}

.shop-marker-pulse {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.5;
    animation: shopPulse 2s ease-in-out infinite;
}

@keyframes shopPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translateX(-50%) scale(2.5);
        opacity: 0;
    }
}

/* ===== LANDMARK MARKERS (subtle, black & white) ===== */
.landmark-marker-container {
    background: transparent !important;
    border: none !important;
}

.landmark-marker {
    width: 32px;
    height: 32px;
    background: var(--white);
    border: 2px solid #444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    filter: grayscale(100%);
    opacity: 0.85;
}

.landmark-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: grayscale(50%);
    opacity: 1;
}

.landmark-emoji {
    font-size: 16px;
    line-height: 1;
}

/* Landmark tooltip */
.landmark-tooltip-wrapper {
    background: #333 !important;
    color: var(--white) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    white-space: nowrap !important;
}

.landmark-tooltip-wrapper::before {
    border-top-color: #333 !important;
}

/* ===== POPUP STYLES ===== */
.custom-popup {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    min-width: 340px;
    max-width: 380px;
    border: 2px solid var(--primary);
}

.popup-header {
    background: var(--primary);
    color: var(--white);
    padding: 18px 20px;
    text-align: center;
    position: relative;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
}

.popup-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.popup-zona {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    margin-top: 4px;
}

.popup-body {
    padding: 16px 18px;
    background: var(--white);
}

.popup-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.detail-icon-wrapper {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.detail-content {
    flex: 1;
    min-width: 0;
}

.detail-label {
    font-size: 10px;
    color: var(--text-light);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

/* Landmarks section in popup */
.landmarks-section {
    background: var(--background);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--border);
}

.landmarks-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.landmarks-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.landmark-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    background: var(--white);
    border-radius: var(--radius-sm);
    font-size: 11px;
    min-width: 0;
}

.landmark-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.landmark-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.landmark-distance {
    color: var(--primary);
    font-weight: 700;
    font-size: 10px;
    background: rgba(23, 99, 145, 0.1);
    padding: 2px 5px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Popup footer and buttons */
.popup-footer {
    padding: 12px 18px 18px;
    background: var(--white);
}

.popup-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.book-btn,
.directions-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.book-btn {
    background: var(--accent);
    color: var(--primary-dark);
    border-color: var(--accent);
}

.book-btn:hover,
.book-btn:active {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

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

.directions-btn:hover,
.directions-btn:active {
    background: var(--primary);
    color: var(--white);
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(23, 99, 145, 0.2);
    user-select: none;
}

.share-btn:hover,
.share-btn:active {
    background: var(--background);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: calc(100% - 40px);
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}

.leaflet-popup-tip-container {
    display: none !important;
}

.leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--white) !important;
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding: 0 !important;
    transition: background 0.2s ease !important;
}

.leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.4) !important;
    color: var(--white) !important;
}

/* Zoom controls styling */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    color: var(--primary) !important;
    background: var(--white) !important;
    border: none !important;
}

.leaflet-control-zoom a:hover {
    background: var(--background) !important;
    color: var(--primary-dark) !important;
}

.leaflet-control-zoom-in {
    border-bottom: 1px solid var(--border) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Shop markers on mobile */
    .shop-marker {
        width: 48px;
        height: 64px;
    }
    
    .shop-marker-image {
        width: 48px;
        height: 48px;
        border-radius: 6px;
    }
    
    .shop-marker-pointer {
        bottom: 6px;
        border-left-width: 8px;
        border-right-width: 8px;
        border-top-width: 10px;
    }
    
    .shop-marker-pulse {
        width: 12px;
        height: 12px;
    }
    
    /* Smaller landmark markers on mobile */
    .landmark-marker {
        width: 28px;
        height: 28px;
    }
    
    .landmark-emoji {
        font-size: 14px;
    }
    
    /* Popup mobile optimization */
    .custom-popup {
        min-width: 280px;
        max-width: calc(100vw - 40px);
        border-width: 2px;
    }
    
    .popup-header {
        padding: 14px 16px;
    }
    
    .popup-header h3 {
        font-size: 14px;
    }
    
    .popup-zona {
        font-size: 12px;
    }
    
    .popup-body {
        padding: 14px 16px;
    }
    
    .popup-footer {
        padding: 10px 16px 16px;
    }
    
    .popup-buttons {
        gap: 6px;
    }
    
    .book-btn,
    .directions-btn {
        padding: 11px 8px;
        font-size: 11px;
        gap: 4px;
    }
    
    .btn-icon {
        width: 14px;
        height: 14px;
    }
    
    .share-btn {
        padding: 9px 12px;
        font-size: 11px;
    }
    
    .detail-item {
        padding: 8px 10px;
        gap: 10px;
    }
    
    .detail-icon-wrapper {
        width: 32px;
        height: 32px;
    }
    
    .detail-icon {
        width: 16px;
        height: 16px;
    }
    
    .detail-label {
        font-size: 9px;
    }
    
    .detail-value {
        font-size: 12px;
    }
    
    .landmarks-section {
        padding: 10px;
    }
    
    .landmarks-title {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .landmarks-list {
        gap: 4px;
    }
    
    .landmark-item {
        padding: 5px 6px;
        gap: 4px;
        font-size: 10px;
    }
    
    .landmark-icon {
        font-size: 12px;
        width: 16px;
    }
    
    .landmark-distance {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .toast {
        bottom: 80px;
        padding: 10px 16px;
        font-size: 12px;
    }
    
    /* Better zoom controls on mobile */
    .leaflet-control-zoom {
        margin-bottom: 60px !important;
        margin-right: 10px !important;
    }
    
    .leaflet-control-zoom a {
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
        font-size: 20px !important;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .custom-popup {
        min-width: 260px;
    }
    
    .popup-header h3 {
        font-size: 13px;
    }
    
    .landmarks-list {
        grid-template-columns: 1fr;
    }
    
    .book-btn,
    .directions-btn {
        padding: 10px 6px;
        font-size: 10px;
    }
}

/* Safe area for iPhone notch */
@supports (padding: env(safe-area-inset-top)) {
    .toast {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .shop-marker:hover {
        transform: none;
        filter: drop-shadow(0 4px 12px rgba(23, 99, 145, 0.4));
    }
    
    .shop-marker:active {
        transform: scale(1.05);
    }
    
    .landmark-marker:hover {
        transform: none;
        filter: grayscale(100%);
    }
    
    .landmark-marker:active {
        transform: scale(1.1);
        filter: grayscale(50%);
    }
    
    .book-btn:hover,
    .directions-btn:hover,
    .share-btn:hover {
        transform: none;
    }
}
