:root {
    --primary: #d63031;
    --accent: #ff7675;
    --bg-light: #f5f7fa;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-dark: #2d3436;
    --text-dark: #2d3436;
    --text-light: #f5f6fa;
    --text-muted: #636e72;

    --ok-color: #44bd32;
    --near-miss-color: #fbc531;
    --accident-color: #e84118;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-bg {
    background: var(--bg-gradient);
    align-items: center;
    justify-content: center;
}

.admin-bg,
.dashboard-bg {
    background: var(--bg-gradient);
}

/* Globals & Layout */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

h2 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 2rem;
}

/* Buttons & Inputs */
.btn {
    display: inline-block;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #b32626;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(214, 48, 49, 0.3);
}

.btn-secondary {
    background-color: #0984e3;
    color: white;
}

.btn-secondary:hover {
    background-color: #076aba;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid #dfe6e9;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
}

/* Navbar */
.glass-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.logo-container-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-small {
    height: 45px;
}

.logo-text-small {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.subtitle-nav {
    font-weight: 600;
    color: #0984e3;
    letter-spacing: 1px;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Form Admin */
.input-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.flex-1 {
    flex: 1;
}

.date-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.date-input-wrapper input {
    flex: 1;
}

.readonly-input {
    background-color: #f1f2f6 !important;
    cursor: not-allowed;
}

.status-selection {
    margin-bottom: 2rem;
}

.status-selection label {
    font-weight: 600;
    color: var(--text-muted);
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.8rem;
}

.radio-card {
    flex: 1;
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.card-content {
    display: block;
    padding: 1.2rem;
    text-align: center;
    border-radius: 12px;
    font-weight: 700;
    border: 2px solid #dfe6e9;
    transition: all 0.3s;
    color: var(--text-muted);
    background: white;
    font-size: 1.1rem;
}

.ok-card input:checked+.card-content {
    background: var(--ok-color);
    color: white;
    border-color: var(--ok-color);
    box-shadow: 0 4px 15px rgba(68, 189, 50, 0.3);
}

.near-miss-card input:checked+.card-content {
    background: var(--near-miss-color);
    color: white;
    border-color: var(--near-miss-color);
    box-shadow: 0 4px 15px rgba(251, 197, 49, 0.3);
}

.accident-card input:checked+.card-content {
    background: var(--accident-color);
    color: white;
    border-color: var(--accident-color);
    box-shadow: 0 4px 15px rgba(232, 65, 24, 0.3);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 1.2rem;
    text-align: left;
    border-bottom: 1px solid #dfe6e9;
}

.data-table th {
    font-weight: 700;
    color: var(--text-muted);
    background-color: #f8f9fa;
}

.bg-ok {
    background-color: var(--ok-color) !important;
    color: white;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
}

.bg-near-miss {
    background-color: var(--near-miss-color) !important;
    color: white;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
}

.bg-accident {
    background-color: var(--accident-color) !important;
    color: white;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
}

/* Dashboard Generali */
.dashboard-grid {
    display: grid;
    gap: 2rem;
}

.top-row {
    grid-template-columns: 2fr 1.5fr;
}

/* Più spazio al grafico */
.bottom-row {
    grid-template-columns: 1fr 1fr;
}

/* Widget */
.widget {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.widget-title {
    margin-bottom: 1.5rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-dark);
    letter-spacing: 1px;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    margin: auto;
}

/* Calendario */
.calendar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.cal-day:hover {
    transform: scale(1.05);
}

.cal-day.empty {
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
}

@keyframes slideInRight {
    0% {
        transform: translateX(30px);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    0% {
        transform: translateX(-30px);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.calendar-grid.animating-next {
    animation: slideInRight 0.3s ease-out forwards;
}

.calendar-grid.animating-prev {
    animation: slideInLeft 0.3s ease-out forwards;
}

.cal-day.today {
    border: 3px solid #0984e3;
    font-weight: 800;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.ok-box {
    background: var(--ok-color);
}

.near-miss-box {
    background: var(--near-miss-color);
}

.accident-box {
    background: var(--accident-color);
}

/* Display Digitale (Warning banner style) */
.digital-display-widget {
    padding: 0 !important;
    overflow: hidden;
}

.danger-border {
    border: 3px solid #e17055;
    background: #fff !important;
}

.banner-warning {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem !important;
    border-radius: 12px;
    border-bottom: 8px solid #e84118;
}

.display-label h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.display-label p {
    margin: 0;
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.digital-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e272e;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 5px solid #2f3542;
    min-width: 160px;
    box-shadow: inner 0 0 20px rgba(0, 0, 0, 0.8);
}

.digital-number {
    font-family: 'Courier New', Courier, monospace;
    font-size: 5rem;
    font-weight: 900;
    color: #ff4757;
    line-height: 1;
    text-shadow: 0 0 15px rgba(255, 71, 87, 1);
    margin: 0;
}

.safety-icons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: #fff;
    border: 4px solid #e84118;
    font-weight: 800;
    color: var(--text-dark);
}

.no-smoking {
    position: relative;
    color: #e84118;
}

.logo {
    max-width: 180px;
    height: auto;
}

.logo-text {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: -2px;
    line-height: 1;
}

@media (max-width: 900px) {
    .top-row {
        grid-template-columns: 1fr;
    }

    .bottom-row {
        grid-template-columns: 1fr;
    }

    .banner-warning {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
}