:root {
    --primary: #2c3e50;
    --accent: #27ae60;
    --bg: #f8f9fa;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: #333;
    padding-top: 70px;
}

h1, h2, h3, h4 { margin-top: 0; color: var(--primary); }

/* NAVIGATION */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    height: 70px;
}

.brand-container { display: flex; align-items: center; gap: 10px; }
.logo-circle { width: 40px; height: 40px; background: #eee; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.nav-logo { width: 100%; height: 100%; object-fit: cover; }
.brand-text { font-weight: 800; font-size: 1.2rem; color: var(--primary); letter-spacing: -0.5px; }

/* NAVBAR LOGIN AREA */
.desktop-login-area { display: flex; gap: 10px; align-items: center; }
#login-form-desktop { display: flex; gap: 10px; align-items: center; }

.desktop-login-area input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    height: 40px;
    box-sizing: border-box;
    outline: none;
    background: #f9f9f9;
}
.desktop-login-area input:focus { border-color: var(--accent); background: #fff; }

.btn-login-nav {
    padding: 0 20px;
    height: 40px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.btn-login-nav:active { transform: scale(0.95); }

/* COLORI BOTTONI NAVBAR */
#login-form-desktop button[type="submit"] { background-color: var(--accent); color: white; }
#btn-reg-desk { background-color: white; color: #333; border: 1px solid #ddd; }
#btn-mobile-login { background-color: var(--accent); color: white; }
#nav-user { display: none; align-items: center; gap: 10px; }
#display-name { font-weight: 600; font-size: 0.9rem; }
#btn-logout { background: #ffebee; color: #c62828; }
.nav-guest-mobile { display: none; }

/* LAYOUT GENERALI */
.main-container { max-width: 1200px; margin: 0 auto; padding: 20px; min-height: calc(100vh - 70px); }
.content-wrapper { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); min-height: 400px; }

/* HERO E MAPPA */
.hero-guest { text-align: center; padding: 40px 20px; }
.hero-title { font-size: 2.5rem; line-height: 1.2; margin-bottom: 10px; color: #2c3e50; }
.hero-highlight { color: #27ae60; position: relative; display: inline-block; }
.hero-subtitle { color: #666; font-size: 1rem; max-width: 600px; margin: 0 auto 30px auto; }
.btn-hero-cta { background: #27ae60; color: white; border: none; padding: 12px 30px; font-size: 1.1rem; font-weight: 700; border-radius: 30px; cursor: pointer; box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3); transition: transform 0.2s; margin-bottom: 40px; }

#map-container-guest {
    height: 600px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid #fff;
}
@media (max-width: 768px) { #map-container-guest { height: 500px; max-width: 100%; } }

/* LISTA EVENTI PUBBLICI */
.public-events-container { margin-top: 30px; padding: 0 10px; max-width: 1200px; margin-left: auto; margin-right: auto; }
.section-title { font-size: 1.2rem; font-weight: 800; color: #2c3e50; margin-bottom: 15px; padding-left: 5px; border-left: 4px solid var(--primary); }
.scrolling-wrapper { display: flex; overflow-x: auto; gap: 15px; padding-bottom: 20px; -webkit-overflow-scrolling: touch; }
.public-event-card { flex: 0 0 200px; background: white; border-radius: 12px; padding: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 1px solid #eee; text-align: center; }
.public-event-date { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.btn-join-public { background: #2c3e50; color: white; border: none; padding: 8px; width: 100%; border-radius: 6px; margin-top: 10px; cursor: pointer; font-size: 0.8rem; }

/* MODALI */
.modal-overlay {
    display: none; /* FONDAMENTALE */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: #aaa; }
.modal-header { text-align: center; margin-bottom: 20px; }
.modal-logo { margin: 0 auto 10px auto; width: 50px; height: 50px; }
.modal-title { margin: 0; color: #2c3e50; }

/* UTILITIES */
.text-center { text-align: center; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-15 { margin-bottom: 15px; }
.w-100 { width: 100%; }
.flex-gap-10 { display: flex; gap: 10px; }
.hidden { display: none; }

#toast { visibility: hidden; min-width: 250px; margin-left: -125px; background-color: #333; color: #fff; text-align: center; border-radius: 50px; padding: 12px; position: fixed; z-index: 3000; left: 50%; bottom: 30px; font-size: 0.9rem; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

/* TABELLE */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.admin-table th { text-align: left; padding: 10px; background: #f8f9fa; color: #666; font-size: 0.85rem; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.btn-edit-row { background: #f39c12; color: white; border:none; padding:6px 10px; border-radius:6px; cursor:pointer; margin-right:5px; }
.btn-del-row { background: #e74c3c; color: white; border:none; padding:6px 10px; border-radius:6px; cursor:pointer; }
.btn-restore-row { background: #27ae60; color: white; border:none; padding:6px 10px; border-radius:6px; cursor:pointer; }
.badge-players { background: #e0f2f1; color: #00695c; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 0.8rem; border: 1px solid #b2dfdb; cursor: pointer; text-decoration: underline; }
.badge-players:hover { background: #b2dfdb; }
.archived-row { opacity: 0.6; background: #f9f9f9; }
.archived-row td { text-decoration: line-through; }

/* CAMPI INPUT */
.input-group { position: relative; margin-bottom: 15px; }
.input-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1.1rem; opacity: 0.7; pointer-events: none;}
.input-with-icon { width: 100%; padding: 12px 12px 12px 45px; border: 1px solid #eee; border-radius: 8px; font-size: 0.95rem; box-sizing: border-box; background: #fdfdfd; }
.input-label { display: block; font-size: 0.85rem; font-weight: 600; color: #555; margin-bottom: 5px; text-align: left; margin-left: 5px; }
.upload-box { text-align: center; margin-bottom: 20px; padding: 15px; background: #fdfdfd; border: 2px dashed #ddd; border-radius: 12px; cursor: pointer; }
.preview-img-edit { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #27ae60; display: none; margin: 0 auto 10px auto; }
.club-logo-preview { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #27ae60; margin: 0 auto 10px auto; display: block; }
.club-logo-small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid #ddd; vertical-align: middle; margin-right: 10px; }
.btn-modify { background: #f39c12; color: white; border:none; padding: 6px 18px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; margin-top: 5px; font-weight: 600; }
.btn-small { padding: 5px 10px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.participant-list-item { padding: 10px; border-bottom: 1px solid #eee; font-size: 0.9rem; text-align: left; }
.participant-list-item:last-child { border-bottom: none; }
.forgot-pass-link { display: block; text-align: right; font-size: 0.8rem; color: #666; margin-top: 5px; text-decoration: none; cursor: pointer; }
.forgot-pass-link:hover { text-decoration: underline; color: var(--primary); }

/* COOKIE BANNER */
.cookie-banner { position: fixed; bottom: 20px; left: 20px; right: 20px; background: white; padding: 20px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: space-between; gap: 20px; z-index: 9999; border: 1px solid #eee; transition: transform 0.3s ease-in-out; }
.cookie-banner.hidden { transform: translateY(150%); }
.cookie-text { font-size: 0.85rem; color: #555; line-height: 1.4; }
.cookie-btns { display: flex; gap: 10px; }
.btn-cookie-accept { background: var(--accent); color: white; border: none; padding: 10px 20px; border-radius: 20px; font-weight: 600; cursor: pointer; }
.btn-cookie-settings { background: #f0f2f5; color: #333; border: none; padding: 10px 20px; border-radius: 20px; font-weight: 600; cursor: pointer; }

/* ACCOUNT DELETION */
.btn-delete-account { background: #fff; color: #e74c3c; border: 1px solid #e74c3c; padding: 8px 15px; border-radius: 20px; font-size: 0.8rem; cursor: pointer; font-weight: 600; margin-top: 20px; transition: all 0.2s; }
.btn-delete-account:hover { background: #feebeb; }

/* FORM STYLES (Login & Register) */
.card-form {
    background: #ffffff;
    max-width: 450px;
    margin: 0 auto;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background: #fdfdfd;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15);
    background: #ffffff;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-top: 10px;
}

.btn-primary:hover {
    background: #219a52;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.card-form p {
    font-size: 0.9rem;
    color: #666;
}

.card-form a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.card-form a:hover {
    color: #1e8449;
    text-decoration: underline;
}

/* MAP FLOATING UI (Search & GPS) */
.map-ui-overlay {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 10px;
    width: 90%;
    max-width: 500px;
}

.map-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.map-search-container {
    flex: 1;
    position: relative;
}

.map-search-input {
    width: 100%;
    padding: 12px 35px 12px 40px; /* modified right padding */
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
    outline: none;
}

.map-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #666;
    pointer-events: none;
}

.map-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #999;
    cursor: pointer;
}

.map-search-clear:hover {
    color: #e74c3c;
}

.btn-map-gps {
    background: #fff;
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 45px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #27ae60;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.btn-map-gps:hover {
    background: #f4fdf7;
}

.btn-map-gps:active {
    transform: scale(0.95);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    margin-top: 5px;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

.autocomplete-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f0f7f4;
}

.autocomplete-item strong {
    color: #2c3e50;
}

/* --- RADAR PROMO BANNER (Opzione 1) --- */
.radar-promo-banner {
    position: fixed;
    bottom: 20px;
    right: -400px;
    width: 320px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 15px;
    z-index: 1000;
    transition: right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    opacity: 0;
}

.radar-promo-banner.show {
    right: 20px;
    opacity: 1;
}

.radar-promo-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.radar-icon {
    font-size: 2rem;
}

.radar-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.radar-text strong {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 2px;
}

.radar-text span {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.radar-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 5px;
}

@media (max-width: 768px) {
    .radar-promo-banner {
        /* Centro in basso su mobile */
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: -150px;
        transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    }
    .radar-promo-banner.show {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        opacity: 1;
}

/* MARKER "LIVE" MAPPA */
.live-marker-container {
    position: relative;
    width: 20px;
    height: 20px;
}
.pulse-dot {
    width: 14px;
    height: 14px;
    background-color: #e74c3c;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    animation: pulse-animation 1.5s infinite;
}
@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}