/* ===== CATEGORÍAS DESTACADAS ===== */

.categorias-section {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #718096;
    margin: 0;
}

/* Grid de Categorías */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* Tarjeta de Categoría */
.categoria-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
}

.categoria-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
}

.categoria-card:active {
    transform: translateY(-4px) scale(0.98);
}

/* Icono de Categoría */
.categoria-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.categoria-card:hover .categoria-icon {
    transform: rotate(5deg) scale(1.1);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.4);
}

/* Imagen de Categoría */
.categoria-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Emoji de Categoría (fallback) */
.categoria-emoji {
    font-size: 2.5rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Nombre de Categoría */
.categoria-nombre {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Contador de Productos (opcional) */
.categoria-count {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

/* Loading de Categorías */
.categorias-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.categorias-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mensaje cuando no hay categorías */
.categorias-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #718096;
    font-size: 1.1rem;
}

/* Ver Todas las Categorías */
.categoria-ver-todas {
    background: linear-gradient(135deg, #f8f9fa 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e0;
}

.categoria-ver-todas:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

.categoria-ver-todas:hover .categoria-emoji {
    filter: brightness(0) invert(1);
}

.categoria-ver-todas:hover .categoria-nombre {
    color: white;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .categorias-section {
        padding: 2rem 0;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .categorias-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 1rem;
    }

    .categoria-card {
        padding: 1.25rem 0.75rem;
        border-radius: 16px;
    }

    .categoria-icon {
        width: 65px;
        height: 65px;
    }

    .categoria-emoji {
        font-size: 2rem;
    }

    .categoria-nombre {
        font-size: 0.9rem;
    }

    .categoria-count {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .categorias-section {
        padding: 1.5rem 0;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
    }

    .categorias-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.875rem;
    }

    .categoria-card {
        padding: 1rem 0.5rem;
    }

    .categoria-icon {
        width: 55px;
        height: 55px;
    }

    .categoria-emoji {
        font-size: 1.75rem;
    }

    .categoria-nombre {
        font-size: 0.85rem;
    }
}

/* Animación de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.categoria-card {
    animation: fadeInUp 0.5s ease-out backwards;
}

.categoria-card:nth-child(1) { animation-delay: 0.05s; }
.categoria-card:nth-child(2) { animation-delay: 0.1s; }
.categoria-card:nth-child(3) { animation-delay: 0.15s; }
.categoria-card:nth-child(4) { animation-delay: 0.2s; }
.categoria-card:nth-child(5) { animation-delay: 0.25s; }
.categoria-card:nth-child(6) { animation-delay: 0.3s; }
.categoria-card:nth-child(7) { animation-delay: 0.35s; }
.categoria-card:nth-child(8) { animation-delay: 0.4s; }

/* ===== RAILS HORIZONTALES POR CATEGORÍA (inicio-cats-rail) ===== */

#inicio-cats-rail {
    background: #f7f8fa;
    padding: 1.5rem 0 2.5rem;
    overflow-x: hidden;
}

#inicio-cats-rail .container {
    width: 100%;
    overflow: hidden;
}

.inicio-cat-bloque {
    margin-bottom: 2.2rem;
}

.inicio-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
    padding: 0 0.25rem;
}

.inicio-cat-controles {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inicio-cat-playstop {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.inicio-cat-playstop:hover {
    background: rgba(102, 126, 234, 0.25);
    transform: scale(1.1);
}

.inicio-cat-titulo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.inicio-cat-ver-mas {
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}
.inicio-cat-ver-mas:hover { color: #764ba2; }

/* Rail de scroll horizontal */
.inicio-cat-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.85rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 8px;
    padding-bottom: 0.75rem;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    width: 100%;
    box-sizing: border-box;
    will-change: scroll-position;
}
.inicio-cat-scroll:active { cursor: grabbing; }
.inicio-cat-scroll::-webkit-scrollbar { height: 5px; }
.inicio-cat-scroll::-webkit-scrollbar-track { background: transparent; }
.inicio-cat-scroll::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

/* Tarjeta mini de producto */
.inicio-pcard {
    flex: 0 0 250px;
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    background: #fff;
    border-radius: 18px;
    border: 2px solid rgba(102, 126, 234, 0.25);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.15), 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    will-change: transform;
    transform: translateZ(0);
}
.inicio-pcard:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.28), 0 3px 8px rgba(0,0,0,.08);
    border-color: rgba(102, 126, 234, 0.6);
}

.inicio-pcard__img {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 4;
    background: #f7f8fa;
    overflow: hidden;
}
.inicio-pcard__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}
.inicio-pcard__no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.75rem;
    color: #aaa;
}
.inicio-pcard__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    z-index: 1;
}
.inicio-pcard__badge--escalera {
    top: auto;
    bottom: 8px;
    left: 8px;
    background: #805ad5;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 6px;
}

/* Botón carrito amarillo */
.inicio-pcard__cart {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    background: #f6c90e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,.2);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 2;
    border: none;
}
.inicio-pcard__cart:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 14px rgba(0,0,0,.25);
}
.inicio-pcard__cart i { font-size: 1rem; color: #333; }
.inicio-pcard__cart--activo {
    background: #5a67d8;
}
.inicio-pcard__cart--activo:hover {
    background: #4c56c0;
}
.inicio-pcard__cart-qty {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.inicio-pcard__body {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.inicio-pcard__meta {
    font-size: 0.68rem;
    font-weight: 700;
    color: #a0aec0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.inicio-pcard__name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.inicio-pcard__prices {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.1rem;
}
.inicio-pcard__precio {
    font-size: 1.05rem;
    font-weight: 800;
    color: #5a67d8;
}
.inicio-pcard__tachado {
    font-size: 0.75rem;
    color: #a0aec0;
    text-decoration: line-through;
}

/* Badges de disponibilidad */
.inicio-pcard__disp {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.32rem 0.5rem;
    border-radius: 20px;
    margin-top: 0.3rem;
}
.inicio-pcard__disp--disponible { background: #d4edda; color: #276749; }
.inicio-pcard__disp--pedido     { background: #fff3cd; color: #856404; }
.inicio-pcard__disp--agotado    { background: #ffe0e0; color: #c53030; }

/* Tarjeta rail: hereda estilos de .producto-card con ancho fijo */
.inicio-pcard-rail {
    flex: 0 0 250px;
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    cursor: pointer;
    border-radius: 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.12), 0 1px 4px rgba(0,0,0,.05);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    will-change: transform;
    transform: translateZ(0);
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.inicio-pcard-rail:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.28), 0 3px 8px rgba(0,0,0,.08);
    border-color: rgba(102, 126, 234, 0.55);
}
.inicio-pcard-rail .producto-imagen {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f7f8fa;
}
.inicio-pcard-rail .producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.producto-descuento--escalera {
    left: auto;
    right: 8px;
    background: #805ad5;
}
@media (max-width: 600px) {
    .inicio-pcard-rail {
        flex: 0 0 72vw;
        width: 72vw;
        min-width: 72vw;
        max-width: 72vw;
    }
}
