/* VDV Admin Dashboard Styles */

:root {
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --text-main: #f0f0f0;
    --text-muted: #888;
    --primary-color: #ffffff;
    --primary-hover: #cccccc;
    --danger-color: #ef4444;
    --border-color: #333333;
    --font-primary: 'Montserrat', sans-serif;
    --font-heading: 'Syne', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* GLOBAL SCROLLBARS (Premium Aesthetic) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #666;
}


body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    transition: 0.2s;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary { background: var(--primary-color); color: var(--bg-dark); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-secondary { background: transparent; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-danger { background: var(--danger-color); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-small { padding: 6px 12px; font-size: 0.8rem; }
.w-100 { width: 100%; }

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }

/* FORMS */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    text-align: left;
}
.form-group-row {
    display: flex;
    gap: 15px;
}
.form-group-row .form-group { flex: 1; min-width: 0; }

label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}

input, select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-primary);
    font-size: 1rem;
    width: 100%;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-msg {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-bottom: 10px;
    min-height: 20px;
}

/* LOGIN SCREEN */
.admin-container {
    display: none;
    height: 100vh;
    align-items: center;
    justify-content: center;
}
.admin-container.active { display: flex; }

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.admin-logo {
    width: 60px;
    margin-bottom: 20px;
    filter: invert(1);
}
.login-card h2 { margin-bottom: 5px; }
.login-card p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.9rem; }

/* DASHBOARD LAYOUT */
.dashboard-layout {
    display: none;
    height: 100dvh;
}
.dashboard-layout.active { display: flex; }

/* SIDEBAR */
.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 20px 0;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}
.sidebar-nav li a:hover, .sidebar-nav li.active a {
    background: rgba(255,255,255,0.05);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

/* SIDEBAR FOLDERS */
.sidebar-folder {
    margin-top: 20px;
}
.folder-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}
.folder-list {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}
.folder-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 10px 45px;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: 0.2s;
    cursor: default;
}
.folder-list li:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-main);
}
.folder-list li i {
    color: var(--primary-color);
    opacity: 0.8;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}
#logged-in-user {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    word-break: break-all;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.topbar {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: var(--bg-dark);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.date-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}
.date-selector h2 { 
    margin: 0; 
    font-size: 0.85rem; /* Ridotto per far stare l'anno */
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    width: 220px; /* Shortened width for shortened date format */
    text-align: center;
    font-weight: 800;
}
@media (max-width: 480px) {
    .date-selector h2 {
        font-size: 0.65rem; /* Molto piccolo per mobile estremo */
        width: 170px;
    }
}

/* AGENDA VIEW */
.agenda-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px;
    background: #0a0a0a;
}
.staff-columns {
    display: flex;
    gap: 20px;
    min-width: max-content;
    height: 100%;
}
.staff-column {
    width: 300px;
    background: rgba(15, 15, 15, 0.7); /* Deep glassmorphism */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5); /* Inner shadow for depth */
}
.staff-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3); /* Darker header */
    border-radius: 8px 8px 0 0;
}
.staff-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor; /* Glow effect matching the dot color */
}
.appointments-list {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Removed gap: 10px; since margin-bottom is now on the card itself */
}

/* APPOINTMENT CARD */
.apt-card {
    background: rgba(20, 20, 20, 0.5); /* Glass back */
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 15px; /* Added spacing */
}
.apt-card:hover { 
    background: rgba(40, 40, 40, 0.8);
    border-color: #555;
    transform: translateY(-3px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}
.apt-time { 
    font-family: var(--font-heading);
    font-weight: 800; 
    font-size: 1.1rem; 
    margin-bottom: 8px; 
    color: var(--primary-color); 
}
.apt-client { 
    font-weight: 700; 
    font-size: 1.1rem; 
    margin-bottom: 5px; 
    text-transform: uppercase;
}
.apt-service { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    line-height: 1.4;
}
.apt-card.type-block { 
    border-left-color: var(--danger-color); 
    opacity: 0.6; 
    background: rgba(239, 68, 68, 0.1); /* Subtle red tint */
}
/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 450px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    padding: 25px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}
.modal-body {
    word-break: break-word;
    overflow-wrap: break-word;
}
.close-modal {
    background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer;
}
.close-modal:hover { color: #fff; }

/* RESPONSIVE ADMIN LAYOUT FOR MOBILE & TABLET */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px; /* Riporto larghezza desktop per tablet orizzontale */
    }
    .sidebar-header h2 { font-size: 1.2rem; display: block; }
    
    .sidebar-nav li a {
        justify-content: flex-start;
        padding: 12px 20px;
        font-size: 0.95rem; /* Riporto testo leggibile */
    }
    .sidebar-nav li a i { font-size: 1.1rem; margin-right: 12px; }
    
    .sidebar-folder { display: block; }
    .sidebar-footer #logged-in-user { display: block; }
    
    .date-selector h2 {
        width: 190px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .dashboard-layout.active { 
        flex-direction: column;
        height: 100dvh;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        flex-direction: row;
        align-items: center;
        padding: 5px 15px;
    }
    .sidebar-header {
        padding: 10px;
        border-bottom: none;
    }
    .sidebar-header h2 { font-size: 1.2rem; }
    
    .sidebar-nav {
        flex: 1;
        display: flex;
        padding: 0;
        margin-left: 15px;
    }
    .sidebar-nav li a {
        padding: 10px;
        font-size: 0.85rem;
    }
    .sidebar-folder { display: none; } /* Hide stats on small mobile top bar */
    
    .sidebar-footer {
        padding: 10px;
        border-top: none;
    }
    #logged-in-user { display: none; }
    #logout-btn { padding: 8px; }

    .main-content {
        height: calc(100dvh - 60px);
    }
    .topbar {
        padding: 10px 15px;
        height: auto;
        min-height: 100px;
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    .topbar-actions {
        width: 100%;
        gap: 8px;
    }
    .topbar-actions .btn-primary,
    .topbar-actions .btn-secondary {
        flex: 1;
        font-size: 0.75rem;
        padding: 8px 10px;
    }
    
    .date-selector h2 {
        width: 180px; 
        font-size: 0.75rem;
    }
    
    .agenda-view {
        padding: 10px;
    }
    
    .staff-column {
        width: 85vw; /* Almost full width for mobile columns */
    }
}

@media (max-width: 480px) {
    .topbar-actions {
        flex-direction: column;
    }
    .topbar-actions button {
        width: 100%;
    }
    .staff-column {
        width: 90vw;
    }
}

/* Compattare modale Nuovo Appuntamento per schermi piccoli */
#add-appointment-modal .form-group {
    margin-bottom: 10px;
}
#add-appointment-modal input, 
#add-appointment-modal select {
    padding: 8px;
}
#add-appointment-modal .modal-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
}
