.category-card {
    text-decoration: none;
    color: inherit;
}

.cards2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 40px;
}

@media (max-width: 1200px) {
    .cards2 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .cards2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== SCROLL HORIZONTAL PARA MÓVILES ===== */
@media (max-width: 768px) {
    .cards2 {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 15px;
        padding-bottom: 20px; /* Da aire para la barra de scroll */
        scroll-snap-type: x mandatory; /* Movimiento magnético suave */
        -webkit-overflow-scrolling: touch; /* Fluidez nativa en iOS */
    }

    .category-wrapper {
        flex: 0 0 75%; /* Cada tarjeta ocupa el 75% de la pantalla para dejar asomar la siguiente */
        scroll-snap-align: center; /* Centra la tarjeta al soltar el dedo */
    }

    /* Estilos Premium para la barra de scroll */
    .cards2::-webkit-scrollbar {
        height: 6px;
    }
    
    .cards2::-webkit-scrollbar-track {
        background: #1a1a1a;
        border-radius: 10px;
    }
    
    .cards2::-webkit-scrollbar-thumb {
        background: var(--dorado);
        border-radius: 10px;
    }
}



.category-inner {
    padding: 0;
    overflow: hidden;
}

.category-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.category-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.4s;
}

.category-inner h4 {
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--dorado);
}

.category-card:hover img {
    transform: scale(1.08);
}







.overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,.8);
display: none;
justify-content: center;
align-items: center;
z-index: 999;
}


.overlay-content {
background: #111;
padding: 30px;
border-radius: 12px;
width: 400px;
}


.overlay-content h3 {
color: var(--dorado);
margin-bottom: 20px;
}


.overlay-content input[type=text] {
width: 100%;
padding: 12px;
margin-bottom: 15px;
border-radius: 6px;
border: none;
}


.file-label {
display: block;
background: var(--dorado);
color: #000;
padding: 12px;
border-radius: 6px;
text-align: center;
cursor: pointer;
margin-bottom: 15px;
}


.crop-container {
    width: 100%;
    height: 300px;          /* 🔥 CLAVE */
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-container img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}





.overlay-actions {
display: flex;
justify-content: space-between;
margin-top: 20px;
}


.overlay-actions button {
padding: 10px 20px;
border-radius: 6px;
}




/* ===== BOTONES ADMIN EN CATEGORÍAS ===== */
.category-wrapper {
    position: relative; /* Clave para que los botones flotantes no se salgan */
    display: block;
}

.admin-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10; /* Se asegura de estar por encima del enlace <a> */
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

/* Mostrar botones al pasar el mouse por encima de la tarjeta */
.category-wrapper:hover .admin-actions {
    opacity: 1;
    transform: translateX(0);
}

.btn-action {
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--blanco);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: 0.3s;
    backdrop-filter: blur(5px);
}

.btn-action:hover {
    border-color: var(--dorado);
    transform: scale(1.1);
}

.btn-action.edit:hover {
    background: var(--dorado);
    color: var(--negro);
}

.btn-action.delete:hover {
    background: #ff4757;
    border-color: #ff4757;
    color: var(--blanco);
}

/* En dispositivos móviles los mostramos siempre porque no hay "hover" */
@media (max-width: 768px) {
    .admin-actions {
        opacity: 1;
        transform: translateX(0);
        flex-direction: row;
        top: 10px;
        right: 10px;
    }
}


.category-inner h4 {
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--dorado);
}


.category-link {
    text-decoration: none;
    color: inherit;
    display: block; /* Agregamos esto para que se comporte bien */
}

/* Y un poco más abajo, actualizá el hover: */
.category-link:hover img {
    transform: scale(1.08);
}