/* ===========================
   GESTIONALE CVPC FAENZA ODV
   File CSS Principale
   =========================== */

/* Variabili CSS */
:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --dark: #1f2937;
    --light: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* === LOGIN === */
/* ================================================
   LOGIN SCREEN - Stile Moderno e Professionale
   ================================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1e40af 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Background animato */
.login-bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: float 20s infinite ease-in-out;
    filter: blur(60px);
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #34d399, #10b981);
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #f472b6, #ec4899);
    top: 40%;
    left: 5%;
    animation-delay: -14s;
}

.shape-4 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    bottom: 20%;
    right: 5%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    25% { transform: translate(30px, -30px) rotate(5deg) scale(1.05); }
    50% { transform: translate(-20px, 20px) rotate(-5deg) scale(0.95); }
    75% { transform: translate(20px, 30px) rotate(3deg) scale(1.02); }
}

/* Particelle decorative */
.login-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-particles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: rise 15s infinite ease-in;
}

.login-particles span:nth-child(1) { left: 10%; animation-delay: 0s; }
.login-particles span:nth-child(2) { left: 20%; animation-delay: 2s; }
.login-particles span:nth-child(3) { left: 30%; animation-delay: 4s; }
.login-particles span:nth-child(4) { left: 40%; animation-delay: 6s; }
.login-particles span:nth-child(5) { left: 50%; animation-delay: 8s; }
.login-particles span:nth-child(6) { left: 60%; animation-delay: 10s; }
.login-particles span:nth-child(7) { left: 70%; animation-delay: 12s; }
.login-particles span:nth-child(8) { left: 80%; animation-delay: 14s; }
.login-particles span:nth-child(9) { left: 90%; animation-delay: 1s; }
.login-particles span:nth-child(10) { left: 95%; animation-delay: 3s; }

@keyframes rise {
    0% { bottom: -10px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { bottom: 100%; opacity: 0; }
}

/* Card Login */
.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    width: 100%;
    max-width: 440px;
    padding: 48px 44px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
    backdrop-filter: blur(20px);
}

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

/* Header Login */
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
}

.login-logo-circle {
    width: 88px;
    height: 88px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 35px rgba(30, 58, 138, 0.35);
    animation: pulse-glow 3s infinite ease-in-out;
    position: relative;
}

.login-logo-circle i {
    font-size: 40px;
    color: white;
}

.login-logo-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.login-logo-badge i {
    font-size: 12px;
    color: white;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 12px 35px rgba(30, 58, 138, 0.35); }
    50% { box-shadow: 0 12px 45px rgba(59, 130, 246, 0.5); }
}

