/*
 * ACF Theme — Area Pazienti
 * Caricato su: [lista_clienti], [area_clienti], [visualizza_documento]
 *
 * Contiene:
 *  - Lista pazienti (.cliente-row)
 *  - Lista documenti (.documento-row, .doc-*)
 *  - Badge tipo documento (.doc-tipo)
 *  - Torna indietro (.doc-back-link)
 *  - Visualizzatore documento (.acf-documento-view, .doc-view-meta)
 *  - Vista sola lettura cliente (.documento-readonly, .readonly-*)
 *  - Stampa documento (.documento-stampa, .stamp-block, .misure-table)
 */

/* ===== LISTA PAZIENTI ===== */

.cliente-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    gap: 20px;
}

.cliente-main {
    display: flex;
    gap: 25px;
    flex: 1;
    align-items: center;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.cliente-email {
    white-space: nowrap;
    margin-left: 20px;
    color: #0073aa;
    text-decoration: none;
}

.cliente-email:hover { text-decoration: underline; }

.lista-footer { margin-top: 20px; }

/* ===== LISTA DOCUMENTI ===== */

.lista-documenti {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.documento-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(108, 92, 231, 0.12);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.documento-row:hover {
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.25);
}

/* Overlay invisibile — rende l'intera card cliccabile */
.doc-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.doc-title {
    flex: 1;
    font-weight: 600;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.doc-date {
    white-space: nowrap;
    font-size: 0.88rem;
    color: #555;
    position: relative;
    z-index: 2;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

.doc-actions a {
    color: #6c5ce7;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(108, 92, 231, 0.3);
    transition: background 0.15s ease;
}

.doc-actions a:hover { background: rgba(108, 92, 231, 0.07); }

.doc-delete {
    color: #dc3545 !important;
    border-color: rgba(220, 53, 69, 0.35) !important;
}

.doc-delete:hover {
    background: rgba(220, 53, 69, 0.08) !important;
    border-color: #dc3545 !important;
}

/* ===== BADGE TIPO DOCUMENTO ===== */

.doc-tipo {
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    position: relative;
    z-index: 2;
}

.doc-tipo--adulto {
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.doc-tipo--evolutivo {
    background: rgba(0, 184, 148, 0.1);
    color: #00897b;
    border: 1px solid rgba(0, 184, 148, 0.25);
}

/* ===== TORNA INDIETRO ===== */

.doc-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: transparent;
    border: 1.5px solid rgba(108, 92, 231, 0.4);
    border-radius: 40px;
    color: #6c5ce7;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.4rem;
    transition: all 0.2s ease;
}

.doc-back-link:hover {
    background: rgba(108, 92, 231, 0.07);
    border-color: #6c5ce7;
    text-decoration: none;
}

/* ===== VISUALIZZATORE DOCUMENTO ===== */

.doc-view-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ===== DOCUMENTO READONLY (vista cliente) ===== */

.documento-readonly {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
}

.readonly-field {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.readonly-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #555;
    min-width: 180px;
    flex-shrink: 0;
}

.readonly-value {
    color: #2c3e50;
    font-size: 1rem;
}

.readonly-block {
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.readonly-block .readonly-label {
    display: block;
    margin-bottom: 8px;
}

/* ===== STAMPA DOCUMENTO ===== */

.documento-stampa {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    font-family: Georgia, serif;
    line-height: 1.7;
}

.documento-stampa h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #6c5ce7;
    padding-bottom: 0.5rem;
}

.documento-stampa p { margin: 0.4rem 0; }

.stamp-block { margin: 1rem 0; }

.stamp-block > p {
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

/* Tabella misure aggiuntive (repeater) */
.misure-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    margin-top: 0.4rem;
}

.misure-table th {
    background: rgba(108, 92, 231, 0.08);
    color: #2c3e50;
    font-weight: 600;
    text-align: left;
    padding: 7px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.misure-table td {
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.misure-table tr:nth-child(even) td { background: rgba(0, 0, 0, 0.02); }

/* ===== PRINT ===== */

@media print {
    .doc-view-meta,
    .doc-back-link,
    .acf-form-submit {
        display: none;
    }
}
