/* ===========================================
   ARCHIVIO - TAB NAVIGATION + SIDEBAR A-Z
   Design coerente con app v2.2
   =========================================== */

/* Form Header con pulsante + */
.form-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-icon-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.btn-icon-header:active {
    transform: scale(0.95);
    background: var(--primary-dark);
}

/* Container Tab Categorie */
.categoria-tabs-container {
    position: sticky;
    top: 110px;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.categoria-tabs-container::-webkit-scrollbar {
    display: none;
}

.categoria-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    min-width: min-content;
}

.categoria-tab {
    flex: 0 0 auto;
    padding: 14px 20px;
    background: white;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.categoria-tab:active {
    background: var(--gray-50);
}

.categoria-tab.active {
    border-bottom-color: currentColor;
    background: var(--gray-50);
}

.categoria-tab-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    background: var(--gray-200);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-700);
}

.categoria-tab.active .categoria-tab-badge {
    background: currentColor;
    color: white;
}

/* Main Wrapper con Sidebar */
.archive-main-wrapper {
    position: relative;
    display: flex;
    min-height: calc(100vh - 170px);
}

/* Content Area */
.archive-content-area {
    flex: 1;
    padding-right: 36px;
}

/* Sidebar Alfabetica Destra */
.alfabetic-sidebar {
    position: fixed;
    right: 4px;
    top: 180px;
    width: 28px;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 99;
    padding: 12px 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* Singolo Dot */
.alfabetic-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.alfabetic-dot.active {
    background: var(--primary);
    transform: scale(1.4);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.alfabetic-dot.disabled {
    opacity: 0.15;
    pointer-events: none;
}

/* Letter Popup */
.letter-popup {
    position: fixed;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(37, 99, 235, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 999;
}

.letter-popup.visible {
    opacity: 1;
    visibility: visible;
}

/* Articoli List */
.articoli-list {
    scroll-behavior: smooth;
    padding: 8px 16px 100px 16px;
}

.articolo-card[data-letter] {
    scroll-margin-top: 180px;
}

/* Sezione Lettera Header */
.letter-section-header {
    position: sticky;
    top: 160px;
    background: var(--gray-50);
    padding: 10px 16px;
    margin: 0 -16px 12px -16px;
    font-size: 15px;
    font-weight: 700;
    border-left: 4px solid currentColor;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Empty State */
.categoria-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-500);
}

.categoria-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.categoria-empty-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-600);
}

/* Archive Container */
.archive-container {
    padding: 0;
}

/* Articolo Card spacing */
.articolo-card {
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 380px) {
    .btn-icon-header {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    
    .categoria-tab {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .categoria-tab-badge {
        padding: 2px 6px;
        font-size: 10px;
        margin-left: 6px;
    }
    
    .alfabetic-sidebar {
        width: 24px;
        right: 2px;
        gap: 3px;
    }
    
    .alfabetic-dot {
        width: 6px;
        height: 6px;
    }
    
    .letter-popup {
        width: 52px;
        height: 52px;
        font-size: 28px;
        right: 40px;
    }
    
    .archive-content-area {
        padding-right: 28px;
    }
    
    .letter-section-header {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .articoli-list {
        padding: 6px 12px 100px 12px;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .categoria-tabs-container {
        background: #1f2937;
        border-bottom-color: #374151;
    }
    
    .categoria-tab {
        background: #1f2937;
        color: #9ca3af;
    }
    
    .categoria-tab.active {
        background: rgba(0, 0, 0, 0.15);
    }
    
    .alfabetic-dot {
        background: #4b5563;
    }
    
    .letter-section-header {
        background: #1f2937;
    }
    
    .btn-icon-header {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }
}
