
/* ========== STILE UNIFORME CON IL SITO ========== */

/* Reset e base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    /* 🎨 STESSO GRADIENT DEL SITO */
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 25%, #ffb347 50%, #ffd700 75%, #ff6b6b 100%);
    background-size: 400% 400%;
    animation: sunsetGradient 15s ease infinite;
    min-height: 100vh;
    color: #8b0000;
    position: relative;
    overflow-x: hidden;
}

/* 🎨 STESSO PATTERN DI SFONDO */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="30" r="8" fill="%23ffd700" opacity="0.3"/><circle cx="80" cy="70" r="6" fill="%23ff6b6b" opacity="0.2"/><circle cx="50" cy="20" r="4" fill="%23ffb347" opacity="0.4"/><circle cx="30" cy="80" r="5" fill="%23ffd700" opacity="0.3"/><circle cx="70" cy="40" r="3" fill="%23ff8e8e" opacity="0.2"/></svg>') repeat;
    pointer-events: none;
    z-index: -1;
}

@keyframes sunsetGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Screen overlays - STILE SITO */
.screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* Loading container */
.loading-container {
    text-align: center;
    color: white;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 235, 205, 0.95));
    padding: 3rem;
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(139, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    color: #8b0000;
}

.heart-loader {
    font-size: 4rem;
    animation: heartbeat 1.5s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Permission container - STILE SITO */
.permission-container {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 235, 205, 0.95));
    padding: 3rem;
    border-radius: 25px;
    text-align: center;
    max-width: 500px;
    margin: 0 1rem;
    box-shadow: 0 20px 40px rgba(139, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* 🚫 RIMUOVI COMPLETAMENTE QUESTO BLOCCO */
/*
.permission-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}
*/


/* 🔥 ANCHE LA KEYFRAME rotate NON SERVE PIÙ */
/*
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
*/


.permission-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    /* 🔥 RIMUOVI z-index: 2 */
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.permission-container h2 {
    color: #8b0000;
    margin-bottom: 1rem;
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    position: relative;
        /* 🔥 RIMUOVI z-index: 2 */

    text-shadow: 1px 1px 2px rgba(255, 215, 0, 0.3);
}

.permission-container p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
    position: relative;
    /* 🔥 RIMUOVI z-index: 2 */
}

