/* compatibility.css - Compatibilità tra vecchio stile e modern-style.css */

/*
 * Questo file va incluso DOPO modern-style.css per garantire la compatibilità
 * visiva con i vecchi elementi style.css e localStyle.css
 * 
 * Ordine di inclusione nel <head>:
 * 1. style.css (se necessario per altre pagine)
 * 2. localStyle.css (se necessario per altre pagine)
 * 3. modern-style.css
 * 4. compatibility.css (questo file)
 */

/* ===== ACCORDION E DIV.CONTENU - COMPATIBILITÀ VECCHIO STILE ===== */

/* Accordion container */
#accordion {
    margin: 0 !important;
    padding: 0 !important;
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    border: none !important;
    box-shadow: none !important;
}

/* Accordion headers (h3) - stile originale */
#accordion > h3 {
    background-color: white !important;
    background: white !important;
    color: black !important;
    padding: 10px !important;
    margin: 10px 0 !important; /* Spazio tra gli h3 */
    cursor: pointer;
    border: none !important;
    border-radius: 5px !important; /* Angoli leggermente arrotondati */
    box-shadow: none !important; /* Rimuove ombre */
    font-weight: normal;
}

#accordion > h3:hover {
    background-color: #f0f0f0 !important; /* Leggermente grigio al hover */
    color: black !important;
}

/* Div.contenu e div dentro accordion - SFONDO BLU */
/* Selettori più specifici per vincere su localStyle.css */
body div.contenu,
body #accordion > div,
body #accordion > div.contenu,
div.content-wrapper div.contenu,
div.content-wrapper #accordion > div {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    color: white !important;
    padding: 15px !important;
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    margin: 0 !important;
}

/* Fallback con selettore base */
div.contenu,
#accordion > div,
#accordion > div.contenu {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
}

/* Assicura che tutto il testo dentro contenu sia bianco */
div.contenu,
div.contenu p,
div.contenu span,
div.contenu li,
div.contenu div:not(.error_strings),
#accordion > div,
#accordion > div p,
#accordion > div span,
#accordion > div li,
#accordion > div div:not(.error_strings) {
    color: white !important;
}

/* Links dentro div.contenu - gialli come originale */
div.contenu a,
#accordion > div a,
div.contenu a:link,
#accordion > div a:link {
    color: yellow !important;
    text-decoration: none !important;
}

div.contenu a:visited,
#accordion > div a:visited {
    color: yellow !important;
}

div.contenu a:hover,
#accordion > div a:hover {
    text-decoration: underline !important;
    color: yellow !important; /* Mantiene giallo anche al hover */
    cursor: pointer;
}

/* Liste dentro contenu */
div.contenu ul,
#accordion > div ul {
    color: white !important;
    list-style-type: disc;
    padding-left: 20px;
}

div.contenu ol,
#accordion > div ol {
    color: white !important;
    padding-left: 20px;
}

div.contenu li,
#accordion > div li {
    color: white !important;
    margin-bottom: 0.5em;
}

/* Form::displayUl() (es. Nouvelle regate) usa <ul><li> per il layout dei
   campi, non per una lista di testo: niente bullet, stesso padding del
   vecchio layout (form.ulist ul in style.css). !important necessario per
   battere "#accordion > div ul" qui sopra (selettore basato su ID, quando
   il form e' dentro un accordion la sua specificita' vince comunque). */
div.contenu form.ulist ul,
#accordion form.ulist ul {
    list-style-type: none !important;
    padding-left: 10px;
}

/* Override card Bootstrap quando usate con elementi legacy */
#accordion.card,
#accordion > .card,
div.contenu.card {
    background: rgb(21, 65, 135) !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
}

#accordion .card-header,
div.contenu .card-header {
    background: rgb(21, 65, 135) !important;
    border-radius: 0 !important;
    border: none !important;
    color: white !important;
}

/* Card header generale - sfondo blu con testo bianco */
.card-header {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    color: white !important;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    color: white !important;
}

#accordion .card-body,
div.contenu .card-body {
    background: rgb(21, 65, 135) !important;
    color: white !important;
    padding: 15px !important;
}

