/* ============================================
   SAPAR TRANSPARENCIA PLUGIN v4.3.0
   Estilos optimizados y responsive
   ============================================ */

/* ===== CONTENEDOR PRINCIPAL ===== */
.sapar-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
}

/* Iconos de archivos */
.sapar-archivo-icono {
    font-size: 24px;
    width: 35px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.sapar-archivo-nombre {
    flex: 1;
    min-width: 150px;
    word-break: break-word;
    font-weight: 500;
}

.sapar-archivo-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 12px;
    color: #7f8c8d;
    flex-wrap: wrap;
}

.sapar-archivo-tamano {
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.sapar-archivo-fecha {
    font-style: italic;
}

/* ===== TABS ===== */
.sapar-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1e1e1;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.sapar-tab-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    color: #555;
    background: #e9ecef;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sapar-tab-btn:hover {
    background: #dee2e6;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sapar-tab-btn.active {
    background: #3498db;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.sapar-tab-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ===== SELECTOR DE AÑO ===== */
.sapar-year-selector-wrapper {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sapar-label {
    font-size: 14px;
    font-weight: 500;
}

.sapar-year-selector {
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 6px;
    border: 2px solid #ccc;
    background: white;
    min-width: 150px;
    height: 45px;
    transition: border-color 0.3s;
    cursor: pointer;
}

.sapar-year-selector:hover {
    border-color: #3498db;
}

.sapar-year-selector:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* ===== SECCIÓN DE AÑO ===== */
.sapar-year-section {
    background: white;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    box-sizing: border-box;
    width: 100%;
}

.sapar-year-title {
    color: #2c3e50;
    font-size: 24px;
    margin: 0 0 20px 0;
    border-bottom: 3px solid #3498db;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== NODOS (DIRECTORIOS) ===== */
.sapar-nodo-bloque {
    display: block;
    margin: 8px 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    width: 100% !important;
    box-sizing: border-box;
    clear: both;
    transition: all 0.2s;
}

.sapar-nodo-bloque:hover {
    background: #eef2f7;
}

.sapar-subcarpeta-nodo {
    border-left: 4px solid #ffc107;
    background: #fffdf3;
    margin-left: 20px !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    width: calc(100% - 20px) !important;
}

.sapar-nodo-toggle {
    color: #2c3e50;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding: 2px 0;
    transition: color 0.2s;
}

.sapar-nodo-toggle:hover {
    color: #3498db;
}

.sapar-nodo-toggle:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-radius: 4px;
}

.sapar-nodo-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sapar-indicator {
    font-weight: bold;
    font-size: 18px;
    transition: transform 0.3s ease;
    color: #3498db;
}

.sapar-indicator.active {
    transform: rotate(90deg);
    color: #2980b9;
}

.sapar-nodo-contenido {
    margin-top: 10px;
    padding: 5px 0;
    animation: saparFadeIn 0.3s ease;
}

.sapar-nodo-contenido.hidden {
    display: none;
}

/* ===== GRID DE ARCHIVOS ===== */
.sapar-archivos-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 0;
    width: 100%;
    box-sizing: border-box;
}

.sapar-archivo-item {
    display: block;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e1e1;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.sapar-archivo-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.sapar-archivo-link {
    text-decoration: none;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    flex-wrap: wrap;
}

.sapar-archivo-link:hover {
    color: #1a252f;
}

.sapar-archivo-icono {
    font-size: 20px;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.sapar-archivo-nombre {
    flex: 1;
    min-width: 150px;
    word-break: break-word;
    font-weight: 500;
}

.sapar-archivo-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 12px;
    color: #7f8c8d;
    flex-wrap: wrap;
}

.sapar-archivo-tamano {
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.sapar-archivo-fecha {
    font-style: italic;
}

/* ===== MENSAJES Y ESTADOS ===== */
.sapar-loading-text {
    color: #7f8c8d;
    font-style: italic;
    font-size: 14px;
    margin: 8px 0;
    padding: 10px;
}

.sapar-empty-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.sapar-empty-message p {
    margin: 12px 0;
    font-size: 15px;
}

.sapar-empty-message code {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.sapar-help-text {
    color: #6c757d;
    font-size: 14px;
    margin-top: 15px !important;
}

.sapar-alert-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 10px 0;
    font-weight: 500;
}

/* ===== ANIMACIONES ===== */
@keyframes saparFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .sapar-container {
        padding: 10px;
    }
    
    .sapar-tabs {
        flex-direction: row;
        gap: 5px;
    }
    
    .sapar-tab-btn {
        padding: 8px 14px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    .sapar-year-selector-wrapper {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    
    .sapar-year-selector {
        width: 100%;
        min-width: auto;
    }
    
    .sapar-archivo-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .sapar-archivo-meta {
        width: 100%;
        justify-content: flex-start;
        font-size: 11px;
        gap: 8px;
    }
    
    .sapar-subcarpeta-nodo {
        margin-left: 10px !important;
        width: calc(100% - 10px) !important;
    }
    
    .sapar-nodo-bloque {
        padding: 10px 12px;
    }
    
    .sapar-year-title {
        font-size: 20px;
    }
    
    .sapar-nodo-toggle {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .sapar-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .sapar-tab-btn {
        width: 100%;
        justify-content: center;
    }
    
    .sapar-container {
        padding: 8px;
    }
    
    .sapar-year-section {
        padding: 12px;
    }
    
    .sapar-archivo-item {
        padding: 8px 12px;
    }
    
    .sapar-archivo-nombre {
        font-size: 13px;
        min-width: 100px;
    }
}

/* ===== SOPORTE PARA DARK MODE (BÁSICO) ===== */
@media (prefers-color-scheme: dark) {
    .sapar-container {
        background: #1a1a2e;
    }
    
    .sapar-year-section {
        background: #16213e;
        color: #e0e0e0;
    }
    
    .sapar-year-title {
        color: #e0e0e0;
        border-bottom-color: #3498db;
    }
    
    .sapar-nodo-bloque {
        background: #1a1a2e;
        color: #e0e0e0;
    }
    
    .sapar-nodo-bloque:hover {
        background: #2a2a4e;
    }
    
    .sapar-subcarpeta-nodo {
        background: #1e1e3e;
    }
    
    .sapar-nodo-toggle {
        color: #e0e0e0;
    }
    
    .sapar-archivo-item {
        background: #1a1a2e;
        border-color: #333;
    }
    
    .sapar-archivo-item:hover {
        background: #2a2a4e;
        border-color: #3498db;
    }
    
    .sapar-archivo-link {
        color: #e0e0e0;
    }
    
    .sapar-archivo-meta {
        color: #aaa;
    }
    
    .sapar-archivo-tamano {
        background: #2a2a4e;
        color: #ccc;
    }
    
    .sapar-year-selector-wrapper {
        background: #16213e;
    }
    
    .sapar-year-selector {
        background: #1a1a2e;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .sapar-year-selector:hover {
        border-color: #3498db;
    }
    
    .sapar-empty-message {
        background: #16213e;
        border-color: #333;
    }
    
    .sapar-tab-btn {
        background: #1a1a2e;
        color: #aaa;
    }
    
    .sapar-tab-btn:hover {
        background: #2a2a4e;
        color: #fff;
    }
    
    .sapar-tab-btn.active {
        background: #3498db;
        color: white;
    }
}