.login-title {
    font-size: 30px;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.login-tagline {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Form Login */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: #94a3b8;
    font-size: 18px;
    z-index: 1;
    transition: all 0.3s ease;
}

.input-label {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #94a3b8;
    pointer-events: none;
    transition: all 0.3s ease;
    background: transparent;
    padding: 0 4px;
}

.input-group input {
    width: 100%;
    padding: 18px 50px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-group input::placeholder {
    color: #94a3b8;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.input-group input:focus::placeholder {
    opacity: 0;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.input-group input:focus + .input-label,
.input-group input:not(:placeholder-shown) + .input-label {
    top: 0;
    font-size: 12px;
    color: #3b82f6;
    background: white;
}

.input-group:focus-within .input-icon {
    color: #3b82f6;
    transform: scale(1.1);
}

.password-toggle {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.password-toggle:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Login Options */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -8px 0;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
}

.remember-me input {
    display: none;
}

.remember-me .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remember-me input:checked + .checkmark {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #3b82f6;
}

.remember-me input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.forgot-password {
    font-size: 14px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.forgot-password:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Error Box */
.login-error-box {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease-in-out;
}

.login-error-box i {
    color: #dc2626;
    font-size: 20px;
    flex-shrink: 0;
}

.login-error-box span {
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

/* Success Box */
.login-success-box {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease-out;
}

.login-success-box i {
    color: #059669;
    font-size: 20px;
    flex-shrink: 0;
}

.login-success-box span {
    color: #065f46;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Login Button */
.login-btn {
    width: 100%;
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(30, 58, 138, 0.4);
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
}

.login-btn:active {
    transform: translateY(-1px);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-btn .btn-icon {
    transition: transform 0.3s ease;
}

.login-btn:hover .btn-icon {
    transform: translateX(5px);
}

.login-btn .btn-loader {
    font-size: 18px;
}

/* Divisore */
.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
}

.login-divider span {
    padding: 0 16px;
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Security Info */
.login-security-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}

.security-item i {
    color: #10b981;
    font-size: 14px;
}

/* Footer Card */
.login-footer {
    margin-top: 24px;
    text-align: center;
}

.login-hint {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-hint i {
    color: #94a3b8;
}

/* Footer Pagina */
.login-page-footer {
    position: absolute;
    bottom: 20px;
    text-align: center;
    z-index: 1;
}

.login-page-footer p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 4px 0;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.footer-links span {
    color: rgba(255, 255, 255, 0.3);
}

/* Modal Reset Password */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.login-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.modal-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon i {
    font-size: 28px;
    color: #d97706;
}

.login-modal-content h3 {
    font-size: 22px;
    color: #1e293b;
    margin: 0 0 12px;
}

.login-modal-content p {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.5;
}

.login-modal-content .input-group {
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px;
        border-radius: 20px;
    }
    
    .login-logo-circle {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }
    
    .login-logo-circle i {
        font-size: 30px;
    }
    
    .login-title {
        font-size: 24px;
    }
    
    .input-group input {
        padding: 14px 45px 14px 45px;
        font-size: 15px;
    }
    
    .login-btn {
        padding: 14px 20px;
    }
}

/* ================================================
   FINE LOGIN SCREEN
   ================================================ */

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

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

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* === BOTTONI === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

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

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

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

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

.btn-secondary {
    background: #6b7280;
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

/* === LAYOUT PRINCIPALE === */
.app-container {
    display: none;
}

.header {
    background: var(--primary);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    box-sizing: border-box;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 250px;
}

body:has(.sidebar.collapsed) .header-left {
    margin-left: 58px;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right span {
    font-size: 14px;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    padding-top: 60px;
}

/* Sidebar collapsed (default dopo timeout) */
.sidebar.collapsed {
    width: 58px;
}

.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-section-title,
.sidebar.collapsed .menu-separator {
    opacity: 0;
    visibility: hidden;
    width: 0;
    position: absolute;
}

.sidebar.collapsed .menu-item {
    padding: 14px 0;
    justify-content: center;
}

.sidebar.collapsed .menu-item i {
    margin: 0;
    font-size: 20px;
}

/* Sidebar expanded on hover */
.sidebar.collapsed:hover {
    width: 250px;
}

.sidebar.collapsed:hover .menu-item span,
.sidebar.collapsed:hover .menu-section-title,
.sidebar.collapsed:hover .menu-separator {
    opacity: 1;
    visibility: visible;
    width: auto;
    position: static;
}

.sidebar.collapsed:hover .menu-item {
    padding: 14px 24px;
    justify-content: flex-start;
}

.sidebar.collapsed:hover .menu-item i {
    font-size: 18px;
    margin-right: 12px;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
}

.menu-item:hover {
    background: var(--light);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary);
    color: var(--white);
    border-left: 4px solid var(--primary-light);
}

.menu-item i {
    font-size: 18px;
    width: 24px;
    min-width: 24px;
}

.menu-item span {
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* === CONTENUTO PRINCIPALE === */
.main-content {
    margin-left: 250px;
    margin-top: 60px;
    padding: 24px;
    min-height: calc(100vh - 60px);
}

/* Main content quando sidebar è collapsed */
.main-content.expanded {
    margin-left: 58px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === STATISTICHE === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* === TABELLE === */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.table-responsive {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    text-transform: uppercase;
    color: #6b7280;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

/* Container scrollabile per tabelle */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.table-container .data-table {
    margin-bottom: 0;
}

/* === BADGE === */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-purple {
    background: #ede9fe;
    color: #5b21b6;
}

/* === MODALI === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    overflow-y: auto;
    padding: 20px;
    /* NOTA: Il click sull'overlay NON chiude il modal per evitare perdita dati */
    /* La chiusura avviene solo tramite pulsante X o Annulla */
}

/* Indicatore visivo che il modal è "protetto" */
.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    /* Garantisce che il contenuto sia sopra l'overlay */
    z-index: 1;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 16px 16px 0 0;
    color: white;
}

.modal-header h2, .modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: white;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
    color: white;
    transform: scale(1.05);
}

/* Alias per compatibilità */
.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: white;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    color: white;
    transform: scale(1.05);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === FORM ROW === */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* === TAB === */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* === LOADING === */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* === TOAST === */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--dark);
    color: var(--white);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    z-index: 4000;
    animation: slideIn 0.3s ease;
    display: none;
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   RESPONSIVE - TABLET (max 992px)
   =================================== */
@media (max-width: 992px) {
    /* Sidebar nascosta di default su tablet */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px !important;
        z-index: 1000;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: 280px !important;
        transform: translateX(-100%);
    }
    
    .sidebar.collapsed.show {
        transform: translateX(0);
    }
    
    .main-content,
    .main-content.expanded {
        margin-left: 0 !important;
        width: 100%;
    }
    
    /* Header con menu hamburger */
    .header {
        padding: 12px 16px;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    /* Tabelle scrollabili */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 700px;
    }
    
    /* Stats grid 3 colonne */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    /* Row 2 colonne diventa 1 */
    .row-2col {
        grid-template-columns: 1fr;
    }
    
    /* Grafici più piccoli */
    .chart-card canvas {
        max-height: 200px;
    }
    
    /* Modal più largo */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px auto;
        max-height: 90vh;
    }
}

/* ===================================
   RESPONSIVE - MOBILE (max 768px)
   =================================== */
@media (max-width: 768px) {
    /* Header compatto */
    .header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .header h1 i {
        font-size: 18px;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .header-right span {
        display: none;
    }
    
    /* Main content padding ridotto */
    .main-content {
        padding: 12px;
        margin-top: 60px;
    }
    
    /* Page header stack verticale */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
    
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Stats grid 2 colonne */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    /* Form rows singola colonna */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Evita zoom su iOS */
    }
    
    /* Tabelle responsive */
    .table-container {
        margin: 0 -12px;
        padding: 0 12px;
        overflow-x: auto;
    }
    
    .data-table {
        font-size: 13px;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    /* Bottoni azioni compatti */
    .btn-icon {
        width: 32px;
        height: 32px;
        padding: 0;
    }
    
    /* Modal fullscreen su mobile */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        padding: 12px 16px;
        border-radius: 0;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        border-radius: 0;
        flex-shrink: 0;
    }
    
    /* Cards */
    .card {
        margin-bottom: 12px;
    }
    
    .card-header h3 {
        font-size: 16px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    /* Alert compatti */
    .alert {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Badge più piccoli */
    .badge {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    /* Grafici container */
    .grafici-container {
        grid-template-columns: 1fr !important;
    }
    
    .chart-card {
        padding: 12px;
    }
    
    /* Sidebar menu su mobile */
    .sidebar {
        width: 85% !important;
        max-width: 300px;
    }
    
    .menu-item {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    /* Toast più largo */
    .toast {
        left: 10px;
        right: 10px;
        bottom: 20px;
        max-width: none;
        text-align: center;
    }
}

/* ===================================
   RESPONSIVE - SMALL MOBILE (max 480px)
   =================================== */
@media (max-width: 480px) {
    /* Stats grid singola colonna */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 12px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .stat-info {
        text-align: left;
    }
    
    /* Header ancora più compatto */
    .header h1 {
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Page header */
    .page-header h2 {
        font-size: 18px;
    }
    
    /* Tabelle molto compatte */
    .data-table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    /* Form */
    .form-control {
        padding: 10px;
    }
    
    label {
        font-size: 13px;
    }
    
    /* Bottoni full width */
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Login */
    .login-container {
        padding: 20px;
    }
    
    .login-container h2 {
        font-size: 20px;
    }
}

/* ===================================
   UTILITY RESPONSIVE
   =================================== */

/* Menu hamburger button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 992px) {
    .menu-toggle {
        display: block;
    }
}

/* Overlay per sidebar mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* Nascondi su mobile/mostra su desktop */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

/* Testo troncato su mobile */
@media (max-width: 768px) {
    .truncate-mobile {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Fix per iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .modal-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === RICEVUTE DPI === */
.dpi-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.dpi-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dpi-item:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.dpi-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.dpi-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1e3a8a;
}

.dpi-checkbox span {
    font-size: 14px;
    color: #374151;
}

.dpi-item select {
    padding: 6px 10px;
    font-size: 13px;
}

.dpi-item select:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
}

.totale-ricevuta {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.totale-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.totale-importo {
    font-size: 24px;
    font-weight: 700;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
}

@media (max-width: 600px) {
    .dpi-items-grid {
        grid-template-columns: 1fr;
    }
}

/* === GRAFICI E RIEPILOGO DPI === */
.chart-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    min-height: 280px;
}

.riepilogo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.riepilogo-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px;
    border-left: 4px solid var(--primary);
}

.riepilogo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.riepilogo-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--dark);
}

.riepilogo-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.stat-mini {
    text-align: center;
}

.stat-mini .stat-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.stat-mini .stat-label {
    font-size: 11px;
    color: #6b7280;
}

.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-info { color: #3b82f6; }
.text-danger { color: #ef4444; }

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.taglie-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
}

.taglia-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    margin: 2px;
    font-size: 11px;
    font-weight: 600;
}

.taglia-badge.available {
    background: #d1fae5;
    color: #065f46;
}

.taglia-badge.empty {
    background: #fee2e2;
    color: #991b1b;
}

.grafici-container {
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .grafici-container {
        grid-template-columns: 1fr;
    }
    
    .riepilogo-grid {
        grid-template-columns: 1fr;
    }
}

/* === RIGHE TABELLA STATO === */
.row-restituita {
    background-color: #f0fdf4 !important;
    opacity: 0.8;
}

.row-restituita td {
    text-decoration: line-through;
    color: #6b7280;
}

.row-restituita td:last-child {
    text-decoration: none;
}

.row-restituita .badge {
    text-decoration: none;
}

/* Badge secondario */
.badge-secondary {
    background-color: #9ca3af;
    color: white;
}

/* === FORM CARICA MAGAZZINO === */
.magazzino-tipo-card {
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.magazzino-tipo-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 10px 15px;
}

.magazzino-tipo-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.magazzino-tipo-body {
    padding: 15px;
}

.taglie-inputs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.taglia-input-group {
    text-align: center;
}

.taglia-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.taglia-input-group input {
    width: 100%;
    text-align: center;
    padding: 8px 4px;
    font-size: 16px;
    font-weight: 600;
}

.taglia-input-group.single {
    max-width: 120px;
}

.marca-input label {
    font-size: 12px;
    color: #6b7280;
}

.marca-input input {
    font-size: 13px;
}

@media (max-width: 600px) {
    .taglie-inputs {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Btn group */
.btn-group {
    display: flex;
    gap: 10px;
}

/* === SPECIALIZZAZIONI === */
.spec-list {
    margin-top: 10px;
}

.spec-item {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 12px;
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-count {
    display: inline-block;
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    margin-right: 8px;
    font-size: 11px;
}

.text-muted {
    color: #9ca3af;
    font-style: italic;
}

/* Dettaglio specializzazioni volontario */
.spec-vol-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spec-vol-item {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    border-left: 4px solid #8b5cf6;
}

.spec-vol-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.spec-vol-nome {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
}

.spec-vol-details {
    color: #6b7280;
}

.text-danger {
    color: #ef4444;
}

/* reCAPTCHA badge positioning */
.grecaptcha-badge {
    visibility: hidden;
}

/* ==========================================
   FIX GESTIONE FISCALE
   ========================================== */

/* Tab fiscali - posizionamento corretto */
/* Separatore menu sidebar */
.menu-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 15px 20px;
}

.menu-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    padding: 10px 24px 5px;
    font-weight: 600;
}

/* Stile h1 per pagine fiscali */
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* Righe colorate Prima Nota */
.row-entrata { background-color: rgba(16, 185, 129, 0.05); }
.row-uscita { background-color: rgba(239, 68, 68, 0.05); }
.row-totali { background-color: #f3f4f6; font-weight: bold; }

/* Scadenze */
.row-scaduta { background-color: rgba(239, 68, 68, 0.1); }
.row-completata { opacity: 0.6; }

/* Colori statistiche */
.stat-card.stat-green { border-left: 4px solid var(--success); }
.stat-card.stat-green .stat-icon { background: var(--success); }
.stat-card.stat-red { border-left: 4px solid var(--danger); }
.stat-card.stat-red .stat-icon { background: var(--danger); }
.stat-card.stat-blue { border-left: 4px solid var(--primary-light); }
.stat-card.stat-blue .stat-icon { background: var(--primary-light); }
.stat-card.stat-purple { border-left: 4px solid #8b5cf6; }
.stat-card.stat-purple .stat-icon { background: #8b5cf6; }
.stat-card.stat-orange { border-left: 4px solid var(--warning); }
.stat-card.stat-orange .stat-icon { background: var(--warning); }

/* Colori testo */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

/* ==========================================
   CONSIGLIO DIRETTIVO - TAB E CARD
   ========================================== */

/* Tab navigation */
.tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary);
    background: #f3f4f6;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

.tab-btn i {
    font-size: 16px;
}

/* Consiglio Cards Grid */
.consiglio-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.consiglio-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.consiglio-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.consiglio-card.presidente {
    border: 2px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.consiglio-card-foto {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    margin-bottom: 15px;
    background: #f3f4f6;
}

.consiglio-card.presidente .consiglio-card-foto {
    border-color: #f59e0b;
}

.consiglio-card-nome {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
}

.consiglio-card-carica {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

.consiglio-card-carica.presidente { background: #fef3c7; color: #92400e; }
.consiglio-card-carica.vice { background: #dbeafe; color: #1e40af; }
.consiglio-card-carica.segretario { background: #dcfce7; color: #166534; }
.consiglio-card-carica.tesoriere { background: #f3e8ff; color: #6b21a8; }
.consiglio-card-carica.consigliere { background: #f1f5f9; color: #475569; }

.consiglio-card-contatti {
    font-size: 13px;
    color: #6b7280;
    margin-top: 10px;
}

.consiglio-card-contatti a {
    color: var(--primary);
    text-decoration: none;
}

.consiglio-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.consiglio-card:hover .consiglio-card-actions {
    opacity: 1;
}

.consiglio-card-scadenza {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 10px;
}

/* Empty state per card */
.consiglio-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

.consiglio-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* ==========================================
   DOCUMENTI FONDANTI
   ========================================== */

.documenti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.documento-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    transition: all 0.3s ease;
}

.documento-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.documento-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.documento-icon i {
    font-size: 22px;
    color: white;
}

.documento-info {
    flex: 1;
    min-width: 0;
}

.documento-info h4 {
    margin: 0 0 5px;
    font-size: 15px;
    color: #1e293b;
}

.documento-desc {
    margin: 0 0 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.documento-versioni {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.documento-versione {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.documento-versione:hover {
    background: #e5e7eb;
}

.documento-versione.vigente {
    background: #dcfce7;
    border-left: 3px solid #22c55e;
}

.documento-versione .doc-icon {
    color: #dc2626;
}

.documento-versione .doc-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.documento-versione .doc-date {
    color: #9ca3af;
    font-size: 11px;
}

.documento-versione .doc-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.documento-versione:hover .doc-actions {
    opacity: 1;
}

.documento-empty {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    padding: 8px 0;
}

.documento-actions {
    flex-shrink: 0;
}

/* ========== NUOVI STILI MODULI ========== */

/* Tab Formazione */
.formazione-tab-btn {
    padding: 10px 20px;
    border: none;
    background: #e5e7eb;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    transition: all 0.3s;
}

.formazione-tab-btn.active {
    background: #3b82f6;
    color: white;
}

.formazione-tab-btn:hover {
    background: #d1d5db;
}

.formazione-tab-btn.active:hover {
    background: #2563eb;
}

/* Calendario Turni */
.calendario-settimana {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.giorno-calendario {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    min-height: 120px;
    cursor: pointer;
    transition: all 0.3s;
}

.giorno-calendario:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.giorno-calendario.oggi {
    border: 2px solid #3b82f6;
    background: #eff6ff;
}

.giorno-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e5e7eb;
}

.giorno-nome {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
}

.giorno-numero {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
}

.giorno-turni {
    font-size: 12px;
}

.turno-mini {
    padding: 3px 6px;
    margin-bottom: 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Turni */
.turno-card, .reperibilita-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #3b82f6;
}

.reperibilita-card {
    border-left-color: #dc2626;
}

.turno-info, .rep-volontario {
    display: flex;
    align-items: center;
    gap: 10px;
}

.turno-orario, .rep-dettagli {
    font-size: 13px;
    color: #6b7280;
}

.rep-dettagli {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Responsive per calendario */
@media (max-width: 768px) {
    .calendario-settimana {
        grid-template-columns: 1fr;
    }
    
    .giorno-calendario {
        min-height: auto;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1f2937;
    color: white;
    padding: 20px;
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    min-width: 300px;
}

.cookie-text h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.cookie-text p {
    margin: 0;
    font-size: 14px;
    color: #9ca3af;
}

.cookie-text a {
    color: #60a5fa;
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
}


/* === TAB DEPOSITI === */
.depositi-tab {
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    transition: all 0.2s;
}
.depositi-tab:hover {
    background: #e5e7eb;
}
.depositi-tab.active {
    background: #1e3a8a;
    color: white;
}
.depositi-tab-content {
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
}


/* === MODELLO D === */
.modello-d-container {
    padding: 20px;
}
.modello-d-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}
.modello-d-header h2 {
    color: #1e3a8a;
    margin-bottom: 5px;
}
.modello-d-section {
    margin-bottom: 30px;
}
.section-title {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}
.section-title.entrate {
    background: #dcfce7;
    color: #166534;
}
.section-title.uscite {
    background: #fee2e2;
    color: #991b1b;
}
.modello-d-table {
    width: 100%;
    border-collapse: collapse;
}
.modello-d-table th, .modello-d-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}
.modello-d-table th {
    background: #f9fafb;
    font-weight: 600;
    text-align: left;
}
.modello-d-table .importo {
    text-align: right;
    font-family: monospace;
}
.modello-d-table .has-data {
    background: #f0fdf4;
}
.modello-d-table .no-data {
    color: #9ca3af;
}
.modello-d-table .totale-row {
    background: #f3f4f6;
    font-weight: bold;
}
.modello-d-risultato {
    text-align: center;
    padding: 25px;
    border-radius: 12px;
    margin-top: 20px;
}
.modello-d-risultato.positivo {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 2px solid #16a34a;
}
.modello-d-risultato.negativo {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #dc2626;
}
.modello-d-risultato h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}
.modello-d-risultato .risultato-importo {
    font-size: 32px;
    font-weight: bold;
}
.modello-d-risultato.positivo .risultato-importo {
    color: #16a34a;
}
.modello-d-risultato.negativo .risultato-importo {
    color: #dc2626;
}

/* Stili Ricevute */
.row-chiusa {
    background-color: #f0fdf4 !important;
    opacity: 0.8;
}
.row-chiusa td {
    color: #166534;
}
.row-annullata {
    background-color: #fef2f2 !important;
    opacity: 0.7;
    text-decoration: line-through;
}
.row-annullata td {
    color: #991b1b;
}

/* Modal dinamici */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay .modal-content {
    background: white;
    border-radius: 16px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
}

.modal-overlay .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 16px 16px 0 0;
    color: white;
}

.modal-overlay .modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.modal-overlay .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: white;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}

.modal-overlay .modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
}
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}


/* ===================================
   EMERGENZE - Stili specifici
   =================================== */

.presenza-data-group {
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.presenza-data-header {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.presenza-data-header .badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

.presenza-data-list {
    padding: 10px;
}

.presenza-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 5px;
}

.presenza-item:last-child {
    margin-bottom: 0;
}

.presenza-info {
    flex: 1;
}

.presenza-info strong {
    display: block;
    font-size: 14px;
    color: #1f2937;
}

.presenza-info small {
    color: #6b7280;
    font-size: 12px;
}

.volontario-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.volontario-checkbox:hover {
    background: #f3f4f6;
}

.volontario-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.volontario-checkbox span {
    font-size: 14px;
}

/* Badge stati emergenza */
.badge-danger {
    background: #dc2626;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-secondary {
    background: #6b7280;
    color: white;
}

/* =====================================================
   CALENDARIO TURNI
   ===================================================== */

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

.calendario-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    padding: 8px 4px;
    text-transform: uppercase;
}

.calendario-giorno {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: #f9fafb;
}

.calendario-giorno:hover {
    background: #e5e7eb;
}

.calendario-giorno.vuoto {
    background: transparent;
    cursor: default;
}

.calendario-giorno.oggi {
    background: #1e3a8a;
    color: white;
}

.calendario-giorno.oggi:hover {
    background: #1e40af;
}

.calendario-giorno.passato {
    opacity: 0.5;
}

.calendario-giorno.weekend {
    background: #fef3c7;
}

.calendario-giorno.con-turni {
    background: #dbeafe;
    font-weight: 600;
}

.calendario-giorno.con-turni.oggi {
    background: #1e3a8a;
}

.numero-giorno {
    font-size: 14px;
    font-weight: 500;
}

.turni-indicatori {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}

.turno-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.turno-more {
    font-size: 9px;
    color: #6b7280;
}

/* Card dettaglio turno nel modal */
.turno-card-dettaglio {
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
}

.turno-card-dettaglio .turno-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.turno-card-dettaglio .turno-tipo {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.turno-card-dettaglio .turno-orario {
    font-size: 13px;
    color: #6b7280;
}

.turno-card-dettaglio .turno-titolo {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.turno-card-dettaglio .turno-luogo {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.turno-card-dettaglio .turno-volontari {
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
}

.turno-card-dettaglio .turno-azioni {
    display: flex;
    gap: 8px;
}

/* Lista volontari checkbox */
.volontari-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.volontario-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.volontario-checkbox:hover {
    background: #f3f4f6;
}

.volontario-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.volontario-checkbox span {
    font-weight: 500;
    flex: 1;
}

.volontario-checkbox small {
    color: #6b7280;
    font-size: 12px;
}

/* Lista conferme */
.conferme-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.conferme-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.conferme-list li:last-child {
    border-bottom: none;
}

/* =====================================================
   MINI STAT CARDS - DASHBOARD
   ===================================================== */

.mini-stat-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.mini-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e40af;
    line-height: 1.2;
}

.mini-stat-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
}

/* Reperibilità Card */
.reperibilita-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #f59e0b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.reperibilita-card .periodo {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.reperibilita-card .volontario {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fef3c7;
    border-radius: 8px;
    margin-top: 8px;
}

.reperibilita-card .volontario i {
    color: #f59e0b;
}

/* =====================================================
   CALENDARIO REPERIBILITÀ
   ===================================================== */

.reperibilita-giorno {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    min-height: 120px;
}

.reperibilita-giorno.oggi {
    border: 2px solid #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.reperibilita-giorno.weekend {
    background: #f8fafc;
}

.reperibilita-giorno .giorno-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reperibilita-giorno.oggi .giorno-header {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
}

.giorno-nome {
    font-weight: 600;
    font-size: 14px;
}

.giorno-data {
    font-size: 12px;
    opacity: 0.9;
}

.giorno-body {
    padding: 10px;
    min-height: 80px;
}

.reperibilita-slot {
    background: #fef3c7;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.reperibilita-slot:hover {
    background: #fde68a;
    transform: translateX(2px);
}

.reperibilita-slot i {
    color: #f59e0b;
}

.reperibilita-slot.vuoto {
    background: #f1f5f9;
    color: #64748b;
    justify-content: center;
    border: 2px dashed #cbd5e1;
}

.reperibilita-slot.vuoto:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.reperibilita-slot.vuoto i {
    color: #64748b;
}

.reperibilita-slot span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Sub-tabs per sezioni interne */
.sub-tabs {
    display: flex;
    gap: 0;
}

.sub-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.sub-tab:hover {
    color: #3b82f6;
    background: #f3f4f6;
}

.sub-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #eff6ff;
}

.sub-tab i {
    margin-right: 8px;
}

    margin-bottom: 20px;
}

.rapporto-info .info-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.rapporto-info .info-row label {
    width: 100px;
    font-size: 13px;
    color: #6b7280;
    flex-shrink: 0;
}

.rapporto-info .info-row span {
    font-size: 14px;
    color: #1f2937;
}

.rapporto-section {
    margin-bottom: 15px;
}

.rapporto-section h4 {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.rapporto-section p {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Tabs per rapporti */
.tabs-container {
    display: flex;
    gap: 0;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #1e40af;
}

.tab-btn.active {
    background: white;
    color: #1e40af;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rapporti-tab-content {
    animation: fadeIn 0.3s ease;
}

/* Filter row */
.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.filter-group select {
    min-width: 150px;
}

/* Empty state migliorato */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .interventi-grid,
    .selettive-grid {
        grid-template-columns: 1fr;
    }
    
    .dettaglio-info-grid {
        grid-template-columns: 1fr;
    }
    
    .selettiva-stats {
        gap: 15px;
    }
    
    .tabs-container {
        width: 100%;
    }
    
    .tab-btn {
        flex: 1;
        justify-content: center;
    }
}

/* =====================================================
   MAPPA OPERATIVA
   ===================================================== */

.mappa-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    min-height: 500px;
}

.mappa-sidebar {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow-y: auto;
    max-height: 600px;
}

.mappa-sidebar h4 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

.mappa-main {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mappa-container {
    width: 100%;
    height: 500px;
    background: #f1f5f9;
}

.mappa-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
}

.mappa-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* POI Lista */
.poi-categoria {
    margin-bottom: 15px;
}

.poi-categoria-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.poi-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.poi-item {
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.poi-item:hover {
    background: #eff6ff;
    transform: translateX(3px);
}

.poi-item strong {
    display: block;
    font-size: 13px;
    color: #1f2937;
}

.poi-item small {
    font-size: 11px;
    color: #6b7280;
}

/* Legenda */
.legenda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.legenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legenda-item span {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* =====================================================
   PROCEDURE OPERATIVE
   ===================================================== */

.procedure-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.procedure-categoria {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.procedure-categoria-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.categoria-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.procedure-categoria-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1f2937;
    flex: 1;
}

.procedure-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.procedura-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
}

.procedura-card:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.procedura-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.procedura-header h4 {
    margin: 0;
    font-size: 14px;
    color: #1f2937;
}

.versione {
    font-size: 11px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 10px;
}

.procedura-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px;
    line-height: 1.4;
}

.procedura-footer {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #9ca3af;
}

.procedura-footer i {
    margin-right: 4px;
}

/* Procedura View */
.procedura-view {
    padding: 10px;
}

.procedura-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.categoria-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.versione-badge {
    background: #f3f4f6;
    color: #6b7280;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.procedura-view h2 {
    margin: 0 0 15px;
    font-size: 22px;
    color: #1f2937;
}

.procedura-descrizione {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.procedura-steps {
    margin-bottom: 20px;
}

.procedura-steps h4 {
    font-size: 14px;
    color: #374151;
    margin-bottom: 12px;
}

.steps-list {
    margin: 0;
    padding-left: 25px;
}

.steps-list li {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.steps-list li:last-child {
    border-bottom: none;
}

.procedura-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

/* Steps container nel form */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-number {
    width: 28px;
    height: 28px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-input {
    flex: 1;
}

/* =====================================================
   MAGAZZINO
   ===================================================== */

.row-warning {
    background: #fef3c7 !important;
}

.text-danger {
    color: #dc2626 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.font-bold {
    font-weight: 600 !important;
}

/* Responsive */
@media (max-width: 992px) {
    .mappa-layout {
        grid-template-columns: 1fr;
    }
    
    .mappa-sidebar {
        max-height: 250px;
    }
    
    .mappa-container {
        height: 400px;
    }
    
    .procedure-lista {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   ALLERTE METEO EMILIA-ROMAGNA
   ===================================================== */

.loading-allerte {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.loading-allerte i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #3b82f6;
}

/* Banner Principale */
.allerta-banner {
    border-radius: 16px;
    padding: 25px;
    color: white;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.allerta-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.allerta-banner-icon {
    width: 70px;
    height: 70px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.allerta-banner-text {
    flex: 1;
    min-width: 200px;
}

.allerta-banner-text h2 {
    margin: 0 0 5px;
    font-size: 24px;
    font-weight: 700;
}

.allerta-banner-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 15px;
}

.allerta-banner-update {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.allerta-banner-update small {
    opacity: 0.8;
    font-size: 12px;
}

/* Zone Faenza */
.allerta-zone-faenza {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.allerta-zone-faenza h3 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #374151;
}

.zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.zona-card {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.zona-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.zona-header {
    padding: 10px 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.zona-code {
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
}

.zona-nome {
    font-size: 14px;
    font-weight: 500;
}

.zona-rischi {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rischio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.rischio-item i {
    width: 20px;
    text-align: center;
}

.rischio-item span:first-of-type {
    flex: 1;
    color: #4b5563;
}

.rischio-badge {
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

/* Mappa Card */
.allerta-mappa-card {
    margin-bottom: 25px;
}

.mappa-regionale {
    padding: 20px;
}

.zone-mappa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.zona-mappa-item {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.zona-mappa-item:hover {
    transform: scale(1.1);
    z-index: 1;
}

.zona-mappa-item.zona-faenza {
    border: 3px solid #1e40af;
    box-shadow: 0 0 0 2px white;
}

.zona-star {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: #fbbf24;
}

.mappa-note {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #6b7280;
}

.mappa-note i {
    color: #fbbf24;
}

/* Legenda */
.allerta-legenda {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.allerta-legenda h4 {
    margin: 0 0 15px;
    font-size: 14px;
    color: #374151;
}

.legenda-colori {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.legenda-colori .legenda-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legenda-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.legenda-label {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
    min-width: 70px;
}

.legenda-desc {
    font-size: 12px;
    color: #6b7280;
}

/* Fonte */
.allerta-fonte {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 12px;
    color: #6b7280;
}

.allerta-fonte a {
    color: #3b82f6;
    text-decoration: none;
}

.allerta-fonte a:hover {
    text-decoration: underline;
}

/* Widget Dashboard */
.widget-allerta {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    color: white;
}

.widget-allerta-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.widget-allerta-info {
    flex: 1;
}

.widget-allerta-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
}

.widget-allerta-level {
    font-size: 18px;
    font-weight: 700;
}

.widget-allerta-link {
    color: white;
    opacity: 0.8;
    font-size: 18px;
}

.widget-allerta-link:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .allerta-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .allerta-banner-update {
        align-items: center;
    }
    
    .zone-grid {
        grid-template-columns: 1fr;
    }
    
    .zone-mappa-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =====================================================
   FILE UPLOAD AREA
   ===================================================== */

.file-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    background: #f9fafb;
}

.file-upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.file-upload-area.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
}

.dropzone-content {
    cursor: pointer;
    padding: 10px;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.file-preview span {
    font-size: 14px;
    color: #374151;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================================================
   CENTRO OPERATIVO - DISPONIBILITA E SQUADRE
   ===================================================== */

/* Tab operativo */
.operativo-tab-btn {
    padding: 12px 24px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    margin-right: 10px;
}

.operativo-tab-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.operativo-tab-btn.active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.operativo-tab-content {
    padding: 20px 0;
}

/* Grid disponibilità */
.disponibilita-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
}

/* Card disponibilità */
.disponibilita-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #d1d5db;
    transition: all 0.2s;
}

.disponibilita-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.disponibilita-card.disponibile {
    border-left-color: #10b981;
    background: linear-gradient(135deg, rgba(16,185,129,0.05), white);
}

.disponibilita-card.in-servizio {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59,130,246,0.05), white);
}

.disponibilita-card.non-disponibile {
    border-left-color: #ef4444;
    opacity: 0.7;
}

.disp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.disp-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.disp-info {
    flex: 1;
}

.disp-nome {
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}

.disp-matricola {
    font-size: 12px;
    color: #64748b;
}

.disp-stato {
    text-align: right;
}

.stato-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.stato-badge.disponibile {
    background: #dcfce7;
    color: #166534;
}

.stato-badge.in-servizio {
    background: #dbeafe;
    color: #1e40af;
}

.stato-badge.non-disponibile {
    background: #fee2e2;
    color: #991b1b;
}

.disp-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 28px;
}

.spec-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spec-badge.more {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.no-spec {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

.disp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.disp-update {
    font-size: 11px;
    color: #9ca3af;
}

.disp-actions {
    display: flex;
    gap: 5px;
}

/* Grid squadre */
.squadre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.squadra-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.squadra-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.squadra-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8fafc;
}

.squadra-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.squadra-info {
    flex: 1;
}

.squadra-nome {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.3;
}

.squadra-categoria {
    font-size: 12px;
    color: #64748b;
}

.squadra-stats {
    display: flex;
    padding: 15px;
    gap: 15px;
}

.squadra-stat {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background: #f8fafc;
}

.squadra-stat .stat-num {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.squadra-stat .stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
}

.squadra-stat.disponibile {
    background: #dcfce7;
}

.squadra-stat.disponibile .stat-num {
    color: #166534;
}

.squadra-stat.in-servizio {
    background: #dbeafe;
}

.squadra-stat.in-servizio .stat-num {
    color: #1e40af;
}

.squadra-actions {
    display: flex;
    gap: 10px;
    padding: 0 15px 15px;
}

.squadra-actions .btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .disponibilita-grid,
    .squadre-grid {
        grid-template-columns: 1fr;
    }
    
    .operativo-tab-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* =====================================================
   FILTRI ALLERTE METEO
   ===================================================== */

/* Checkbox buttons per filtri */
.checkbox-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #475569;
}

.checkbox-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.checkbox-btn input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #3b82f6;
}

.checkbox-btn:has(input:checked) {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.checkbox-btn:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Badge filtri attivi */
.filtro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px;
    color: #64748b;
}

.filtro-badge i {
    font-size: 11px;
}

.filtro-badge.filtro-attivo {
    background: #fef3c7;
    color: #92400e;
}

/* Badge allerta tabella */
.badge-allerta {
    display: inline-block;
    min-width: 60px;
    text-align: center;
    font-weight: 600;
}

/* Zone grid migliorata */
.zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.zona-card {
    background: white;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.2s;
}

.zona-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.zona-header {
    padding: 12px 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.zona-code {
    font-size: 20px;
    font-weight: 800;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 8px;
}

.zona-nome {
    font-weight: 600;
    font-size: 14px;
}

.zona-rischi {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rischio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.rischio-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.rischio-item span:first-of-type {
    flex: 1;
    font-size: 13px;
    color: #475569;
}

.rischio-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .checkbox-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .zone-grid {
        grid-template-columns: 1fr;
    }
}
