/* Custom CSS for Med Alessia application - Ottimizzato per contrasto WCAG */

/* === TESTI PRINCIPALI - Contrasto ottimizzato === */
/* Testo nero su sfondo chiaro per massimo contrasto (21:1) */
p, div, span, label, small, h1, h2, h3, h4, h5, h6, li, td, th, 
.text-black, .navbar-brand {
    color: #000000 !important;
}

/* Testo grigio scuro per elementi secondari - contrasto minimo 7:1 */
.text-muted, .text-secondary {
    color: #424242 !important;
}

/* === ELEMENTI CON SFONDO COLORATO === */
/* Testo bianco su sfondi scuri per contrasto ottimale */
.card-header.bg-primary, .bg-primary, .navbar-dark, .footer.bg-dark, 
.btn-primary, .btn-accent, .mobile-nav, .mobile-nav-item {
    color: #ffffff !important;
}

/* === BOTTONI E LINK === */
/* Bottoni primari con contrasto elevato */
.btn-primary, .btn-accent {
    color: #ffffff !important;
    background-color: var(--bs-primary);
}

/* Bottoni outline con contrasto migliorato */
.btn-outline-primary {
    color: #005a4a !important; /* Verde scuro per contrasto su bianco */
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    color: #ffffff !important;
    background-color: var(--bs-primary);
}

/* Link con contrasto migliorato */
a.text-primary {
    color: #005a4a !important; /* Verde scuro per contrasto */
}

a.text-primary:hover, a.text-primary:focus {
    color: #003d32 !important; /* Verde più scuro al hover */
}

/* Color palette based on Med Alessia logo */
:root {
    --bs-primary: #00A387;        /* Verde primario (dal logo) */
    --bs-primary-rgb: 0, 163, 135;
    --bs-secondary: #4DD6C1;      /* Verde acqua (dal logo) */
    --bs-secondary-rgb: 77, 214, 193;
    --bs-accent: #00353F;         /* Verde scuro (dal logo) */
    --bs-accent-rgb: 0, 53, 63;
    --bs-light-blue: #E6FFF9;     /* Verde chiarissimo per sfondi */
    --bs-light-blue-rgb: 230, 255, 249;
    --bs-warning: #FFFFFF;        /* Bianco per enfasi */
    --bs-warning-rgb: 255, 255, 255;
    --bs-white-contrast: #004854; /* Colore per testo su sfondo chiaro */
}

/* Impostazione font e sfondo */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', 'Roboto', sans-serif;
    background-image: url('../img/med-alessia-background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #000000; /* Colore testo principale nero */
    line-height: 1.6;
    position: relative;
}

/* Overlay per migliorare la leggibilità del testo sul background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.85); /* Overlay bianco semi-trasparente */
    z-index: -1;
}

.footer {
    margin-top: auto;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', 'Roboto', sans-serif;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Medical icon styling */
.medical-icon {
    color: var(--bs-primary);
}

/* Custom card styles */
.card {
    border-radius: 0.5rem;
    border: none;
}

.card-header {
    border-radius: calc(0.5rem - 1px) calc(0.5rem - 1px) 0 0;
}

/* Custom form styling - Contrasto ottimizzato */
.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    color: #000000 !important; /* Testo nero per contrasto */
}

.form-control, .form-select {
    color: #000000 !important; /* Testo nero per contrasto */
    background-color: #ffffff;
    border-color: #ced4da;
}

.form-control::placeholder {
    color: #6c757d !important; /* Grigio per placeholder leggibile */
}

.form-label {
    color: #212529 !important; /* Nero per etichette */
    font-weight: 500;
}

.form-text {
    color: #424242 !important; /* Grigio scuro per testo di aiuto */
}

/* Input group styling */
.input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #424242 !important; /* Grigio scuro per icone */
}

/* Smooth transitions */
.btn, .nav-link, .list-group-item {
    transition: all 0.3s ease;
}