/* ===== CLASS white_over_dark - COMPATIBILITÀ ===== */

/* Classe white_over_dark per testo bianco su sfondo scuro */
.white_over_dark {
    color: white !important;
}

.white_over_dark a {
    color: yellow !important;
    text-decoration: none !important;
}

.white_over_dark a:hover {
    text-decoration: underline !important;
    cursor: pointer;
}

/* ===== JQUERY UI ACCORDION COMPATIBILITY ===== */

/* Override jQuery UI accordion per mantenere lo stile originale */
.ui-accordion .ui-accordion-header {
    background: white !important;
    color: black !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 10px !important;
}

/* Forza testo nero anche per tutti gli elementi dentro gli h3 dell'accordion */
#accordion > h3,
#accordion > h3 *,
.ui-accordion .ui-accordion-header,
.ui-accordion .ui-accordion-header *,
.ui-accordion .ui-accordion-header.ui-state-default,
.ui-accordion .ui-accordion-header.ui-state-default *,
.ui-accordion .ui-accordion-header.ui-state-active,
.ui-accordion .ui-accordion-header.ui-state-active * {
    color: black !important;
}

.ui-accordion .ui-accordion-content {
    background: rgb(21, 65, 135) !important;
    color: white !important;
    border: none !important;
    padding: 15px !important;
}

.ui-accordion .ui-accordion-header:hover {
    background: #f0f0f0 !important;
    color: black !important;
}

/* Rimuove icone jQuery UI se presenti */
.ui-accordion .ui-accordion-header .ui-icon {
    display: none;
}

/* Override classi jQuery UI che aggiungono sfondo bianco */
.ui-widget-content,
.ui-helper-reset,
.ui-corner-top,
.ui-corner-bottom,
.ui-corner-all {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
}

/* Specifica per accordion content - deve essere TRASPARENTE */
.ui-accordion .ui-accordion-content.ui-widget-content {
    background: transparent !important;
    background-color: transparent !important;
    color: white !important;
}

/* Specifica per accordion header - deve essere bianco */
.ui-accordion .ui-accordion-header.ui-corner-top,
.ui-accordion .ui-accordion-header.ui-corner-all {
    background: white !important;
    background-color: white !important;
    border-radius: 5px !important;
}

/* ===== CARD BODY CON ACCORDION ===== */

/* Sfondo trasparente per vedere la foto di sottofondo */
.card-body {
    background-color: transparent !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

/* Assicura che card-body sia sempre trasparente */
div.card-body,
.card > .card-body {
    background-color: transparent !important;
    background: transparent !important;
}

/* Card stessa trasparente (tranne l'header) - NESSUN border-radius */
.card {
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
}

/* Forza trasparenza card con selettori più specifici */
body .card,
main .card,
div.card {
    background-color: transparent !important;
    background: transparent !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
}

/* Card header resta blu con angoli arrotondati su tutti e 4 i lati */
.card > .card-header,
body .card > .card-header,
main .card > .card-header {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    border-radius: 12px !important;
}

/* Card body con angoli arrotondati su tutti e 4 i lati e spazio sopra */
.card > .card-body,
body .card > .card-body,
main .card > .card-body {
    border-radius: 12px !important;
    margin-top: 1rem !important;
}

/* Content wrapper blu con angoli arrotondati */
div.content-wrapper,
.content-wrapper {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
}

/* ===== NAVBAR - SFONDO BLU E TESTO BIANCO ===== */

/* Navbar con sfondo blu */
.navbar {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
}

/* Brand (titolo) bianco - override del gradiente */
.navbar-brand {
    color: white !important;
    font-weight: 700;
    background: none !important; /* Rimuove il gradiente */
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: white !important;
    background-clip: unset !important;
}

.navbar-brand:hover {
    color: #f0f0f0 !important;
    -webkit-text-fill-color: #f0f0f0 !important;
}

/* Link del menu bianchi */
.navbar-nav .nav-link {
    color: white !important;
}

.navbar-nav .nav-link:hover {
    color: yellow !important; /* Giallo al hover come il vecchio stile */
}

/* Dropdown toggle bianco */
.navbar-nav .dropdown-toggle {
    color: white !important;
}

/* Hamburger menu (mobile) con icona bianca */
.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Dropdown menu - sfondo blu con testo bianco */
.navbar .dropdown-menu {
    background-color: rgb(21, 65, 135) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.navbar .dropdown-item {
    color: white !important;
}

.navbar .dropdown-item:hover {
    background-color: rgb(16, 48, 100) !important;
    color: yellow !important;
}

/* ===== CONTENT WRAPPER ===== */

/* Content wrapper con sfondo BLU */
.content-wrapper {
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    color: white !important;
    padding: 1rem;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.content-wrapper h1,
.content-wrapper h2,
.content-wrapper h3,
.content-wrapper h4,
.content-wrapper h5,
.content-wrapper h6,
.content-wrapper p,
.content-wrapper span,
.content-wrapper div:not(.error_strings),
.content-wrapper li {
    color: white !important;
}

/* Exception for error messages - must be visible */
.content-wrapper .error_strings,
div.contenu .error_strings {
    color: #cc0000 !important;
    background: yellow !important;
}

.content-wrapper a {
    color: yellow !important;
    text-decoration: none !important;
}

.content-wrapper a:hover {
    text-decoration: underline !important;
    color: yellow !important;
}

/* ===== ALTRI ELEMENTI LEGACY CHE POTREBBERO SERVIRE ===== */

/* Titolo fisso in alto (#title) se usato in pagine moderne */
#title {
    display: block;
    background-color: rgb(21, 65, 135) !important;
    background: rgb(21, 65, 135) !important;
    color: white !important;
    padding: 10px;
    padding-bottom: 20px;
    text-align: center;
}

#title h1,
#title h2,
#title h3 {
    color: white !important;
    margin: 0;
}

/* Menu legacy se presente */
#menu {
    color: white;
}

