/* ============================================================
   REPOSITORIO.CSS - Estilos para repositorio.php
   ============================================================ */

/* ===== HEADER REPOSITORIO (con !important para asegurar) ===== */
#top-ad-bar.header-repositorio {
    background: linear-gradient(135deg, #1a3a4a 0%, #2c5f6e 100%) !important;
    box-shadow: 0 2px 8px rgba(26, 58, 74, 0.3) !important;
}

#top-ad-bar.header-repositorio .btn-volver {
    background: rgba(255,255,255,0.15) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: white !important;
    text-decoration: none !important;
    font-size: 1.2rem !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s !important;
}


/* ===== HEADER REPOSITORIO ===== */

#top-ad-bar.header-repositorio .btn-volver:active {
    background: rgba(255,255,255,0.3) !important;
    transform: scale(0.95) !important;
}

#top-ad-bar.header-repositorio .logo-text {
    color: white !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    min-width: 36px;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,255,255,0.24) 0%, rgba(255,255,255,0.12) 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.14);
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn-header-icon:active {
    transform: scale(0.95);
}

.btn-header-icon:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.16) 100%);
    box-shadow: 0 3px 10px rgba(0,0,0,0.16);
}

.orden-actual {
    white-space: nowrap;
    font-size: 0.72rem;
    opacity: 0.95;
}

/* ===== CONTENEDOR ===== */
#app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 8px;
}

#repositorio-container {
    margin-bottom: 100px;
}

/* ===== CONTROLES ===== */
.repositorio-controls {
    margin: 8px 0 12px;
}

.buscador-repositorio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin: 10px 0 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eaf5f7 0%, #f2f8fa 100%);
    box-shadow: 0 4px 12px rgba(26, 58, 74, 0.12);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.24s ease, max-height 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
}

.buscador-repositorio.activo {
    opacity: 1;
    max-height: 80px;
    transform: translateY(0);
    pointer-events: auto;
}

