/* Reset & Base */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    user-select: none;
}

/* Utils di SAURON */
.modal-hidden {
    display: none !important;
}

/* --- TOPBAR --- */
#topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 20px;
    position: relative;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 2px;
}

#user-greeting {
    padding-left: 10px;
    font-size: 0.9em;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

/* --- TACTICAL DROPDOWN --- */
.dropdown-tactical {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 200px;
    z-index: 200;
    border-radius: 4px;
    overflow: hidden;
}

.dropdown-content.show-menu {
    display: block !important;
}

.dropdown-content a {
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
}

/* SPECIFICI PER LOGIN/PRIVACY */
.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.auth-footer-text {
    text-align: center;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 15px;
}

/* --- GLOBE & TACTICAL ELEMENTS --- */
#globeViz {
    width: 100vw;
    height: calc(100vh - 60px);
}

body.placement-mode-active #globeViz {
    cursor: crosshair !important;
}

.interactive-layer {
    pointer-events: auto;
}

.yellow-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    animation: pulse 2s infinite;
}

.post-it {
    display: none;
    position: absolute;
    padding: 12px;
    width: 220px;
    top: -5px;
    left: 25px;
    z-index: 10;
    border-bottom-right-radius: 12px;
    font-size: 13px;
}

#polygon-tools {
    display: none;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 30px;
    z-index: 500;
    align-items: center;
    gap: 15px;
}

/* Posizionamento UI sulla mappa */
.map-ui-container {
    position: absolute;
    z-index: 100;
    pointer-events: none;
}

.map-ui-container>* {
    pointer-events: auto;
}

.ui-top-right {
    top: 75px;
    right: 15px;
}

.ui-bottom-left {
    bottom: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-left: 10px;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-controls select {
    padding: 6px;
    border-radius: 4px;
}

/* Dashboard Gestore */

body.gestore-layout {
    display: flex;
    flex-direction: column;
    overflow: auto;
    /* Sovrascrive l'hidden della mappa */
}

.dashboard-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* Sidebar Menu */
.sidebar {
    width: 250px;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-btn {
    background: transparent;
    border: none;
    text-align: left;
    padding: 15px 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: 0.2s;
    font-weight: bold;
}

.sidebar-btn-small {
    font-size: 0.9em;
}

/* Area Contenuto e Tabs */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-section.active {
    display: block;
}

/* Tabelle Dati */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
}

.data-table th {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-table tr:hover {
    background: #273746;
}

/* Intestazioni Sezione */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

button,
.action-btn,
.sidebar-btn,
.btn-confirm {
    box-shadow: none !important;
    border-radius: 2px !important;
    border: none !important;
    background-image: none !important;
    text-shadow: none !important;
    transform: none !important;
    transition: background-color 0.2s ease, opacity 0.2s ease !important;
}

button:hover,
.action-btn:hover,
.sidebar-btn:hover,
.btn-confirm:hover {
    opacity: 0.85;
}

.auth-input {
    border-radius: 2px !important;
    box-shadow: none !important;
}

@keyframes dropInBlink {
    0% {
        transform: scale(3) translateY(-20px);
        opacity: 0;
    }

    50% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: drop-shadow(0 0 0px transparent);
    }
}

.new-element-anim {
    animation: dropInBlink 0.6s ease-out forwards;
}

/* --- IOS SWITCH PER MODALITÀ MODIFICA --- */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: .4s;
    border-radius: 22px;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    transition: .4s;
    border-radius: 50%;
}

.ios-switch input:checked+.ios-slider:before {
    transform: translateX(18px);
}

.privacy-footer-btn {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    padding: 6px 12px;
    font-size: 0.75em;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

/* Allineamento banner cookie per non sovrapporsi */
#cookie-banner {
    right: 15px;
    bottom: 55px;
    /* Alzato per lasciare spazio al tasto privacy */
}

/* Altezza pulsanti topbar */
.topbar-tall-btn {
    padding: 6px 15px !important;
    font-weight: bold;
    border-radius: 4px !important;
    height: 33px !important;
    box-sizing: border-box !important;
}

/* --- CONTROLLI IN ALTO A DESTRA --- */
.tactical-top-right-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.edit-mode-container {
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-mode-label {
    font-size: 0.85em;
    font-weight: bold;
}

/* --- MENU CONTESTUALE (TASTO DESTRO) --- */
.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s, padding-left 0.2s;
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:hover {
    padding-left: 20px;
}

.context-menu-separator {
    height: 1px;
    margin: 2px 0;
}

#coords-display {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    font-family: monospace;
    font-size: 1.2em;
    font-weight: bold;
    pointer-events: none;
    text-align: center;
    line-height: 1.4;
    display: block;
}

/* MENU CONTESTUALE */
#map-context-menu {
    position: absolute;
    border-radius: 4px;
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
    font-size: 0.9em;
}

#context-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu-item:last-child {
    border-bottom: none;
}

/* --- CLASSE DI ATTIVAZIONE COORDINATE --- */
#coords-display.show-coords {
    display: block;
}


label.modifica {
    font-size: 0.9em;
}