/* Navbar enhancements */
.navbar-brand {
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Diagnosis result formatting */
.diagnosis-section {
    border-left: 4px solid var(--bs-primary);
    padding-left: 15px;
    margin-bottom: 20px;
}

/* Custom alert styling - Contrasto ottimizzato */
.alert-medical {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    border-color: rgba(var(--bs-primary-rgb), 0.2);
    color: #005a4a !important; /* Verde scuro per contrasto su sfondo chiaro */
}

/* Alert Bootstrap con contrasto migliorato */
.alert-info {
    background-color: #e7f3ff;
    border-color: #b8daff;
    color: #0c4a6e !important; /* Blu scuro per contrasto */
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #8b4513 !important; /* Marrone scuro per contrasto */
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f1aeb5;
    color: #721c24 !important; /* Rosso scuro per contrasto */
}

/* Add some nice hover effects for interactive elements */
.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* List group items con contrasto ottimizzato */
.list-group-item {
    color: #000000 !important; /* Testo nero per contrasto */
}

.list-group-item a {
    color: #000000 !important; /* Link neri in liste */
    text-decoration: none;
}

.list-group-item a:hover {
    color: #005a4a !important; /* Verde scuro al hover */
    text-decoration: underline;
}

/* Card footer con contrasto migliorato */
.card-footer {
    background-color: #f8f9fa;
    color: #424242 !important; /* Grigio scuro per contrasto */
}

/* Text utilities override per contrasto */
.text-info {
    color: #0c4a6e !important; /* Blu scuro per contrasto */
}

.text-warning {
    color: #8b4513 !important; /* Marrone scuro per contrasto */
}

.text-success {
    color: #155724 !important; /* Verde scuro per contrasto */
}

.text-danger {
    color: #721c24 !important; /* Rosso scuro per contrasto */
}

/* Make medical theme more prominent */
.fas.fa-heartbeat, .fas.fa-stethoscope, .fas.fa-user-md {
    color: var(--bs-primary);
}

/* Custom badge styles - Contrasto ottimizzato */
.badge.bg-info {
    background-color: #0c4a6e !important; /* Blu scuro per contrasto */
    color: #ffffff !important;
}

.badge.bg-light {
    background-color: #f8f9fa !important;
    color: #212529 !important; /* Nero per contrasto su sfondo chiaro */
}

.badge.bg-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

/* Custom blockquote styling for medical information */
blockquote.medical-info {
    border-left: 4px solid var(--bs-primary);
    padding-left: 1rem;
    margin-left: 0;
    font-style: italic;
}

/* Make form actions more prominent */
.form-action {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Function cards styling */
.function-card {
    height: 140px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.function-card .card-title {
    white-space: nowrap;
    font-size: 0.95rem;
}

.function-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 1;
}

.function-card .card-body {
    position: relative;
    z-index: 2;
    height: 100%;
}

/* Background images for each card */
.diagnosis-card::before {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="white" stroke-width="2"/><path d="M30 50 L45 65 L70 35" fill="none" stroke="white" stroke-width="3"/></svg>');
}

.xray-card::before {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="20" y="25" width="60" height="50" fill="none" stroke="white" stroke-width="2" rx="5"/><circle cx="35" cy="40" r="3" fill="white"/><circle cx="65" cy="40" r="3" fill="white"/><path d="M25 60 Q50 45 75 60" fill="none" stroke="white" stroke-width="2"/></svg>');
}

.blood-card::before {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="30" cy="40" r="8" fill="white" opacity="0.7"/><circle cx="50" cy="55" r="6" fill="white" opacity="0.5"/><circle cx="70" cy="35" r="7" fill="white" opacity="0.6"/><circle cx="45" cy="75" r="5" fill="white" opacity="0.4"/></svg>');
}

.drug-card::before {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="25" y="35" width="15" height="30" fill="white" opacity="0.6" rx="3"/><rect x="35" y="25" width="30" height="15" fill="white" opacity="0.7" rx="7"/><circle cx="70" cy="25" r="5" fill="white" opacity="0.5"/><circle cx="75" cy="45" r="3" fill="white" opacity="0.6"/><rect x="60" y="60" width="20" height="8" fill="white" opacity="0.4" rx="4"/></svg>');
}

.function-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.function-card:hover::before {
    opacity: 0.25;
}

.function-card .btn {
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.function-card:hover .btn {
    transform: scale(1.05);
}

/* Stili per Avatar della Dottoressa */
.doctor-avatar-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
}

.doctor-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--bs-primary);
    background-color: white;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.doctor-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.doctor-avatar-bubble {
    position: absolute;
    top: -50px;
    right: -20px;
    background-color: rgba(77, 214, 193, 0.15); /* Verde acqua con trasparenza */
    border: 1px solid var(--bs-primary);
    border-radius: 20px;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(0, 163, 135, 0.2);
    max-width: 300px;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.3s ease;
    transform: translateY(10px);
    z-index: 10;
    color: var(--bs-accent); /* Testo in verde scuro */
    font-weight: 500;
}

.doctor-avatar-container:hover .doctor-avatar-bubble {
    opacity: 1;
    transform: translateY(0);
}

.doctor-avatar-bubble:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 45%;
    width: 20px;
    height: 20px;
    background-color: rgba(77, 214, 193, 0.15);
    border-right: 1px solid var(--bs-primary);
    border-bottom: 1px solid var(--bs-primary);
    transform: rotate(45deg);
    z-index: -1;
}

