/**
 * Anagrafica validator styles.
 * Design system tokens da public.css. Mobile-first.
 */

/* ===== Tabs ===== */

.av-tabs {
    display: flex;
    gap: 0.3rem;
    border-bottom: 1px solid var(--c-line, #e2e8f0);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.av-tab {
    background: transparent;
    border: none;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--c-ink-soft, #334155);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 120ms, border-color 120ms;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
    font-weight: 500;
}

.av-tab:hover {
    color: var(--c-blue, #0065c0);
}

.av-tab.is-active {
    color: var(--c-blue, #0065c0);
    border-bottom-color: var(--c-blue, #0065c0);
    font-weight: 600;
}

.av-panel { display: none; }
.av-panel.is-active { display: block; }

/* ===== Single validation grid ===== */

.av-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 720px) {
    .av-grid { grid-template-columns: 1fr 1fr; }
    .av-field-wide { grid-column: 1 / -1; }
}

.av-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.av-field > span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-ink, #0f172a);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.av-input {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: var(--r-md, 10px);
    background: var(--c-bg-card, #fff);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.95rem;
    color: var(--c-ink, #0f172a);
}

.av-input:focus {
    outline: none;
    border-color: var(--c-blue, #0065c0);
    box-shadow: var(--ring, 0 0 0 3px rgba(0, 101, 192, 0.2));
}

.av-result {
    margin-top: 0.4rem;
    font-size: 0.88rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--r-md, 10px);
    background: var(--c-bg, #f8fafc);
    border-left: 3px solid var(--c-line, #e2e8f0);
}

.av-result-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    line-height: 1.4;
}

.av-result-ok {
    color: #15803d;
}

.av-result-ok ~ .av-result-details {
    border-top-color: #15803d33;
}

.av-result-ko {
    color: #b91c1c;
}

.av-result:has(.av-result-ok) {
    background: #f0fdf4;
    border-left-color: #15803d;
}

.av-result:has(.av-result-ko) {
    background: #fef2f2;
    border-left-color: #b91c1c;
}

.av-result-details {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--c-line, #e2e8f0);
    color: var(--c-ink-soft, #334155);
    font-size: 0.85rem;
    line-height: 1.5;
}

.av-result-details span {
    font-weight: 600;
    color: var(--c-ink, #0f172a);
}

.av-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
    align-items: center;
}

/* ===== Batch CSV ===== */

.av-csv-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem;
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: var(--r-md, 10px);
    background: var(--c-bg-card, #fff);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--c-ink, #0f172a);
    resize: vertical;
}

.av-csv-input:focus {
    outline: none;
    border-color: var(--c-blue, #0065c0);
    box-shadow: var(--ring, 0 0 0 3px rgba(0, 101, 192, 0.2));
}

.av-csv-upload {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.av-batch-result {
    margin-top: 1.5rem;
}

.av-batch-summary {
    background: var(--c-bg, #f8fafc);
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: var(--r-md, 10px);
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    color: var(--c-ink-soft, #334155);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.av-batch-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: var(--r-md, 10px);
}

.av-batch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: var(--font-mono, ui-monospace, monospace);
}

.av-batch-table th,
.av-batch-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--c-line, #e2e8f0);
    text-align: left;
    vertical-align: top;
}

.av-batch-table th {
    background: var(--c-bg, #f8fafc);
    font-weight: 600;
    color: var(--c-ink, #0f172a);
    font-family: var(--font-sans, system-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.av-batch-row-num {
    color: var(--c-ink-mute, #64748b);
    font-weight: 600;
}

.av-batch-ok { color: #15803d; }
.av-batch-ko { color: #b91c1c; }
.av-batch-empty { color: var(--c-ink-mute, #64748b); }

.av-batch-table code {
    font-family: inherit;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.av-batch-truncated {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--c-ink-mute, #64748b);
    font-style: italic;
}

/* ===== JSON output ===== */

.av-json-output {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem;
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: var(--r-md, 10px);
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.82rem;
    line-height: 1.55;
    resize: vertical;
}

.av-json-output:focus {
    outline: none;
    box-shadow: var(--ring, 0 0 0 3px rgba(0, 101, 192, 0.2));
}