.buscador-repositorio .form-control {
    padding: 10px 14px;
    border: 1.5px solid #c9dfe4;
    border-radius: 10px;
    font-size: 0.9rem;
    background: white;
    color: #1a2332;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

.buscador-repositorio .form-control:focus {
    outline: none;
    border-color: #2c5f6e;
    box-shadow: 0 0 0 3px rgba(44, 95, 110, 0.14);
}

.btn-cerrar-buscar {
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a4a 0%, #2c5f6e 100%);
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(26, 58, 74, 0.22);
}

/* ===== RESUMEN ===== */
.resumen-repositorio {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #eaf5f7 0%, #e3f0f3 100%);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #1a2332;
    margin: 0 0 12px;
    box-shadow: inset 0 0 0 1px rgba(26, 58, 74, 0.08);
}

.resumen-repositorio strong {
    color: #1a3a4a;
}

.resumen-repositorio .badge-ayuda {
    font-size: 0.7rem;
    color: #78909c;
}

/* ============================================================
   TARJETAS DE ARTÍCULO (MISMO ESTILO QUE INDEX)
   ============================================================ */

.grupo-tienda {
    background: white;
    border-radius: 12px;
    margin-bottom: 2em;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.grupo-tienda[data-color="repo"] h3 { background: linear-gradient(135deg, #1a3a4a 0%, #2c5f6e 100%); }
.grupo-tienda[data-color="0"] h3 { background: linear-gradient(135deg, #1565C0 0%, #1E88E5 100%); }
.grupo-tienda[data-color="1"] h3 { background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%); }
.grupo-tienda[data-color="2"] h3 { background: linear-gradient(135deg, #E65100 0%, #F57C00 100%); }
.grupo-tienda[data-color="3"] h3 { background: linear-gradient(135deg, #B71C1C 0%, #D32F2F 100%); }
.grupo-tienda[data-color="4"] h3 { background: linear-gradient(135deg, #006064 0%, #00838F 100%); }
.grupo-tienda[data-color="5"] h3 { background: linear-gradient(135deg, #4E342E 0%, #6D4C41 100%); }
.grupo-tienda[data-color="6"] h3 { background: linear-gradient(135deg, #283593 0%, #3949AB 100%); }
.grupo-tienda[data-color="7"] h3 { background: linear-gradient(135deg, #6A1B9A 0%, #8E24AA 100%); }
.grupo-tienda[data-color="8"] h3 { background: linear-gradient(135deg, #004D40 0%, #00796B 100%); }
.grupo-tienda[data-color="9"] h3 { background: linear-gradient(135deg, #455A64 0%, #607D8B 100%); }


.grupo-tienda h3 {
    color: white;
    padding: 10px 14px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grupo-tienda h3 span {
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.grupo-tienda ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ===== TARJETA DE ARTÍCULO ===== */
.grupo-tienda li {
    padding: 0;
    border-bottom: 1px solid #f0f2f5;
    background: white;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    min-height: 60px;
    transition: background-color 0.3s ease;
}

.grupo-tienda li:last-child {
    border-bottom: none;
}

.grupo-tienda li:active {
    background: #f5f0f8;
}

.grupo-tienda li .item-content {
    position: relative;
    z-index: 2;
    background: white;
    padding: 10px 14px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
    min-height: 60px;
    justify-content: center;
}

.grupo-tienda li .item-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grupo-tienda li .item-nombre {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a2332;
    flex: 1;
}

.grupo-tienda li .item-veces {
    background: #e3f0f3;
    padding: 1px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    color: #1a3a4a;
    font-weight: 600;
    flex-shrink: 0;
}

.grupo-tienda li .item-detalles {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #546e7a;
}

.grupo-tienda li .item-precio {
    font-weight: 600;
    color: #1a3a4a;
}

.grupo-tienda li .item-tienda-tag {
    font-size: 0.65rem;
    color: #78909c;
}

.grupo-tienda li .item-categoria-tag {
    background: #e8edf3;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.6rem;
    color: #546e7a;
    font-weight: 500;
    flex-shrink: 0;
}

/* ============================================================
   SWIPE - FONDOS
   ============================================================ */

.grupo-tienda li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100px;
    background: linear-gradient(90deg, #2e7d32 0%, #43a047 100%);
    background-image: url('../assets/icons/lista.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 34px 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px 0 0 8px;
    z-index: 1;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.grupo-tienda li::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100px;
    background: linear-gradient(-90deg, #c62828, #e53935);
    background-image: url('../assets/icons/basura.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 34px 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 8px 8px 0;
    z-index: 1;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.grupo-tienda li.swipe-right::before {
    transform: translateX(0);
}

.grupo-tienda li.swipe-left::after {
    transform: translateX(0);
}

.grupo-tienda li.swipe-right .item-content {
    transform: translateX(100px);
}

.grupo-tienda li.swipe-right {
	background-color: #e3f2fd;
	/* background: linear-gradient(135deg, #0d47a1 0%, #1976d3 100%); */
    /* background: linear-gradient(90deg, #e8f5e9 0%, #ffffff 100%); */
}

.grupo-tienda li.swipe-left .item-content {
    transform: translateX(-100px);
}

.grupo-tienda li.swipe-left {
    /* background: linear-gradient(-90deg, #ffebee 0%, #ffffff 100%); */
	background: linear-gradient(-90deg, #c62828, #e53935);
}

.swiping {
    touch-action: none !important;
    user-select: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media screen and (max-width: 480px) {
    .grupo-tienda li::before,
    .grupo-tienda li::after {
        width: 80px;
        background-size: 28px 28px;
    }
    
    .grupo-tienda li.swipe-right .item-content {
        transform: translateX(80px);
    }
    
    .grupo-tienda li.swipe-left .item-content {
        transform: translateX(-80px);
    }
    
    .repositorio-actions {
        grid-template-columns: 1fr;
    }
    
    .resumen-repositorio {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-align: center;
    }
}

/* ============================================================
   MENSAJE VACÍO
   ============================================================ */

#mensaje-vacio-repo {
    text-align: center;
    color: #78909c;
    padding: 40px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#mensaje-vacio-repo p {
    font-size: 1rem;
    margin: 0 0 4px 0;
}

#mensaje-vacio-repo small {
    font-size: 0.75rem;
    color: #b0bec5;
    display: block;
    line-height: 1.5;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-notificacion {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2332;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: fadeInUp 0.3s ease;
    max-width: 90%;
    text-align: center;
    border-left: 4px solid #1a3a4a;
}

.toast-notificacion-hide {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================================
   BADGE "EN LISTA"
   ============================================================ */

.badge-en-lista {
    background: #4CAF50;
    color: white;
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 4px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===== ARTÍCULO EN LISTA (estilo atenuado) ===== */
.grupo-tienda li.en-lista {
    background: #f0f7f0 !important;
    opacity: 0.85;
}

.grupo-tienda li.en-lista .item-content {
    background: #f0f7f0 !important;
}

.grupo-tienda li.en-lista .item-nombre {
    color: #2e7d32 !important;
}

.grupo-tienda li.en-lista::before,
.grupo-tienda li.en-lista::after {
    display: none !important;
}

.grupo-tienda li.en-lista .item-veces {
    background: #c8e6c9 !important;
    color: #2e7d32 !important;
}

/* ===== TOAST CON ESTILO ===== */
.toast-notificacion {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2332;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: fadeInUp 0.3s ease;
    max-width: 90%;
    text-align: center;
    border-left: 4px solid #1a3a4a;
}

.toast-notificacion:has(✅) {
    border-left-color: #4CAF50;
}

.toast-notificacion:has(ℹ️) {
    border-left-color: #2196F3;
}

.toast-notificacion:has(🗑️) {
    border-left-color: #f44336;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}