/* Catalog grid */
#seccion-catalogo {
    padding: 3rem 2rem;
    width: 100%;
    /* Fondo con patrón sutil y gradiente elegante */
    background: radial-gradient(circle at center, #ffffff 0%, #f4f6f8 100%);
    position: relative;
    overflow: hidden;
}

/* Decoración extra para el fondo */
#seccion-catalogo::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
#seccion-catalogo::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

#catalog-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Animación de fondo (Cruces sutiles) */
.catalog-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.catalog-bg-animation i {
    position: absolute;
    color: #c9a227;
    opacity: 0.15; /* Más visible */
    font-size: 15vw; /* Escala relativa al ancho de la pantalla para celulares */
    animation: floatCross 20s infinite ease-in-out alternate;
    will-change: transform; /* Optimización de rendimiento para evitar trabas */
}
.catalog-bg-animation .cross-1 {
    top: 10%;
    left: 5%;
    animation-duration: 25s;
}
.catalog-bg-animation .cross-2 {
    top: 50%;
    right: 10%;
    font-size: 25vw;
    animation-duration: 35s;
    animation-delay: -5s;
}
.catalog-bg-animation .cross-3 {
    bottom: 5%;
    left: 40%;
    font-size: 20vw;
    animation-duration: 28s;
    animation-delay: -10s;
}
.catalog-bg-animation .cross-4 {
    top: 20%;
    right: 35%;
    font-size: 10vw;
    animation-duration: 22s;
    animation-delay: -3s;
}
.catalog-bg-animation .cross-5 {
    bottom: 25%;
    left: 10%;
    font-size: 18vw;
    animation-duration: 32s;
    animation-delay: -7s;
}
.catalog-bg-animation .cross-6 {
    top: 60%;
    left: 70%;
    font-size: 12vw;
    animation-duration: 26s;
    animation-delay: -12s;
}
.catalog-bg-animation .cross-7 {
    bottom: 10%;
    right: 20%;
    font-size: 16vw;
    animation-duration: 30s;
    animation-delay: -15s;
}

@keyframes floatCross {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    50% {
        transform: translateY(-50px) rotate(5deg) scale(1.05);
    }
    100% {
        transform: translateY(20px) rotate(-5deg) scale(0.95);
    }
}

/* Horizontal Card */
.catalog-card {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.catalog-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    .catalog-card {
        flex-direction: row;
        min-height: 400px; /* Ya no está fijo a 450px para evitar el espacio muerto en la parte baja */
    }
}

.catalog-img-wrapper {
    width: 100%;
    height: 300px;
    perspective: 1500px;
    margin-bottom: 15px;
}

@media (min-width: 768px) {
    .catalog-img-wrapper {
        height: 350px;
    }
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-front, .flip-back, .flip-extra {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
}

.flip-back {
    transform: rotateY(180deg);
}

.flip-extra {
    /* Using rotateX for the interior to make it different, or rotateY(-180)? 
       Actually rotateY(360deg) makes it spin further in the same direction! */
    transform: rotateY(360deg);
}

.catalog-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.catalog-img:hover {
    transform: scale(1.05);
}

.catalog-card-image-section {
    flex: 1;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
    
    /* Staggered load animation */
    opacity: 0;
    transform: translateX(-30px);
    animation: slideInFade 0.6s ease-out forwards;
}

@keyframes slideInFade {
    to { opacity: 1; transform: translateX(0); }
}

.catalog-image-nav {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.catalog-image-nav button {
    background: #e9ecef;
    border: none;
    border-radius: 20px;
    padding: 6px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.catalog-image-nav button:hover,
.catalog-image-nav button.active {
    background: var(--secondary, #c9a227);
    color: white;
}

.catalog-card-info-section {
    flex: 1.5;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.catalog-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 15px 0;
    font-family: 'Playfair Display', serif;
}

.catalog-desc {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.8;
    flex-grow: 1;
    margin-bottom: 20px;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Scrollbar personalizado para la descripción */
.catalog-desc::-webkit-scrollbar {
    width: 6px;
}
.catalog-desc::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 10px;
}
.catalog-desc::-webkit-scrollbar-thumb {
    background: #c9a227; 
    border-radius: 10px;
}
.catalog-desc::-webkit-scrollbar-thumb:hover {
    background: #a88720; 
}

/* Animación palabra por palabra */
.word-anim {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUpWord 0.4s ease-out forwards;
    margin-right: 4px; /* Espacio entre palabras */
}

@keyframes fadeUpWord {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.catalog-price-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    gap: 15px;
}

.catalog-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--secondary, #c9a227);
}

.add-to-cart-btn {
    background: #25d366;
    border: none;
    border-radius: 50px;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    position: relative;
    overflow: hidden;
}

/* Efecto de brillo (cruz/luz recorriendo) */
.add-to-cart-btn::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -100%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(35deg);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.add-to-cart-btn:hover::after {
    left: 150%;
}

.add-to-cart-btn:hover {
    background: #1ebc5a;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}
.lightbox.active {
    visibility: visible;
    opacity: 1;
}

.lightbox-flip-container {
    width: 90vw;
    height: 80vh;
    perspective: 2000px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-flip-inner {
    /* Reuses .flip-inner but needs explicit bounds since parent is flex */
    width: 100%;
    height: 100%;
}

.lightbox-flip-inner .flip-front,
.lightbox-flip-inner .flip-back {
    /* Reuses .flip-front and .flip-back but with transparent background for lightbox */
    background: transparent !important;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-out;
}

.lightbox-controls {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: none; /* Let clicks pass through except on buttons */
}

.lightbox-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.lightbox-btn i {
    font-size: 0.9rem;
}

/* Cart */
#floating-cart {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    background-color: #25d366; /* WhatsApp color approx */
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 1.5rem;
}
.cart-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Cart Modal Styles */
.cart-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cart-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
.cart-modal {
    background: white;
    width: 100%;
    max-width: 450px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.cart-modal-overlay.open .cart-modal {
    transform: translateY(0);
}
.cart-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-modal-header h3 {
    margin: 0;
    font-size: 1.2em;
}
.cart-modal-body {
    padding: 20px;
    overflow-y: auto;
}
.cart-step-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 20px 0;
}
.step-indicator {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.3s ease;
}
.step-indicator.active {
    background: var(--primary-color, #c9a227);
    color: white;
}
.step-indicator.completed {
    background: #25D366;
    color: white;
}
.step-line {
    height: 3px;
    width: 40px;
    background: #e0e0e0;
    margin: 0 5px;
    transition: background 0.3s ease;
}
.step-line.active {
    background: var(--primary-color, #c9a227);
}
.delivery-option input[type="radio"] {
    display: none;
}
.delivery-option {
    transition: all 0.2s ease;
}
.delivery-option:hover {
    background: #f9f9f9;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}
.cart-item-title {
    font-weight: bold;
}
.cart-item-price {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}
.cart-item-actions {
    display: flex;
    align-items: center;
}
.cart-item-actions button {
    margin: 0 8px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border: none;
    background: #f1f1f1;
    border-radius: 5px;
    font-weight: bold;
    color: #333;
    transition: background 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}
.cart-item-actions button:hover {
    background: #e0e0e0;
}
.cart-item-actions span {
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}
.close-cart {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.5rem;
}

/* Admin modal additions */
#catalogAdminModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}