/* Stili per pulsanti di azione principale */
.btn-accent {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-radius: 30px;
    box-shadow: 0 4px 8px rgba(0, 163, 135, 0.3);
}

.btn-accent:hover, .btn-accent:focus {
    background-color: #008e76; /* Leggermente più scuro */
    border-color: #008e76;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 163, 135, 0.4);
}

/* Stili per link di testo */
a.text-primary, a.text-black {
    color: #000000 !important;
}

a.text-primary:hover, a.text-black:hover {
    color: #333333 !important;
    text-decoration: underline;
}

/* Footer aggiornato con colori del logo */
.footer.bg-dark {
    background-color: var(--bs-accent) !important;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-top: 4px solid var(--bs-primary);
}

.footer .dedication {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.5;
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-top: 0.75rem;
}

/* Design moderno per card */
.card {
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-header {
    border-bottom: none;
    padding: 1.2rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Nav tab personalizzati - Contrasto ottimizzato */
.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #424242 !important; /* Grigio scuro per contrasto */
    font-weight: 500;
    padding: 1rem 1.5rem;
}

.nav-tabs .nav-link.active, 
.nav-tabs .nav-link:hover {
    color: #005a4a !important; /* Verde scuro per contrasto */
    border-bottom-color: var(--bs-primary);
    background-color: transparent;
}

/* Navbar links con contrasto migliorato */
.navbar-nav .nav-link {
    color: #212529 !important; /* Nero per contrasto su navbar chiara */
}

.navbar-nav .nav-link:hover, 
.navbar-nav .nav-link:focus {
    color: #005a4a !important; /* Verde scuro al hover */
}

.navbar-nav .nav-link.active {
    color: #005a4a !important; /* Verde scuro per link attivo */
    font-weight: 600;
}

/* Adattabilità e accessibilità */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    body.dark-mode .card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    body.dark-mode .doctor-avatar-bubble {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }
    
    body.dark-mode .doctor-avatar-bubble:after {
        background-color: #1e1e1e;
    }
}

/* Miglioramento della spaziatura generale */
.section-spacing {
    margin-bottom: 3rem;
}

.content-spacing {
    padding: 2rem;
}

/* Card con vetro smerigliato per effetto moderno */
.card {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Card header verde Med Alessia */
.card-header.bg-primary {
    background-color: var(--bs-primary) !important;
}

/* Card header secondario */
.card-header.bg-secondary {
    background-color: var(--bs-secondary) !important;
}

/* Stili per la Barra di Navigazione Laterale (mobile) - Bordi Verticali */
.mobile-nav-left, .mobile-nav-right {
    display: none;
}

@media (max-width: 768px) {
    /* Barra sinistra - Solo Lastre */
    .mobile-nav-left {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        background-color: var(--bs-primary);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        border-top-right-radius: 20px;
        border-bottom-right-radius: 20px;
        padding: 15px 8px;
        width: 60px;
        align-items: center;
    }
    
    /* Barra destra - Home, Cronologia, Tema, Esci */
    .mobile-nav-right {
        display: flex;
        flex-direction: column;
        position: fixed;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        background-color: var(--bs-primary);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
        padding: 15px 8px;
        width: 60px;
        align-items: center;
        gap: 10px;
    }
    
    /* Stili per gli elementi delle barre laterali */
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        padding: 8px 4px;
        border-radius: 12px;
        transition: all 0.3s ease;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .mobile-nav-item:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: white;
        transform: scale(1.05);
    }
    
    .mobile-nav-icon {
        font-size: 1.2rem;
        color: rgba(255, 255, 255, 0.8);
        margin-bottom: 3px;
    }
    
    .mobile-nav-text {
        font-size: 0.55rem;
        color: rgba(255, 255, 255, 0.8);
        font-weight: 500;
        text-align: center;
        line-height: 1;
        white-space: nowrap;
    }
    
    .mobile-nav-item.active {
        background-color: rgba(255, 255, 255, 0.25);
    }
    
    .mobile-nav-item.active .mobile-nav-icon,
    .mobile-nav-item.active .mobile-nav-text {
        color: white;
        font-weight: 600;
    }
    
    /* Rimuovi padding inferiore dal body */
    body {
        padding-bottom: 20px;
    }
}

