/**
 * Stili per il sistema di consenso ai cookie di Meritocrazia Italia
 * Conforme al GDPR e alla normativa italiana sui cookie
 */

/* Banner di consenso ai cookie */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease-in-out;
}

#cookie-consent-banner.show {
    opacity: 1;
    transform: translateY(0);
}

.cookie-consent-overlay {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    border-top: 3px solid #0066cc;
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cookie-consent-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-consent-header i {
    color: #ffd700;
    font-size: 1.3rem;
}

.cookie-consent-body {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e6f3ff;
}

.cookie-consent-body p {
    margin: 0 0 10px 0;
}

.cookie-consent-body a {
    color: #87ceeb;
    text-decoration: underline;
    font-weight: 500;
}

.cookie-consent-body a:hover {
    color: #ffffff;
    text-decoration: none;
}

.cookie-consent-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.cookie-consent-actions .btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.cookie-consent-actions .btn-primary {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.cookie-consent-actions .btn-primary:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.cookie-consent-actions .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.cookie-consent-actions .btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-1px);
}

.cookie-consent-actions .btn-outline-secondary {
    background-color: transparent;
    border-color: #ffffff;
    color: #ffffff;
}

.cookie-consent-actions .btn-outline-secondary:hover {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #003366;
    transform: translateY(-1px);
}

/* Modal delle impostazioni cookie */
#cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

#cookie-settings-modal.show {
    opacity: 1;
    visibility: visible;
}

.cookie-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cookie-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#cookie-settings-modal.show .cookie-modal-content {
    transform: scale(1);
}

.cookie-modal-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #0066cc;
}

.cookie-modal-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-modal-header i {
    color: #ffd700;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.btn-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-close::before {
    content: "×";
    font-weight: bold;
}

.cookie-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.cookie-category {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.cookie-category:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cookie-category-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.cookie-category-header .form-check {
    margin: 0;
}

.cookie-category-header .form-check-label {
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-category-header .form-check-input {
    margin-top: 0;
    transform: scale(1.2);
}

.cookie-category-header .form-check-input:disabled {
    opacity: 0.7;
}

.cookie-category-header .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
}

.cookie-category-description {
    padding: 15px 20px;
    background-color: white;
}

.cookie-category-description p {
    margin: 0 0 10px 0;
    color: #495057;
    line-height: 1.5;
}

.cookie-category-description small {
    font-style: italic;
}

.cookie-modal-footer {
    background-color: #f8f9fa;
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.cookie-modal-footer .btn {
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cookie-modal-footer .btn-primary {
    background-color: #003366;
    border-color: #003366;
}

.cookie-modal-footer .btn-primary:hover {
    background-color: #002244;
    border-color: #002244;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 51, 102, 0.3);
}

.cookie-modal-footer .btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

.cookie-modal-footer .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Toast di conferma */
.cookie-consent-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-left: 4px solid #28a745;
    padding: 15px 20px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.cookie-consent-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #495057;
}

.toast-content i {
    font-size: 1.2rem;
}

/* Switch personalizzato per Bootstrap 5 */
.form-check-input:checked {
    background-color: #003366;
    border-color: #003366;
}

.form-check-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(0, 51, 102, 0.25);
}

/* Responsive design */
@media (max-width: 768px) {
    .cookie-consent-content {
        text-align: center;
    }
    
    .cookie-consent-actions {
        justify-content: center;
        flex-direction: column;
    }
    
    .cookie-consent-actions .btn {
        width: 100%;
        margin: 2px 0;
    }
    
    .cookie-modal-overlay {
        padding: 10px;
    }
    
    .cookie-modal-content {
        max-height: 95vh;
    }
    
    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 15px 20px;
    }
    
    .cookie-modal-footer {
        flex-direction: column;
    }
    
    .cookie-modal-footer .btn {
        width: 100%;
        margin: 2px 0;
    }
    
    .cookie-consent-toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .cookie-consent-overlay {
        padding: 15px;
    }
    
    .cookie-consent-header h4 {
        font-size: 1.1rem;
    }
    
    .cookie-consent-body {
        font-size: 0.9rem;
    }
    
    .cookie-modal-header h4 {
        font-size: 1.2rem;
    }
    
    .cookie-category-header,
    .cookie-category-description {
        padding: 12px 15px;
    }
}

/* Animazioni aggiuntive */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Accessibilità */
.cookie-consent-actions .btn:focus,
.cookie-modal-footer .btn:focus,
.btn-close:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 51, 102, 0.25);
}

/* Stili per la stampa */
@media print {
    #cookie-consent-banner,
    #cookie-settings-modal,
    .cookie-consent-toast {
        display: none !important;
    }
}

/* Stili per il link "Gestisci Cookie" nel footer */
.manage-cookies-link {
    color: #003366;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.manage-cookies-link:hover {
    color: #0066cc;
    text-decoration: none;
}

/* Indicatore di stato per i cookie */
.cookie-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.cookie-status-indicator.enabled {
    background-color: #28a745;
}

.cookie-status-indicator.disabled {
    background-color: #dc3545;
}

/* Stili per il dark mode (opzionale) */
@media (prefers-color-scheme: dark) {
    .cookie-modal-content {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .cookie-modal-header {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .cookie-category {
        border-color: #4a5568;
    }
    
    .cookie-category-header {
        background-color: #4a5568;
        border-color: #4a5568;
    }
    
    .cookie-category-description {
        background-color: #2d3748;
        color: #cbd5e0;
    }
    
    .cookie-modal-footer {
        background-color: #4a5568;
        border-color: #4a5568;
    }
    
    .cookie-consent-toast {
        background-color: #2d3748;
        color: #e2e8f0;
    }
}
