/* ==========================================================================
 * CDF Dizionario - Archive page styles
 * ========================================================================== */

/* Layout
 * -------------------------------------------------------------------------- */
.cdf-diz-archive {
    max-width: 1200px !important;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    align-self: center;
}

/* Header
 * -------------------------------------------------------------------------- */
.cdf-diz-header {
    margin-bottom: 1.5rem;
}

.cdf-diz-header h1 {
    margin: 0 0 .25rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
}

.cdf-diz-subtitle {
    margin: 0;
    font-size: 1.15rem;
    color: #64748b;
}

/* Search
 * -------------------------------------------------------------------------- */
.cdf-diz-search-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 460px;
    margin-bottom: 1.25rem;
}

.cdf-diz-search {
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 1.05rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}

.cdf-diz-search:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(29, 78, 216, .15);
}

.cdf-diz-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    display: none;
}

.cdf-diz-search-clear:hover { color: #334155; }

/* Raccolta tab bar
 * -------------------------------------------------------------------------- */
.cdf-diz-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
    padding: 0;
}

.cdf-diz-tab {
    padding: 8px 18px;
    font-size: .95rem;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.cdf-diz-tab:hover {
    border-color: #1d4ed8;
    color: #1d4ed8;
}

.cdf-diz-tab:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.cdf-diz-tab.cdf-diz-tab-active {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

/* A-Z Navigation bar
 * -------------------------------------------------------------------------- */
.cdf-diz-az-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background: #fff;
    padding: 8px 0;
    z-index: 10;
    border-bottom: 1px solid #e2e8f0;
}

.cdf-diz-az-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    color: #334155;
    background: #f1f5f9;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.cdf-diz-az-link:hover { background: #1d4ed8; color: #fff; }

.cdf-diz-az-link:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.cdf-diz-az-link.cdf-diz-az-active { background: #1d4ed8; color: #fff; }

.cdf-diz-az-disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: default;
    pointer-events: none;
}

/* Counter
 * -------------------------------------------------------------------------- */
.cdf-diz-counter {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    color: #64748b;
}

.cdf-diz-counter-total { color: #94a3b8; }

/* Letter groups (dizionario)
 * -------------------------------------------------------------------------- */
.cdf-diz-group {
    margin-bottom: 2rem;
}

.cdf-diz-group h2,
.cdf-diz-group-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1d4ed8;
    margin: 0 0 .75rem;
    padding-bottom: .35rem;
    border-bottom: 2px solid #e2e8f0;
}

/* Card list (dizionario, 2-column grid)
 * -------------------------------------------------------------------------- */
.cdf-diz-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}

/* Cards
 * -------------------------------------------------------------------------- */
.cdf-diz-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #1d4ed8;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: box-shadow .2s;
}

.cdf-diz-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.cdf-diz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.cdf-diz-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.cdf-diz-card-title a {
    color: #1e293b;
    text-decoration: none;
}

.cdf-diz-card-title a:hover { color: #1d4ed8; }

.cdf-diz-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
}

.cdf-diz-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 10px;
    white-space: nowrap;
    color: #1d4ed8;
    background: #dbeafe;
}

.cdf-diz-badge--legge     { color: #1e40af; background: #dbeafe; }
.cdf-diz-badge--codice    { color: #6b21a8; background: #f3e8ff; }
.cdf-diz-badge--regolamento { color: #065f46; background: #d1fae5; }
.cdf-diz-badge--dizionario { color: #92400e; background: #fef3c7; }

.cdf-diz-card-excerpt {
    margin: 6px 0 0;
    font-size: .9rem;
    line-height: 1.5;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article list (normativa raccolte)
 * -------------------------------------------------------------------------- */
.cdf-art-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.cdf-art-item {
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}

.cdf-art-item:last-child { border-bottom: none; }

.cdf-art-item:hover { background: #f8fafc; }

.cdf-art-link {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 11px 18px;
    text-decoration: none;
    color: inherit;
}

.cdf-art-link:hover .cdf-art-rubrica { color: #1d4ed8; }

.cdf-art-num {
    flex-shrink: 0;
    min-width: 60px;
    font-size: .85rem;
    font-weight: 700;
    color: #1d4ed8;
    font-variant-numeric: tabular-nums;
}

.cdf-art-rubrica {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    transition: color .12s;
}

.cdf-art-excerpt {
    margin: 0 0 8px;
    padding: 0 18px 0 92px;
    font-size: .88rem;
    line-height: 1.5;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hidden utility
 * -------------------------------------------------------------------------- */
.cdf-diz-hidden { display: none !important; }

/* Empty state
 * -------------------------------------------------------------------------- */
.cdf-diz-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #94a3b8;
    font-size: .95rem;
}

/* Loading spinner
 * -------------------------------------------------------------------------- */
.cdf-diz-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 3rem 1rem;
    color: #64748b;
    font-size: .95rem;
}

.cdf-diz-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #1d4ed8;
    border-radius: 50%;
    animation: cdf-diz-spin .7s linear infinite;
}

@keyframes cdf-diz-spin { to { transform: rotate(360deg); } }

/* Fade-in animation
 * -------------------------------------------------------------------------- */
.cdf-diz-fade-in { animation: cdf-diz-fade .2s ease-out; }

@keyframes cdf-diz-fade { from { opacity: 0; } to { opacity: 1; } }

/* Voci correlate (single cdf_voce page)
 * -------------------------------------------------------------------------- */
.cdf-diz-related {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
}

.cdf-diz-related h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1d4ed8;
    margin: 0 0 1rem;
}

.cdf-diz-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.cdf-diz-related-warning {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    padding: 8px 12px;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: #991b1b;
}

/* Responsive
 * -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .cdf-diz-list { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .cdf-diz-header h1 { font-size: 1.8rem; }
    .cdf-diz-search { max-width: 100%; }

    .cdf-diz-tab-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .cdf-diz-tab-bar::-webkit-scrollbar { display: none; }

    .cdf-diz-az-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .cdf-diz-az-bar::-webkit-scrollbar { display: none; }

    .cdf-diz-card-header { flex-direction: column; align-items: flex-start; gap: 4px; }

    .cdf-art-link { gap: 8px; padding: 10px 14px; }
    .cdf-art-num { min-width: 48px; }
    .cdf-art-excerpt { padding-left: 14px; }
}
