﻿/* === Base === */
body {
    font-family: Arial, sans-serif;
    background: #F6F6F6;
    margin: 0;
    padding: 0;
    text-align: left;
    user-select: none;
}

.main-content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px;
    box-sizing: border-box;
}

/* === Product Cards Grid === */
.productos {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 40px;
}

/* === Product Display Container === */
.product-display {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
    background-color: #F6F6F6;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    box-sizing: border-box;
    position: static;
    overflow: visible;
}

/* === Product Card (Front) === */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 280px;
    flex-shrink: 0;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    box-sizing: border-box;
}

.card h2 {
    color: var(--azul);
    margin-bottom: 10px;
    font-family: Arial, sans-serif;
    text-align: center;
}

.card-elevate {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card img {
    width: 100%;
    max-width: 180px;
    height: auto;
    border-radius: 10px;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
}

.titulo {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 10px;
    color: var(--azul);
}

.precio {
    color: #444;
    font-size: 20px;
    margin: 15px 0;
    font-weight: bold;
}

/* === Botón principal === */
.btn {
    background: var(--azul);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, border-radius 0.3s ease;
    margin-top: 25px;
    margin-bottom: 20px;
    font-size: 0.95em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    border-radius: 5px;
    background: var(--verde);
    text-decoration: none;
}

/* === Product Details (Back) === */
.product-details {
    flex-grow: 1;
    color: #333;
    line-height: 1.6;
    padding: 0 10px;
    box-sizing: border-box;
}

.product-details h2 {
    font-size: 2em;
    color: var(--azul);
    margin-bottom: 20px;
}

.product-details h4 {
    font-size: 1.4em;
    color: var(--azul);
    margin-top: 30px;
    margin-bottom: 15px;
}

.product-details p {
    margin-bottom: 12px;
    font-size: 1em;
}

.product-details ul {
    list-style: disc inside;
    padding-left: 0;
    margin-top: 15px;
}

.product-details ul li {
    margin-bottom: 8px;
    font-size: 0.95em;
}

/* === Botones de acción — ocultos por defecto === */
.btn-show-details,
.btn-show-card {
    display: none;
}

/* ============================================================
   RESPONSIVO: MÓVIL
   ============================================================ */
@media (max-width: 768px) {
    .main-content-wrapper {
        padding: 15px;
    }

    /* Contenedor flip */
    .product-display {
        flex-direction: column;
        align-items: center;
        padding: 15px;
        gap: 0;
        height: 580px;
        width: 92%;
        max-width: 340px;
        perspective: 1000px;
        position: relative;
        overflow: hidden;
        transform-style: preserve-3d;
    }

    /* Cara frontal */
    .card {
        position: absolute;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        padding: 20px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        overflow-y: hidden;
        backface-visibility: hidden;
        transform: rotateY(0deg);
        transition: transform 0.6s;
        z-index: 2;
    }

    /* Cara trasera */
    .product-details {
        position: absolute;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        padding: 20px;
        text-align: left;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        overflow-y: auto;
        background-color: white;
        border-radius: 15px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        backface-visibility: hidden;
        transform: rotateY(180deg);
        transition: transform 0.6s;
    }

    /* Flip activo */
    .product-display.flipped .card {
        transform: rotateY(180deg);
    }

    .product-display.flipped .product-details {
        transform: rotateY(0deg);
    }

    .card img {
        max-width: 160px;
        margin-bottom: 12px;
    }

    .product-details h3 { font-size: 1.2em; margin-bottom: 10px; }
    .product-details h4 { font-size: 1em; margin-top: 10px; margin-bottom: 6px; }
    .product-details p,
    .product-details ul li { font-size: 0.75em; line-height: 1.2; margin-bottom: 4px; }

    /* =====================================================
       BOTÓN "VER DETALLES" — CORREGIDO: ahora es visible
       ===================================================== */
    .btn-show-details {
        display: block;
        background: var(--azul);
        color: white;
        border: none;
        border-radius: 25px;
        font-size: 0.95em;       /* igual que .btn */
        font-weight: bold;
        text-transform: uppercase;
        padding: 12px 20px;      /* igual que .btn */
        width: calc(100% - 40px); /* mismo ancho visual que CONTACTANOS */
        text-align: center;
        margin-top: auto;
        margin-bottom: 16px;
        align-self: center;
        cursor: pointer;
        transition: background 0.3s ease, border-radius 0.3s ease;
        letter-spacing: 0.5px;
        box-sizing: border-box;
    }

    .btn-show-details:hover,
    .btn-show-details:active {
        background: var(--verde);
        border-radius: 8px;
    }

    /* Botón "Volver" en la cara trasera */
    .btn-show-card {
        display: none; /* oculto por defecto, solo aparece al flipear */
    }

    .product-display.flipped .btn-show-card {
        display: block;
        background: var(--azul);
        color: white;
        border: none;
        border-radius: 25px;
        font-size: 0.95em;
        font-weight: bold;
        text-transform: uppercase;
        padding: 12px 20px;
        width: calc(100% - 40px);
        text-align: center;
        margin-top: auto;
        margin-bottom: 10px;
        align-self: center;
        cursor: pointer;
        transition: background 0.3s ease, border-radius 0.3s ease;
        box-sizing: border-box;
    }

    .product-display.flipped .btn-show-card:hover,
    .product-display.flipped .btn-show-card:active {
        background: var(--verde);
        border-radius: 8px;
    }
}

/* === Prevención de flip en escritorio === */
@media (min-width: 769px) {
    .product-display.flipped .card,
    .product-display.flipped .product-details {
        transform: none !important;
    }

    .btn-show-details,
    .btn-show-card {
        display: none !important;
    }
}

/* === Pantallas muy pequeñas (≤390px — Honor Magic 5 Lite, etc.) === */
@media (max-width: 400px) {
    .product-display {
        width: 96%;
        height: 540px;
        max-width: 100%;
    }

    .card,
    .product-details {
        padding: 14px;
    }

    .card img {
        max-width: 140px;
    }

    .btn-show-details,
    .product-display.flipped .btn-show-card {
        font-size: 0.82em;
        padding: 9px 20px;
    }
}