/**
 * Stili comuni per tutte le pagine
 */

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Sfondo con emblema */
.bg-emblema {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 1000px;
    height: auto;
    opacity: 0.15;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* Logo nell'header */
.header-logo {
    display: block;
    margin: 30px auto 10px auto;
    max-width: 180px;
    width: 100%;
    height: auto;
    z-index: 1;
    position: relative;
}

/* Container per il login */
.login-container {
    background: rgba(255,255,255,0.15);
    border-radius: 18px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.18);
    padding: 32px 32px 24px 32px;
    margin-top: 30px;
    z-index: 1;
    position: relative;
}

/* Input di dimensione ridotta */
.input-small {
    width: 5% !important;
    min-width: 180px;
}

.input-group.input-small {
    width: 5% !important;
    min-width: 180px;
}

/* Form inline */
.form-inline .form-group {
    margin-right: 1rem;
    margin-bottom: 0;
}

.form-inline label {
    margin-right: 0.5rem;
    font-weight: bold;
    white-space: nowrap;
}

/* Card con ombra */
.card-shadow {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card-shadow:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    transform: translateY(-5px);
}

/* Pulsanti con icone */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    margin-right: 8px;
}

/* Campi obbligatori */
.required-field::after {
    content: " *";
    color: red;
}

/* Colori personalizzati */
.text-purple {
    color: #6f42c1 !important;
}

.btn-purple {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: white;
}

.btn-purple:hover {
    background-color: #5a359a;
    border-color: #5a359a;
    color: white;
}

/* Navbar personalizzata */
.navbar-custom {
    background-color: #343a40;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-custom .navbar-brand img {
    height: 40px;
}

/* Footer */
.footer {
    margin-top: 50px;
    padding: 20px 0;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
    padding: 15px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: none;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.pwa-install-banner.show {
    transform: translateY(0);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 15px;
}

.pwa-banner-icon img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.pwa-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.pwa-banner-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.pwa-banner-buttons .btn {
    border: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.pwa-banner-buttons .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.pwa-banner-buttons .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.pwa-banner-buttons .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pwa-banner-buttons .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* PWA Status Indicator */
.pwa-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 1040;
    display: none;
    animation: slideInRight 0.3s ease;
}

.pwa-status.offline {
    background: #dc3545;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive PWA Banner */
@media (max-width: 768px) {
    .pwa-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .pwa-banner-text {
        order: 1;
    }
    
    .pwa-banner-icon {
        order: 2;
    }
    
    .pwa-banner-buttons {
        order: 3;
        justify-content: center;
        width: 100%;
    }
    
    .pwa-banner-buttons .btn {
        flex: 1;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 12px;
    }
    
    .pwa-banner-text strong {
        font-size: 1rem;
    }
    
    .pwa-banner-text p {
        font-size: 0.8rem;
    }
    
    .pwa-banner-buttons .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* Stili per il recupero password */
.forgot-password-link {
    transition: color 0.2s ease;
}

.forgot-password-link:hover {
    color: #007bff !important;
    text-decoration: none;
}

/* Alert personalizzati per il recupero password */
.alert-password-reset {
    border-left: 4px solid #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.alert-password-success {
    border-left: 4px solid #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

/* Animazione per i campi password */
.password-field {
    position: relative;
}

.password-field input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border-color: #007bff;
}

/* Indicatore di forza password */
.password-strength {
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.password-strength-weak {
    background-color: #dc3545;
}

.password-strength-medium {
    background-color: #ffc107;
}

.password-strength-strong {
    background-color: #28a745;
}

/* Responsive */
@media (max-width: 768px) {
    .header-logo {
        max-width: 150px;
    }
    
    .login-container {
        padding: 20px;
    }
    
    .form-group.row {
        flex-direction: column;
    }
    
    .form-group.row .col-4,
    .form-group.row .col-8 {
        max-width: 100%;
        flex: 0 0 100%;
    }
    
    .form-group.row label {
        text-align: left !important;
        margin-bottom: 5px;
    }
}

/* Stili per i checkbox delle province regionali */
#province_checkboxes {
    column-count: 2;
    column-gap: 20px;
    column-fill: balance;
}

#province_checkboxes .form-check {
    break-inside: avoid;
    margin-bottom: 8px;
}

#province_checkboxes .form-check-input {
    margin-right: 8px;
}

#province_checkboxes .form-check-label {
    font-size: 0.9rem;
    cursor: pointer;
}

/* Stili per i campi disabilitati (grigi) */
.form-select:disabled,
.form-control:disabled {
    background-color: #e9ecef !important;
    opacity: 0.65;
    cursor: not-allowed;
}

/* Responsive per i checkbox delle province */
@media (max-width: 768px) {
    #province_checkboxes {
        column-count: 1;
    }
}

/* Stili per i pulsanti di selezione province */
.province-actions {
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
    margin-top: 10px;
}

.province-actions .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}