/* --- 1. VARIABILI E RESET --- */
:root {
    /* Palette Colori Principali */
    --primary: #0078d7;       /* Blu */
    --success: #28a745;       /* Verde */
    --warning: #ffc107;       /* Giallo */
    --danger: #dc3545;        /* Rosso */
    --dark: #343a40;          /* Scuro */
    --light: #f8f9fa;         /* Chiaro */
    
    /* Colori Tessere Specifici */
    --purple: #6f42c1;        /* Viola (Ordini) */
    --orange: #fd7e14;        /* Arancione (Inventario) */
    --teal: #20c997;          /* Verde Acqua (Struttura) */
    --grey: #6c757d;          /* Grigio (Magazzino Tecnico) */
    --pink: #d63384;          /* Fucsia (Igiene) - CORRETTO PER VISIBILITÀ */
    --dark-blue: #0dcaf0;     /* Azzurro (Validazione) */

    /* Ombre ed Effetti */
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-hover: 0 10px 20px rgba(0,0,0,0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #eef2f5;
    margin: 0;
    padding: 0;
    padding-bottom: 60px;
    color: #333;
}

a { text-decoration: none; }

/* --- NAVBAR --- */
.navbar {
    background-color: var(--dark);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    flex-wrap: wrap;
    gap: 10px;
    position: sticky; top: 0; z-index: 1000;
}
.navbar a { color: white; opacity: 0.9; transition: opacity 0.2s; }
.navbar a:hover { opacity: 1; }
.nav-title { font-size: 1.1rem; font-weight: bold; margin-left: 10px; vertical-align: middle; }

/* --- BOTTONE INDIETRO --- */
.btn-back {
    background-color: rgba(255, 255, 255, 0.15);
    color: white !important;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    white-space: nowrap;
}
.btn-back:hover { background-color: white; color: var(--dark) !important; transform: translateX(-5px); }
.btn-back i { transition: transform 0.3s ease; }
.btn-back:hover i { transform: translateX(-3px); }

/* --- BOTTONE NUOVA SEGNALAZIONE --- */
.big-btn-container { text-align: center; margin: 30px 0; padding: 0 15px; }
.btn-guasto {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 18px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
    width: 100%; max-width: 450px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-guasto:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 12px 25px rgba(40, 167, 69, 0.5); }

/* --- TESSERE DASHBOARD --- */
.tiles-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;
    padding: 0 15px 30px; max-width: 1400px; margin: 0 auto;
}
.tile {
    color: white;
    padding: 20px 10px;
    text-align: center;
    border-radius: 12px;
    font-weight: 600;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative; overflow: hidden;
    flex: 1 1 140px; min-width: 130px; max-width: 220px;
}
.tile::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(0,0,0,0)); pointer-events: none;
}
.tile:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); filter: brightness(1.1); z-index: 2; }
.tile span { font-size: 0.95rem; line-height: 1.2; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* --- FORM CARDS --- */
.form-card { background-color: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); max-width: 600px; margin: 0 auto; border: 1px solid rgba(0,0,0,0.05); }
.form-card h2 { margin-top: 0; text-align: center; color: var(--dark); margin-bottom: 25px; font-size: 1.5rem; }

/* --- DASHBOARD COLONNE --- */
.dashboard-container { display: flex; gap: 25px; padding: 0 20px; max-width: 1400px; margin: 0 auto; align-items: flex-start; }
.column { flex: 1; background: white; border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); min-height: 300px; min-width: 300px; }
.column h2 { text-align: center; border-bottom: 2px solid #eee; padding-bottom: 15px; margin-top: 0; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* --- TICKET CARD --- */
.ticket-card { padding: 15px; margin-bottom: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.2s ease; background-color: white; border: 1px solid rgba(0,0,0,0.1); border-left-width: 6px; }
.ticket-card:hover { transform: scale(1.02); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.ticket-card.priorita-bassa { background-color: rgba(40, 167, 69, 0.1); border-color: var(--success); }
.ticket-card.priorita-media { background-color: rgba(255, 193, 7, 0.1); border-color: var(--warning); }
.ticket-card.priorita-alta { background-color: rgba(220, 53, 69, 0.1); border-color: var(--danger); }
.ticket-card.priorita-urgenza { background-color: rgba(139, 0, 0, 0.15); border-color: darkred; border-left-width: 8px; }

.ticket-header { font-weight: bold; display: flex; justify-content: space-between; font-size: 1rem; color: #333; margin-bottom: 5px; }
.ticket-meta { font-size: 0.9rem; color: #555; margin-top: 5px; line-height: 1.4; }
.assegnato-esterna { color: var(--purple); font-weight: bold; }

.btn-gestisci { display: inline-block; margin-top: 10px; text-decoration: none; color: #444; font-weight: bold; font-size: 0.85rem; padding: 6px 15px; border-radius: 20px; background: rgba(255,255,255,0.8); border: 1px solid rgba(0,0,0,0.15); transition: all 0.2s; float: right; }
.btn-gestisci:hover { background: white; color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.lampadina-on { color: var(--warning); font-size: 1.2rem; margin-left: 8px; animation: pulse 1.2s infinite; text-shadow: 0 0 5px var(--warning); }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }

/* --- INPUT --- */
input[type="text"], input[type="password"], input[type="number"], select, textarea { width: 100%; padding: 12px; border: 1px solid #ced4da; border-radius: 6px; font-size: 1rem; box-sizing: border-box; transition: border-color 0.2s; margin-bottom: 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.1); }
label { font-weight: 600; margin-bottom: 5px; display: block; color: #444; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #999; margin-right: 5px; vertical-align: middle; }

/* --- MOBILE --- */
@media (max-width: 768px) {
    .navbar { flex-direction: column; text-align: center; gap: 10px; }
    .navbar > div { width: 100%; justify-content: center; }
    .dashboard-container { flex-direction: column; padding: 10px; }
    .column { width: 100%; min-width: auto; margin-bottom: 20px; }
    .tiles-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 10px 20px; }
    .btn-guasto { font-size: 1rem; padding: 15px 20px; }
}
@media (max-width: 480px) {
    .tiles-grid { grid-template-columns: 1fr; }
    .btn-back span { display: none; }
    .btn-back::after { content: "Indietro"; margin-left: 5px; }
}