/* Navbar principale colore dal logo */
.navbar.navbar-dark.bg-primary {
    background-color: var(--bs-primary) !important;
    box-shadow: 0 2px 10px rgba(0, 163, 135, 0.3);
}

/* Fumetto della dottoressa - stile migliorato */
.doctor-speech-bubble {
    position: relative;
    background: white;
    border: 2px solid var(--bs-primary);
    border-radius: 15px;
    padding: 12px 16px;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    color: var(--bs-dark);
    line-height: 1.3;
    margin-top: 15px;
}

/* Coda del fumetto */
.doctor-speech-bubble::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

.doctor-speech-bubble::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid var(--bs-primary);
}

/* Navbar toggler con icona personalizzata a tre linee */
.navbar-light .navbar-toggler {
    border: 2px solid #005a4a;
    border-radius: 6px;
    padding: 8px 10px;
    background-color: transparent;
    transition: all 0.3s ease;
}

.navbar-light .navbar-toggler:hover {
    background-color: rgba(0, 90, 74, 0.1);
    border-color: #003d32;
}

.navbar-light .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 90, 74, 0.25);
    outline: none;
}

/* Icona hamburger personalizzata con tre linee */
.navbar-light .navbar-toggler-icon {
    background-image: none !important;
    width: 24px;
    height: 18px;
    position: relative;
    display: inline-block;
}

.navbar-light .navbar-toggler-icon::before,
.navbar-light .navbar-toggler-icon::after,
.navbar-light .navbar-toggler-icon {
    background-color: #005a4a;
}

.navbar-light .navbar-toggler-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 3px;
    background-color: #005a4a;
    border-radius: 2px;
}

.navbar-light .navbar-toggler-icon::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 3px;
    background-color: #005a4a;
    border-radius: 2px;
}

.navbar-light .navbar-toggler-icon {
    background-color: #005a4a;
    height: 3px;
    border-radius: 2px;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

/* Logo Home nel navbar - cuore verde statico */
.logo-container svg {
    transition: opacity 0.3s ease;
}

.logo-container:hover svg {
    opacity: 0.8;
}

/* Miglioramento visibilità dropdown e campi input */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.dropdown-menu .dropdown-item {
    color: #212529 !important;
    background-color: transparent !important;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    color: #1e2125 !important;
    background-color: #e9ecef !important;
}

.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active {
    color: #fff !important;
    background-color: #0d6efd !important;
}

/* Campi di input con contrasto migliorato */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

.form-control:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Placeholder con contrasto adeguato */
.form-control::placeholder,
.form-select::placeholder,
input::placeholder,
textarea::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

/* Dropdown delle bandiere con sfondo chiaro */
.language-flag-option {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-flag-option:hover {
    background-color: #f8f9fa !important;
    border-color: #0d6efd !important;
}

.language-flag-option.active {
    background-color: #e7f3ff !important;
    border-color: #0d6efd !important;
}

/* Lista dropdown del menu principale */
#navbarDropdown + .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

#navbarDropdown + .dropdown-menu .dropdown-item {
    color: #212529 !important;
    padding: 0.5rem 1rem;
}

#navbarDropdown + .dropdown-menu .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #0d6efd !important;
}
