#login-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    position: relative;
    z-index: 10;
}

#login-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#login-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
/* ====================================
   RESET & BASE
   ==================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

button.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ====================================
   CANVAS THREE.JS
   ==================================== */
#three-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

#three-canvas:active {
    cursor: grabbing;
}

/* ====================================
   UI OVERLAY
   ==================================== */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#ui-overlay > * {
    pointer-events: auto;
}

.admin-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 280px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    backdrop-filter: blur(12px);
    z-index: 120;
}

.admin-panel.hidden { display: none; }

.admin-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-header h3 { margin: 0; color: #222; }

.badge.beta {
    background: #ff9800;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-group { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.admin-group label { font-size: 12px; color: #444; }
.admin-group input[type="text"] {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 13px;
}
.admin-group input[type="color"] {
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.admin-actions { display: flex; gap: 8px; margin: 8px 0; }
.admin-actions button { flex: 1; }

.admin-list h4 { margin: 8px 0 6px; color: #333; }
.admin-list ul { list-style: none; max-height: 180px; overflow: auto; padding: 0; margin: 0; }
.admin-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.admin-list li:hover { background: #f1f5f9; }
.admin-list .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #ddd;
}
.admin-list small { color: #666; margin-left: auto; font-size: 11px; }

.hint {
    margin-top: 6px;
    font-size: 11px;
    color: #666;
}

.admin-status {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid transparent;
}
.admin-status.info { background: #e3f2fd; color: #0d47a1; border-color: #90caf9; }
.admin-status.success { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.admin-status.warning { background: #fff8e1; color: #ef6c00; border-color: #ffe082; }

/* ====================================
   ROOM SYSTEM (Stanze Virtuali)
   ==================================== */
.room-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.room-overlay.hidden { display: none; }

.room-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.room-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f5f9;
    color: #333;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.room-close-btn:hover { background: #e2e8f0; }

.room-header h1 {
    margin: 0 0 10px 0;
    color: #222;
    font-size: 32px;
}

.room-header p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.room-content {
    color: #333;
}

.room-content h2 {
    margin: 20px 0 10px 0;
    color: #222;
    font-size: 24px;
}

.room-content h3 {
    margin: 15px 0 8px 0;
    color: #444;
}

.room-content p { line-height: 1.6; margin: 0 0 10px 0; }

.room-content ul, .room-content ol {
    margin: 0 0 15px 20px;
    padding: 0;
}

.room-content li { margin: 8px 0; }

.room-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
}

.room-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.room-tab:hover { color: #333; }

.room-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.room-tab-content { margin: 20px 0; }

.room-tab-content.hidden { display: none; }

.roadmap-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.roadmap-item .status {
    min-width: 30px;
    font-size: 18px;
}

.roadmap-item strong { display: block; margin-bottom: 5px; }

.roadmap-item p { margin: 0; color: #666; font-size: 13px; }

.service-card {
    padding: 20px;
    margin: 15px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
}

.service-card h3 { margin: 0 0 8px 0; }

.service-card p { margin: 0 0 12px 0; }

.btn-link {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    font-weight: 600;
    font-size: 13px;
}

.btn-link:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.finance-info, .reserve-info {
    margin: 20px 0;
}

.stat-box {
    display: inline-block;
    padding: 15px 20px;
    background: #f1f5f9;
    border-radius: 10px;
    margin: 10px 10px 10px 0;
}

.stat-box h3 { margin: 0; font-size: 13px; color: #666; }

.big-number { margin: 8px 0 0 0; font-size: 24px; font-weight: bold; color: #667eea; }

.sportello-sections {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.section h3 { margin: 0 0 10px 0; }

.section p { margin: 8px 0; }

.section a { color: #667eea; text-decoration: none; font-weight: 600; }

.section a:hover { text-decoration: underline; }

details {
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: #333;
}

details summary:hover { color: #667eea; }

details p { margin: 10px 0 0 0; color: #666; }

.admin-edit-panel {
    margin-top: 15px;
    padding: 15px;
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    border-radius: 10px;
}

.admin-edit-panel.hidden { display: none; }

.admin-edit-panel h4 { margin: 0 0 10px 0; color: #333; }

.admin-edit-panel input[type="text"],
.admin-edit-panel input[type="color"] {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.admin-edit-panel input[type="color"] {
    height: 36px;
    cursor: pointer;
}

/* ====================================
   HEADER
   ==================================== */
#header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 2px;
}

nav {
    display: flex;
    gap: 15px;
}

/* ====================================
   BUTTONS
   ==================================== */
button {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

button.primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

button.logout-btn {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.6);
}

button.logout-btn:hover {
    background: rgba(255, 100, 100, 0.5);
    border-color: rgba(255, 100, 100, 0.8);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    font-size: 18px;
    background: rgba(255,255,255,0.85);
    color: #333;
    z-index: 10;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.close-btn:hover {
    background: #f8d7da;
    color: #721c24;
}

/* ====================================
   PANELS
   ==================================== */
.panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#login-panel.panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Assicura che sia centrato come gli altri pannelli */
}

.panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.9);
}

.panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 28px;
}

.panel p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.panel ul {
    list-style: none;
    margin: 20px 0;
}

.panel ul li {
    padding: 10px 0;
    color: #555;
    border-bottom: 1px solid #eee;
}

.stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
}

/* ====================================
   FORM
   ==================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

#form-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

#form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ====================================
   USER POPUP STYLES
   ==================================== */
.user-popup-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.user-info h2 {
    font-size: 18px;
    color: #333;
    margin: 0 0 5px 0;
}

.user-info p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

.popup-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 15px 0;
}

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popup-btn {
    padding: 12px 16px;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.popup-btn:hover {
    background: #f9f9f9;
    border-color: #667eea;
    color: #667eea;
    transform: translateX(2px);
}

.popup-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.popup-btn.primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.popup-btn.secondary {
    background: #f0f4ff;
    border-color: #667eea;
    color: #667eea;
}

.popup-btn.secondary:hover {
    background: #e8edff;
    border-color: #764ba2;
}

.popup-btn.logout-btn {
    background: rgba(255, 100, 100, 0.1);
    border-color: rgba(255, 100, 100, 0.5);
    color: #d9534f;
}

.popup-btn.logout-btn:hover {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.8);
    color: #c9302c;
}

/* ====================================
   LOADING SCREEN
   ==================================== */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-screen p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 768px) {
    #header {
        padding: 15px 20px;
    }

    .logo h1 {
        font-size: 18px;
    }

    button {
        padding: 8px 15px;
        font-size: 12px;
    }

    .panel {
        padding: 30px 20px;
        max-width: 90%;
    }

    .panel h2 {
        font-size: 22px;
    }
}

/* ====================================
   UTILITIES
   ==================================== */
.hidden {
    display: none !important;
}