#menu ul ul {
    background-color: rgb(21, 65, 135) !important;
}

#menu a {
    color: yellow !important;
    text-decoration: none;
}

#menu a:hover {
    text-decoration: underline;
}

/* ===== LOGIN FORM CENTERING ===== */

/* Centra la card che contiene il form di login */
body .card-body {
    background-color: transparent !important;
}

/* Quando card-body contiene smallform, centralo */
body .card-body:has(div.contenu.smallform) {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 200px;
}

/* Fallback per browser che non supportano :has() */
body .card-body div.contenu.smallform {
    display: block;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Centra il form di login nella pagina con angoli arrotondati */
div.contenu.smallform {
    max-width: 500px;
    width: 100%;
    padding: 2rem !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

/* Bootstrap azzera border/padding di OGNI <fieldset> (reboot.css).
   Form.php (display() e displayUl()) avvolge sempre i campi in un
   <fieldset>, qualunque sia la classe del form (.smallform, .ulist, ...)
   - il vecchio layout mostrava il frame di default del browser, lo
   ripristiniamo qui per tutti i form dell'app. */
div.contenu fieldset,
#accordion fieldset {
    border: 2px solid white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

div.contenu legend,
#accordion legend {
    color: white;
    font-weight: bold;
    padding: 0 0.5rem;
}

div.contenu.smallform label {
    color: white;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

div.contenu.smallform input[type="text"],
div.contenu.smallform input[type="password"] {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

div.contenu.smallform input[type="submit"] {
    background: white;
    color: rgb(21, 65, 135);
    font-weight: bold;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

div.contenu.smallform input[type="submit"]:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 768px) {
    div.contenu,
    #accordion > div {
        padding: 10px !important;
    }
    
    #accordion > h3 {
        padding: 8px !important;
        font-size: 1rem;
    }
}

/* ===== NOTE PER LO SVILUPPATORE ===== */

/*
 * IMPORTANTE: Questo file usa !important per garantire che gli stili
 * legacy abbiano precedenza sugli stili moderni. Questo è necessario
 * durante la fase di transizione graduale.
 * 
 * Una volta completata la migrazione, si può considerare di:
 * 1. Rimuovere i !important
 * 2. Integrare questi stili direttamente in modern-style.css
 * 3. Eliminare questo file di compatibilità
 */