/* =============================================
               style.css
   ============================================= */

body { 
    font-family: 'Inter', sans-serif; 
    background-color: #f8f9fa; 
}
.dropdown-container { 
    max-height: 18rem; 
    overflow-y: auto; 
    border: 1px solid #9ca3af; 
    border-radius: 0.5rem; 
    background-color: white; 
    display: none; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); 
    margin-top: 0.25rem; 
    position: absolute; 
    width: 100%; 
    left: 0; 
    top: 100%; 
    z-index: 20; 
}
#resultsListContainer { 
    max-height: 18rem; 
    overflow-y: auto; 
    border: 1px solid #e5e7eb; 
    border-radius: 0.5rem; 
    background-color: white; 
    display: none; 
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05); 
    margin-top: 0.5rem; 
    position: static; 
    z-index: 1; 
}
.results-list { 
    list-style-type: none; 
    padding: 0; 
    margin: 0; 
}
.results-list li { 
    padding: 10px 16px; 
    border-bottom: 1px solid #e5e7eb; 
    cursor: default; 
    transition: background-color 0.2s ease; 
    line-height: 1.5; 
    display: flex; 
    align-items: center; 
    font-size: 0.95rem; 
}
.results-list li:last-child { 
    border-bottom: none; 
}
.results-list li:hover { 
    background-color: #eff6ff; 
}
.title-item, .authority-item { 
    cursor: pointer; 
    font-weight: 500; 
}
.title-item { 
    color: #1e40af; 
}
.authority-item { 
    color: #374151; 
}
.results-list li input[type="checkbox"] { 
    margin-right: 12px; 
    height: 1.1rem; 
    width: 1.1rem; 
    cursor: pointer; 
    accent-color: #4f46e5; 
    flex-shrink: 0; 
}
.highlight { 
    background-color: rgba(250, 204, 21, 0.6); 
    font-weight: 600; 
    padding: 1px 0; 
    border-radius: 2px; 
}
.status-message { 
    opacity: 0; 
    transform: translateY(-10px); 
    transition: opacity 0.3s ease, transform 0.3s ease; 
}
.status-message:not(.hidden) { 
    opacity: 1; 
    transform: translateY(0); 
}
.btn-animated { 
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease; 
}
.btn-animated:hover:not(:disabled) { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 
}
.btn-animated:active:not(:disabled) { 
    transform: translateY(-1px); 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); 
}
.btn-animated:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}
.hidden { 
    display: none; 
}
details > summary { 
    list-style: none; 
    cursor: pointer; 
    padding: 1rem 1.5rem; 
    background-color: #f9fafb; 
    border: 1px solid #e5e7eb; 
    border-radius: 0.5rem; 
    font-weight: 600; 
    color: #374151; 
    transition: background-color 0.2s ease; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
details > summary:hover { 
    background-color: #f3f4f6; 
}
details > summary::after { 
    content: '\f078'; 
    font-family: 'Font Awesome 6 Free'; 
    font-weight: 900; 
    transition: transform 0.3s ease; 
    font-size: 0.9em; 
}
details[open] > summary::after { 
    transform: rotate(180deg); 
}
details[open] > summary { 
    border-bottom-left-radius: 0; 
    border-bottom-right-radius: 0; 
    border-bottom: none; 
}
.details-content { 
    padding: 1.5rem; 
    border: 1px solid #e5e7eb; 
    border-top: none; 
    border-bottom-left-radius: 0.5rem; 
    border-bottom-right-radius: 0.5rem; 
    background-color: white; 
}
.form-input, .form-textarea, .form-select, .form-radio { 
    border: 1px solid #d1d5db; 
    border-radius: 0.375rem; 
    font-size: 1rem; 
    transition: border-color 0.2s ease, box-shadow 0.2s ease; 
}
.form-input, .form-textarea, .form-select { 
    width: 100%; 
    padding: 0.75rem 1rem; 
}
.form-input:focus, .form-textarea:focus, .form-select:focus { 
    outline: none; 
    border-color: #4f46e5; 
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3); 
}
.form-input[readonly], .form-textarea[readonly], .form-input:disabled, .form-textarea:disabled { 
    background-color: #e5e7eb; 
    cursor: not-allowed; 
    color: #6b7280; 
    border-color: #d1d5db; 
}
.form-input[readonly].informative { 
    background-color: #f9fafb; 
    border-style: dashed; 
    color: #4b5563; 
    cursor: default; 
}
.form-textarea { 
    min-height: 80px; 
    resize: vertical; 
}
.form-label { 
    display: block; 
    margin-bottom: 0.3rem; 
    font-size: 0.9rem; 
    font-weight: 500; 
    color: #4b5563; 
}
.input-group { 
    margin-bottom: 1rem; 
}
.grid-cols-form { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 1rem; 
}
.grid-cols-form-3 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 1rem; 
}
.dropdown-btn { 
    padding: 0 0.8rem; 
    background-color: #e5e7eb; 
    border: 1px solid #d1d5db; 
    border-left: none; 
    border-radius: 0 0.375rem 0.375rem 0; 
    line-height: 1; 
    display: flex; 
    align-items: center; 
}
.dropdown-btn:hover:not(:disabled) { 
    background-color: #d1d5db; 
}

/* ========================================= */
/* 📱 MOBILE PRO-MAX OPTIMIZATION (PVC APP)  */
/* ========================================= */

@media (max-width: 768px) {
    /* Ottimizza container base */
    .max-w-4xl {
        margin: 0 !important;
        padding: 5px !important;
    }
    
    /* Touch Targets Grandi (A11y) */
    .form-input, .form-textarea, .form-select, 
    button, .dropdown-btn {
        min-height: 48px;
        font-size: 16px !important; /* Previene auto-zoom iPhone */
    }

    /* Override Griglie - Tutte le griglie a singola colonna per evitare schiacciamenti */
    .grid-cols-form, .grid-cols-form-3, .grid, .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Padding ridotti nei dettagli sections */
    .details-content {
        padding: 1rem 10px;
    }

    /* Stile dei bottoni d'azione full-width */
    .flex.space-x-4 {
        flex-direction: column;
        gap: 10px;
    }
    .flex.space-x-4 > * {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Testi e Titoli più compatti */
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    /* Etichetta Checkbox ingrandita per touch più facile */
    .results-list li input[type="checkbox"] {
        height: 1.5rem;
        width: 1.5rem;
        margin-right: 15px;
    }

    /* Aumenta la dimensione delle righe selezionabili dei risultati di ricerca */
    .results-list li {
        padding: 15px 16px;
    }
}
/* ========================================= */
/* PREMIUM MOBILE OVERRIDES (PVC APP)        */
/* ========================================= */
@media (max-width: 768px) {
    /* Step Number indicator */
    details summary::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 60%;
        background: #e2e8f0;
        border-radius: 0 4px 4px 0;
        transition: all 0.3s;
    }

    details[open] summary::before {
        height: 100%;
        background: #3b82f6;
    }

    /* Fixed Button Bar for Actions on Mobile */
    .mobile-actions-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 15px 15px calc(15px + var(--safe-area-inset-bottom, 15px));
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid #e2e8f0;
        display: flex;
        gap: 10px;
        z-index: 1000;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
    }

    #generateReportBtn, #generateDocBtn, #generateSequestroDocBtn, #resetBtn {
        flex: 1;
        padding: 12px 5px !important;
        font-size: 0.8rem !important;
        margin: 0 !important;
        border-radius: 12px !important;
    }

    #main-content {
        padding-bottom: 110px;
    }

    .container {
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
}
