/* File: style.css - integrato con Styles.css */

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #d4edda;
    font-family: Arial, sans-serif;
    padding: 40px;
    line-height: 1.6;
    color: #333;
}

h1 {
    text-align: center;
    font-size: 3em;
    color: #FF8C00;
    margin-bottom: 10px;
}

/* ===== PAGE SUBTITLE ===== */
.page-subtitle {
    text-align: center;
    font-size: 1.1em;
    color: #aac4d0;
    margin-top: 0;
    margin-bottom: 20px;
}

/* ===== MENU ===== */
.menu {
    max-width: 600px;
    margin: 0 auto;
}

.menu a {
    display: block;
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #0c5460;
    text-decoration: none;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 6px solid #28a745;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.menu a:hover {
    background-color: #218838;
    color: white;
}

.menu a.esc {
    border-left-color: #dc3545;
    color: #721c24;
    background-color: #f8d7da;
}

.menu a.esc:hover {
    background-color: #c82333;
    color: white;
}

/* ===== SFONDI ===== */
.sfondo-default {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ecf0f1;
}

.sfondo-carta-2 {
    background-color: #faf7f0;
    background-image: linear-gradient(#eee .1em, transparent .1em);
    background-size: 100% 1.2em;
    color: #2c3e50;
}

.sfondo-carta-texture {
    background-color: #f9f6f0;
    background-image:
        linear-gradient(45deg, transparent 35%, rgba(255,255,255,.5) 35%, rgba(255,255,255,.5) 65%, transparent 65%),
        linear-gradient(-45deg, transparent 35%, rgba(0,0,0,.02) 35%, rgba(0,0,0,.02) 65%, transparent 65%),
        linear-gradient(#f2efe6 .1em, transparent .1em);
    background-size: 30px 30px, 30px 30px, 100% 1.2em;
    color: #3d4852;
}

.sfondo-azzurro {
    background-color: #e6f3ff;
}

.sfondo-gradient-moderno {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sfondo-gradient-caldo {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #333;
}

.sfondo-pattern {
    background-color: #f0f2f5;
    background-image: radial-gradient(circle at 1px 1px, rgba(74, 144, 226, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
    color: #333;
}

.sfondo-carta {
    background-color: #faf7f0;
    background-image:
        linear-gradient(90deg, transparent 79px, #abced4 79px, #abced4 81px, transparent 81px),
        linear-gradient(#eee .1em, transparent .1em);
    background-size: 100% 1.2em;
    color: #2c3e50;
}

.sfondo-tech {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ecf0f1;
}

.sfondo-soft {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.1);
}

/* ===== PULSANTI ===== */
.buttons {
    margin: 20px 0;
    display: flex;
    gap: 20px;
    justify-content: flex-start;
}

.btn {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 10px 20px;
    margin: 0 10px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    flex: 1;
    max-width: 200px;
}

.btn:hover {
    opacity: 0.8;
}

.btn-yes {
    background-color: #44aa44;
    color: #333;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    max-width: none; /* neutralizza il max-width:200px di .btn (riga 152): con label lunghe il testo usciva dal box */
}

.btn-yes:hover {
    background-color: #2e7d32;
    text-decoration: none;
}

.btn-no {
    background-color: #ff4444;
    color: #333;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    max-width: none; /* neutralizza il max-width:200px di .btn (riga 152): con label lunghe il testo usciva dal box */
}

.btn-no:hover:not(:disabled) {
    background-color: #cc0000;
    text-decoration: none;
}

.btn-choice {
    background-color: #FFD700;
    color: #333;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    max-width: none; /* neutralizza il max-width:200px di .btn (riga 152): con label lunghe il testo usciva dal box */
}

.btn-choice:hover:not(:disabled) {
    background-color: #B8860B;
    text-decoration: none;
}

.btn-yes:disabled,
.btn-no:disabled,
.btn-choice:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== NORMALIZZAZIONE <button> E <a> CON CLASSI BTN =====
   Il browser applica stili default diversi a <button> vs <a>
   (es. line-height ereditato da Bootstrap sugli <a> vs "normal" sui <button>).
   Queste regole uniformano entrambi i tag quando usano le classi
   btn-yes / btn-no / btn-choice, così che due bottoni affiancati
   (es. un <button> di submit e un <a> di annulla) abbiano sempre
   la stessa altezza. Tutti i file che usano style.css ne beneficiano
   automaticamente. */
button.btn-yes,
button.btn-no,
button.btn-choice,
a.btn-yes,
a.btn-no,
a.btn-choice {
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: normal;
    padding: 12px 30px !important;
    box-sizing: border-box !important;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
}

/* ===== PULSANTI COMPATTI =====
   Versione ridotta delle classi btn per contesti con molti controlli.
   Uso: aggiungere 'btn-sm-agon' insieme a 'btn-yes' / 'btn-no' / 'btn-choice'.
   Il !important sovrascrive il padding delle classi base e del browser. */
button.btn-yes.btn-sm-agon,
button.btn-no.btn-sm-agon,
button.btn-choice.btn-sm-agon,
a.btn-yes.btn-sm-agon,
a.btn-no.btn-sm-agon,
a.btn-choice.btn-sm-agon,
.btn-sm-agon {
    padding: 6px 16px !important;
    font-size: 13px !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
}

/* ===== BOX CONTENITORI ===== */
/* display:block + margin auto (invece di inline-block): i margini auto non centrano
   un elemento inline-block, quindi il "margin: 0 auto" inline usato da ~35 pagine per
   centrare .box2 non aveva mai effetto - su schermi stretti la card restava allineata
   a sinistra lasciando una banda intera di sfondo visibile sulla destra (bug riscontrato
   su smartphone in USER_controlla_eta.php, 2026-09-17). Con display:block il centraggio
   funziona sia con il margin inline delle pagine esistenti sia da solo grazie alle regole
   sotto. */
.box, .box2 {
    background: #fff;
    border: 1px solid #ccc;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px #bbb;
    color: #222;
    font-size: 18px;
    line-height: 1.6;
    text-align: left;
}

.box {
    max-width: 600px;
}

.box2 {
    width: 90%;
    max-width: 1000px;
}

.box h2, .box2 h2 {
    color: #d9534f;
    font-size: 24px;
    margin-bottom: 20px;
}

.box p, .box2 p {
    margin-bottom: 15px;
}

.box code, .box2 code {
    background: #f9f9f9;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
}

/* ===== CHECKBOX FORM RICERCA ===== */
.checkbox-container {
    margin-bottom: 20px;
}

.field-item {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.field-item input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.field-item label {
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    color: #222 !important;
    transition: color 0.3s ease, font-weight 0.3s ease;
}

.field-item label:hover {
    color: #0066cc !important;
}

div.field-item.checked > label {
    color: #28a745 !important;
    font-weight: bolder !important;
    text-decoration: underline;
}

/* ===== CONTATORE ===== */
.counter-section {
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
    font-size: 16px;
}

/* ===== WARNING BOX ===== */
.warning-box {
    padding: 20px;
    background-color: #fff3cd;
    border-left: 6px solid #ffa500;
    color: #856404;
    font-size: 18px;
    margin-bottom: 20px;
    border-radius: 5px;
}

/* ===== BOOTSTRAP OVERRIDES ===== */
.form-label,
.form-check-label {
    color: #333 !important;
}

.card-body {
    color: #333 !important;
}

.card-header {
    color: #333 !important;
}

.modal-body,
.modal-body p,
.modal-body label,
.modal-body small,
.modal-title {
    color: #333;
}

.modal-header.bg-danger  .modal-title,
.modal-header.bg-primary .modal-title,
.modal-header.bg-success .modal-title,
.modal-header.bg-warning .modal-title {
    color: #fff !important;
}

/* ===== CONTAINER PRINCIPALE (Styles.css) ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    color: #333;
}

/* ===== HEADER (Styles.css) ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    color: white;
}

.header p {
    opacity: 0.9;
    font-size: 1.1em;
}

/* ===== FORM INSERIMENTO CHIAVI (Styles.css) ===== */
.form-container {
    padding: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 35px;
    margin-bottom: 10px;
}

.field-group {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 0;
    border: 1px solid #c8cff5;
    border-left: 4px solid #667eea;
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.15);
    overflow: hidden;
    margin-bottom: 10px;
}

.field-group h3 {
    color: #fff;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    margin: 0 0 15px 0;
    font-size: 1.1em;
    padding: 10px 16px;
    letter-spacing: 0.5px;
}

.field-group > .form-field,
.field-group > div {
    padding: 0 16px;
}

.field-group > .form-field:last-child {
    padding-bottom: 16px;
}

.form-field {
    margin-bottom: 15px;
    padding: 0 16px;
}

.form-field:first-of-type {
    padding-top: 8px;
}

.form-field:last-of-type {
    padding-bottom: 20px;
    margin-bottom: 0;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Stati di validazione */
.form-field.valid input {
    border-color: #28a745;
    background-color: #f8fff9;
}

.form-field.error input {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.form-field.warning input {
    border-color: #ffc107;
    background-color: #fffdf5;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.help-text {
    color: #6c757d;
    font-size: 11px;
    margin-top: 3px;
    font-style: italic;
}

/* ===== FOOTER NAV ===== */
.footer-nav {
    text-align: center;
    padding: 20px 0 20px 0;
}

/* ===== BUTTON CONTAINER (Styles.css) ===== */
.button-container {
    text-align: center;
    padding: 30px 0 20px 0;
    border-top: 2px solid #c8cff5;
    margin-top: 10px;
}

/* ===== RISULTATI (Styles.css) ===== */
.results-container {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-count {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.export-info {
    font-size: 12px;
    color: #6c757d;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

.results-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.results-table tr:hover {
    background: #f5f5f5;
}

.results-table tr:last-child td {
    border-bottom: none;
}

/* ===== PAGINAZIONE (Styles.css) ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== LOADING SPINNER (Styles.css) ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ALERT MESSAGES (Styles.css) ===== */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin: 10px 0;
    border-left: 4px solid;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-success {
    background: #d1edff;
    color: #155724;
    border-left-color: #28a745;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.alert-note {
    margin-top: 8px;
    font-size: 0.9em;
    opacity: 0.85;
}

/* ===== PATTERN INFO TOOLTIP (Styles.css) ===== */
.pattern-info {
    position: relative;
    display: inline-block;
    cursor: help;
    color: #667eea;
    margin-left: 5px;
}

.pattern-info:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0.9;
}

/* ===== UTILITY CLASSES (Styles.css) ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ===== MENU DINAMICI — pattern comune (spostato da .php locali il 2026-08-02) =====
   Prima duplicato identico in ~44 file *_menu_*_dinamico.php. Il badge admin è
   qui senza font-weight (versione maggioritaria); i file che lo volevano in
   grassetto mantengono un piccolo override locale con solo font-weight:600. */
.user-info {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.badge-admin {
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-left: 8px;
}

.no-access-message {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 30px;
    margin: 50px auto;
    max-width: 600px;
    text-align: center;
}

/* ===== BADGE AZIONE — pattern comune pagine ricerca/risultati (spostato il 2026-08-02) =====
   Prima duplicato identico (sottoinsieme variabile) in ~15 file di ricerca/risultati. */
.action-badge-edit     { background: #0d6efd; color: #fff; }
.action-badge-erase    { background: #dc3545; color: #fff; }
.action-badge-delete   { background: #fd7e14; color: #fff; }
.action-badge-restore  { background: #198754; color: #fff; }
.action-badge-associa  { background: #6f42c1; color: #fff; }
.action-badge-view     { background: #0dcaf0; color: #000; }
.action-badge-suggest  { background: #fd7e14; color: #fff; }
.action-badge-rate     { background: #e83e8c; color: #fff; }
.action-badge-download { background: #198754; color: #fff; }

/* ===== RESPONSIVE (Styles.css) ===== */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 0;
    }

    .form-container {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .results-table {
        font-size: 14px;
    }

    .results-table th,
    .results-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .results-table {
        font-size: 12px;
    }

    .pagination {
        font-size: 12px;
    }

    .alert {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .alert-note {
        margin-top: 6px;
        font-size: 0.85em;
    }
}