/* ===================================================================
   PRONTO STRADE - Portale Operativo
   Stylesheet Principale con ID e CLASSI
   ACI Global Servizi S.p.A.
   
   STRUTTURA:
   - ID (#) = Elementi UNICI per pagina
   - CLASSI (.) = Elementi RIPETIBILI/RIUTILIZZABILI
   =================================================================== */

/* ===================================================================
   VARIABILI CSS (Brand Colors)
   =================================================================== */
:root {
    /* Colori Brand Pronto Strade */
    --ps-blue-primary: #0051A5;
    --ps-blue-dark: #003D7A;
    --ps-grey: #6D6E71;
    --ps-grey-light: #F5F5F5;
    
    /* Colori Funzionali */
    --ps-red: #E74C3C;
    --ps-red-light: #FFCCCB;
    --ps-green: #27AE60;
    --ps-yellow: #F39C12;
    
    /* Sfumature Grigio */
    --grey-100: #F8F9FA;
    --grey-200: #E9ECEF;
    --grey-300: #DEE2E6;
    --grey-400: #CED4DA;
    --grey-500: #ADB5BD;
    --grey-600: #6C757D;
    --grey-700: #495057;
    --grey-800: #343A40;
    --grey-900: #212529;
    
    /* Tipografia */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    
    /* Spaziature */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    --spacing-2xl: 40px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 50%;
    
    /* Ombre */
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.3);
    
    /* Transizioni */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===================================================================
   RESET & BASE
   =================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--grey-800);
    background: var(--ps-grey-light);
}

/* ===================================================================
   TIPOGRAFIA
   =================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--grey-900);
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--ps-blue-primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--ps-blue-dark);
}

/* ===================================================================
   NAVBAR COMPONENTS
   =================================================================== */
.navbar {
    background: linear-gradient(135deg, var(--ps-blue-primary) 0%, var(--ps-blue-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 30px;
    max-width: 1600px;
    margin: 0 auto;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-decoration: none;
    color: white;
}

.navbar-logo {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.navbar-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin: 0;
    color: white;
}

.navbar-menu {
    display: flex;
    gap: var(--spacing-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-menu li a {
    display: block;
    padding: 8px 16px;
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.navbar-menu li a:hover {
    background: rgba(255, 255, 255, 0.15);
}

.navbar-menu li a.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex-shrink: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    text-transform: uppercase;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.user-role {
    font-size: 0.75em;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.5em;
    transition: all var(--transition-base);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
    }
    
    .navbar-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: var(--spacing-md);
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .navbar-left {
        flex: 1;
    }
    
    .user-details {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 14px;
        --font-size-3xl: 24px;
        --spacing-xl: 20px;
    }
}

/* ===================================================================
   DASHBOARD PRINCIPALE
   =================================================================== */

/* ── Layout generale ── */
.dashboard-body {
    background: #f0f2f7;
}

.dashboard-main {
    flex: 1;
    padding: var(--spacing-xl);
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ── Hero Banner ── */
.hero-banner {
    background: linear-gradient(135deg, #1a2f6e 0%, #2c5cc5 60%, #1e4db7 100%);
    color: white;
    padding: 40px 48px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: 0 8px 32px rgba(28, 47, 110, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -80px;
    right: 100px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.hero-text {
    z-index: 1;
}

/* Sovrascrive il colore scuro globale di h1-h6 dentro il banner */
.hero-banner h1,
.hero-banner h2,
.hero-banner h3,
.hero-banner p {
    color: white;
    margin-bottom: 0;
}

.hero-greeting {
    font-size: 0.95em;
    opacity: 0.75;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 6px;
    color: white;
}

.hero-title {
    font-size: 2em;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: -0.01em;
    color: white;
}

.hero-subtitle {
    font-size: 1em;
    opacity: 0.85;
    max-width: 560px;
    line-height: 1.6;
    color: white;
    margin: 0;
}

.hero-badge-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1;
    flex-shrink: 0;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 18px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.hero-badge .badge-value {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1;
    color: white;
}

.hero-badge .badge-label {
    font-size: 0.75em;
    opacity: 0.75;
    margin-top: 3px;
    color: white;
}

#liveClock {
    font-size: 2em;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: white;
}

#liveDate {
    color: white;
}

/* ── Etichetta sezione ── */
.section-label {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--grey-600);
    margin-bottom: var(--spacing-md);
}

/* ── Griglia moduli ── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.module-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 28px 24px;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.module-card.blue::before   { background: linear-gradient(90deg, #2c5cc5, #667eea); }
.module-card.green::before  { background: linear-gradient(90deg, #16a34a, #22c55e); }
.module-card.orange::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.module-card.purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.module-card.teal::before   { background: linear-gradient(90deg, #0f766e, #2dd4bf); }

.module-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: #e2e8f0;
}

.module-icon {
    font-size: 42px;
    margin-bottom: 14px;
    display: block;
    line-height: 1;
}

.module-card h3 {
    color: #1e293b;
    font-size: 1.05em;
    font-weight: 700;
    margin: 0 0 6px 0;
}

.module-card p {
    color: var(--grey-600);
    font-size: 0.85em;
    margin: 0;
    line-height: 1.5;
}

/* ── Pannello inferiore ── */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.info-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: var(--spacing-xl);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid #f1f5f9;
}

.panel-header-icon {
    font-size: 1.4em;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.05em;
    font-weight: 700;
    color: #1e293b;
}

/* ── Link utili esterni ── */
.ext-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ext-link-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.2s;
}

.ext-link-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: translateX(4px);
}

.ext-link-logo {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
    overflow: hidden;
}

.ext-link-info {
    flex: 1;
}

.ext-link-name {
    display: block;
    font-weight: 700;
    font-size: 0.9em;
    color: #1e293b;
}

.ext-link-desc {
    display: block;
    font-size: 0.78em;
    color: var(--grey-500);
    margin-top: 2px;
}

.ext-link-arrow {
    color: var(--grey-500);
    font-size: 0.8em;
    flex-shrink: 0;
}

/* ── Info aziendale ── */
.company-info-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.company-info-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.company-info-bullet {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    flex-shrink: 0;
    margin-top: 2px;
}

.company-info-bullet.blue   { background: #dbeafe; }
.company-info-bullet.green  { background: #dcfce7; }
.company-info-bullet.orange { background: #fef3c7; }
.company-info-bullet.red    { background: #fee2e2; }

.company-info-text strong {
    display: block;
    font-size: 0.9em;
    color: #1e293b;
    font-weight: 700;
}

.company-info-text span {
    font-size: 0.82em;
    color: var(--grey-600);
    line-height: 1.4;
}

/* ── Footer note ── */
.dashboard-footer-note {
    text-align: center;
    color: var(--grey-500);
    font-size: 0.8em;
    padding-bottom: var(--spacing-lg);
}

.dashboard-footer-note a {
    color: var(--ps-blue-primary);
    text-decoration: none;
}

/* ── Responsive dashboard ── */
@media (max-width: 1024px) {
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-banner {
        flex-direction: column;
        padding: 28px 24px;
    }

    .hero-badge-group {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }

    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
}