.note {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

/* Error container - STILE SITO */
.error-container {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 235, 205, 0.95));
    padding: 3rem;
    border-radius: 25px;
    text-align: center;
    max-width: 500px;
    margin: 0 1rem;
    box-shadow: 0 20px 40px rgba(139, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-container h2 {
    color: #dc3545;
    margin-bottom: 1rem;
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
}

/* Buttons - STILE SITO */
.permission-btn, .retry-btn, .control-btn, .config-btn, .back-btn {
    background: linear-gradient(135deg, #8b0000, #dc143c);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.permission-btn:hover, .retry-btn:hover, .control-btn:hover, .config-btn:hover, .back-btn:hover {
    background: linear-gradient(135deg, #dc143c, #b22222);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(139, 0, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.7);
}

.control-btn.secondary {
    background: linear-gradient(135deg, #4169e1, #1e90ff);
}

.control-btn.secondary:hover {
    background: linear-gradient(135deg, #1e90ff, #0066cc);
}

/* Main interface */
#mapInterface {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header - STILE SITO */
.map-header {
    background: rgba(139, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    color: #8b0000;
    padding: 1rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    max-width: 1200px;
    margin: 0 auto 1rem auto;
}

.header-content h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    margin: 0;
    color: #8b0000;
    text-shadow: 2px 2px 4px rgba(255, 215, 0, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #8b0000;
}

#userHeart {
    font-size: 1.5rem;
    animation: heartbeat 2s ease-in-out infinite;
}

.map-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-link {
    color: #8b0000;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.3);
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 215, 0, 0.3);
    color: #8b0000;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
    width: 96% !important;
    min-height: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 235, 205, 0.1));
    border-radius: 20px;
    margin: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.leaflet-container {
    height: calc(100vh - 200px) !important; /*100% !important;*/
    width: 100%;
    background: rgba(255, 235, 205, 0.3);
    border-radius: 18px;
}

/* Footer - STILE SITO */
.map-footer {
    background: rgba(139, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    color: #8b0000;
    text-align: center;
    padding: 1rem;
    flex-shrink: 0;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.map-footer p {
    margin: 0.3rem 0;
}

.privacy-note {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Controlli zoom - Stile sito */
.leaflet-control-zoom {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 1000 !important;
    margin: 0 !important;
}

.leaflet-control-zoom a {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 235, 205, 0.95)) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.2) !important;
    color: #8b0000 !important;
    font-weight: bold !important;
    transition: all 0.3s ease !important;
}

.leaflet-control-zoom a:hover {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.3), rgba(255, 235, 205, 0.3)) !important;
    border-color: rgba(255, 215, 0, 0.7) !important;
    transform: scale(1.1) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .permission-container, .error-container {
        padding: 2rem;
        margin: 0 1rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .map-nav {
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
    }

    .map-container {
        margin: 0.5rem;
        border-radius: 15px;
    }

    .leaflet-control-zoom a {
        width: 40px !important;
        height: 40px !important;
        line-height: 38px !important;
        font-size: 22px !important;
    }

    .map-footer {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .permission-container, .error-container {
        padding: 1.5rem;
    }

    .permission-container h2, .error-container h2 {
        font-size: 2rem;
    }

    .permission-icon, .error-icon {
        font-size: 3rem;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    .control-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* Custom map markers - Stile sito */
.heart-marker {
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(2px 2px 4px rgba(139, 0, 0, 0.3));
    animation: heartbeat 2s ease-in-out infinite;
}

.custom-div-icon {
    background: transparent !important;
    border: none !important;
}

.heart-marker-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.heart-marker-content {
    font-size: 28px;
    text-align: center;
    line-height: 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(2px 2px 4px rgba(139, 0, 0, 0.7));
    position: relative;
}

.heart-marker-content::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    z-index: -1;
}

/* Pulsanti genere - Stile sito */
.man-btn {
    background: linear-gradient(135deg, #4169e1, #1e90ff) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    color: white !important;
}

.man-btn:hover {
    background: linear-gradient(135deg, #1e90ff, #0066cc) !important;
    border-color: rgba(255, 215, 0, 0.7) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(65, 105, 225, 0.4) !important;
}

.woman-btn {
    background: linear-gradient(135deg, #dc143c, #b22222) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    color: white !important;
}

.woman-btn:hover {
    background: linear-gradient(135deg, #b22222, #8b0000) !important;
    border-color: rgba(255, 215, 0, 0.7) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.4) !important;
}

.debug-btn {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    color: #fff !important;
    font-size: 14px !important;
    opacity: 0.8 !important;
}

.debug-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3) !important;
    opacity: 1 !important;
    border-color: rgba(255, 215, 0, 0.7) !important;
}

/* Nascondi elementi non utilizzati */
#whereAreYouBtn {
    display: none !important;
}

/* Loading states */
.control-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.control-btn:disabled:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.3);
}


/* 📱 OTTIMIZZAZIONE MOBILE - PIÙ SPAZIO PER LA MAPPA */

/* Controlli mappa - STILE COMPATTO */
.map-controls {
    background: rgba(139, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    flex-shrink: 0;
}

/* Status info - COMPATTO */
.status-info {
    display: none;
    /*display: flex;*/
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.status-label {
    font-weight: 600;
}

.status-value {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.status-separator {
    opacity: 0.7;
    margin: 0 0.3rem;
}

/* 📱 RESPONSIVE MOBILE OTTIMIZZATO */
@media (max-width: 768px) {
    /* Header più compatto */
    .map-header {
        padding: 0.6rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .header-content h1 {
        font-size: 1.6rem; /* 🔥 PIÙ PICCOLO */
    }

    .user-info {
        font-size: 0.9rem;
    }

    .map-nav {
        justify-content: center;
        gap: 0.3rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Controlli compatti */
    .map-controls {
        padding: 0.4rem;
        gap: 0.3rem;
    }

    .control-btn {
        padding: 0.6rem 1rem; /* 🔥 PIÙ PICCOLI */
        font-size: 0.9rem;
    }

    /* Status info ancora più compatto */
    .status-info {
        flex-direction: column;
        gap: 0.2rem;
        font-size: 0.7rem;
        text-align: center;
        padding: 0.2rem 0.5rem;
    }

    .status-separator {
        display: none; /* 🔥 NASCONDI SU MOBILE */
    }

    /* Mappa occupa più spazio */
   /* .map-container {
        margin: 0.3rem; /* 🔥 MARGINI RIDOTTI */
        border-radius: 12px;
        /* Calcola altezza precisa */
        height: calc(100vh - 200px); /* 🔥 PIÙ SPAZIO */
    /*}*/

    /* Footer compatto */
    .map-footer {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .map-footer p {
        margin: 0.1rem 0;
    }

    .privacy-note {
        font-size: 0.7rem;
    }

    /* Controlli zoom più accessibili */
    .leaflet-control-zoom {
        top: 10px !important;
        right: 10px !important;
    }

    .leaflet-control-zoom a {
        width: 35px !important;
        height: 35px !important;
        line-height: 33px !important;
        font-size: 18px !important;
    }
}

@media (max-width: 480px) {
    /* Header ancora più compatto */
    .map-header {
        padding: 0.4rem;
    }

    .header-content h1 {
        font-size: 1.4rem; /* 🔥 MOLTO PIÙ PICCOLO */
    }

    .user-info {
        font-size: 0.8rem;
    }

    /* Controlli ultra-compatti */
    .map-controls {
        padding: 0.3rem;
        flex-direction: column;
        gap: 0.2rem;
    }

    .control-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        width: 100%;
        max-width: 200px;
    }

    /* Status info minimale */
    .status-info {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    /* Mappa massima */
   /* .map-container {
        margin: 0.2rem;
        border-radius: 10px;
        height: calc(100vh - 180px); /* 🔥 MASSIMO SPAZIO */
    /*}*/

    /* Footer minimale */
    .map-footer {
        padding: 0.4rem;
        font-size: 0.75rem;
    }

    .privacy-note {
        font-size: 0.65rem;
    }

    /* Nav compatto */
    .map-nav {
        flex-direction: column;
        gap: 0.2rem;
    }

    .nav-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* 📱 LAYOUT VERTICALE ESTREMO */
@media (max-width: 480px) and (max-height: 700px) {
    /* Per schermi piccoli verticali */
    .header-content h1 {
        font-size: 1.2rem;
    }

    .map-controls {
        flex-direction: row;
        justify-content: space-around;
        padding: 0.2rem;
    }

    .control-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        flex: 1;
        max-width: 120px;
    }

    /*.map-container {
        height: calc(100vh - 160px); /* 🔥 QUASI TUTTO LO SCHERMO */
    /*}*/

    .map-footer p {
        display: inline;
        margin: 0 0.5rem;
    }

    .privacy-note::before {
        content: ' - ';
    }
}

/* 🔄 ORIENTAMENTO LANDSCAPE MOBILE */
@media (max-width: 768px) and (orientation: landscape) {
    .header-content {
        flex-direction: row;
        gap: 1rem;
    }

    .header-content h1 {
        font-size: 1.3rem;
    }

    .map-controls {
        flex-direction: row;
        padding: 0.3rem;
    }

   /* .map-container {
        height: calc(100vh - 120px); /* 🔥 SFRUTTA ALTEZZA LANDSCAPE */
        margin: 0.2rem;
   /* }*/

    .status-info {
        font-size: 0.7rem;
    }
}


/* 🔄 SPINNER PER PULSANTE PERMESSO */
.permission-btn {
    position: relative;
    overflow: hidden;
    min-width: 200px;
    transition: all 0.3s ease;
}

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

.btn-spinner .spinner-icon {
    animation: spin 1s linear infinite;
    font-size: 1.2rem;
}

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

/* Loading GPS - STILE AVANZATO */
.gps-loader {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    height: 120px;
}

.gps-pulse {
    font-size: 4rem;
    position: relative;
    z-index: 3;
    animation: gps-bounce 2s ease-in-out infinite;
}

@keyframes gps-bounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-10px); }
}

.gps-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring {
    position: absolute;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    animation: gps-ring 2s ease-out infinite;
}

.ring-1 {
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    animation-delay: 0s;
}

.ring-2 {
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    animation-delay: 0.5s;
}

.ring-3 {
    width: 160px;
    height: 160px;
    margin: -80px 0 0 -80px;
    animation-delay: 1s;
}

@keyframes gps-ring {
    0% {
        transform: scale(0);
        opacity: 1;
        border-color: rgba(255, 215, 0, 0.7);
    }
    50% {
        border-color: rgba(255, 215, 0, 0.3);
    }
    100% {
        transform: scale(1);
        opacity: 0;
        border-color: rgba(255, 215, 0, 0);
    }
}

/* Progress bar GPS */
.gps-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff8e8e, #ffd700);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: gps-progress 3s ease-in-out infinite;
}

@keyframes gps-progress {
    0% {
        width: 20%;
        background-position: 200% 0;
    }
    50% {
        width: 80%;
        background-position: 0% 0;
    }
    100% {
        width: 95%;
        background-position: -200% 0;
    }
}

.gps-status {
    color: #666;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.gps-tip {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
    margin-top: 1rem;
}

/* Stati del pulsante */
.permission-btn.loading {
    background: linear-gradient(135deg, #666, #888);
    cursor: wait;
    transform: none;
}

.permission-btn.loading:hover {
    background: linear-gradient(135deg, #666, #888);
    transform: none;
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.3);
}

/* 📱 RESPONSIVE GPS LOADING */
@media (max-width: 480px) {
    .gps-loader {
        height: 100px;
        margin-bottom: 1.5rem;
    }

    .gps-pulse {
        font-size: 3rem;
    }

    .ring-1 {
        width: 60px;
        height: 60px;
        margin: -30px 0 0 -30px;
    }

    .ring-2 {
        width: 90px;
        height: 90px;
        margin: -45px 0 0 -45px;
    }

    .ring-3 {
        width: 120px;
        height: 120px;
        margin: -60px 0 0 -60px;
    }

    .gps-progress {
        margin: 1rem 0;
    }

    .permission-btn {
        min-width: 180px;
        font-size: 1rem;
    }
}