@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;700;900&family=Nunito:wght@400;600&family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #a67c52;
    --dark-color: #2d2d2d;
    --light-color: #f4f4f4;
    --title-font: 'Merriweather', serif;
    --body-font: 'Nunito', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--body-font);
    background-color: #fff;
    color: var(--dark-color);
}

/* Navbar Simple */
.simple-nav {
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.back-link {
    text-decoration: none;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.logo {
    font-family: var(--title-font);
    font-size: 1.5rem;
    font-weight: 900;
}

.logo span {
    color: var(--primary-color);
}

/* Contenedor Principal */
.checkout-section {
    padding: 60px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.checkout-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 50px;
}

.section-title {
    font-family: var(--title-font);
    font-size: 2rem;
    margin-bottom: 30px;
}

/* Tabla de Productos */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    text-align: left;
    padding: 15px 0;
    border-bottom: 2px solid var(--dark-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.cart-item td {
    padding: 25px 0;
    border-bottom: 1px solid #eee;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.item-info img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

.item-info h4 {
    margin: 0;
    font-family: var(--title-font);
    font-size: 1.1rem;
}

/* Botón Eliminar */
.remove-btn {
    background: #f9f9f9;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.remove-btn:hover {
    background: #ffebee;
    color: #e74c3c;
}

/* Resumen de Pago */
.summary-card {
    background: #fafafa;
    padding: 40px;
    border-radius: 2px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.total-row {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    font-weight: 700;
    font-size: 1.4rem;
}

.free-shipping {
    color: #27ae60;
    font-weight: bold;
}

/* Selector de Cantidad */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f4f4f4;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 4px;
}

.quantity-control button {
    background: none;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--dark-color);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.quantity-control button:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

.quantity-control span {
    font-family: var(--body-font);
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* FORMULARIO DE PAGO */
#checkout-content {
    transition: all 0.5s ease;
}

.payment-centered-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
    animation: fadeInContainer 0.6s ease forwards;
}

@keyframes fadeInContainer {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.payment-form-container {
    background: #fafafa;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 850px;
    overflow: hidden;
}

.payment-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.payment-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 8px;
}

.highlight {
    color: #b8916d;
    font-weight: 700;
    font-size: 1.2rem;
}

.payment-grid-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
}

.payment-form .form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
}

.payment-form label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #333;
}

.payment-form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    transition: border-color 0.3s;
}

.payment-form input:focus {
    border-color: #b8916d;
    outline: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.methods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 25px;
}

.method-option {
    border: 1px solid #ddd;
    background: #fff;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    border-radius: 4px;
}

.method-option i {
    font-size: 1.5rem;
    color: #555;
}

.method-option span {
    font-size: 0.75rem;
    font-weight: 600;
}

.method-option input {
    display: none;
}

.method-option:has(input:checked) {
    border-color: #000;
    background: #f4f4f4;
    transform: translateY(-2px);
}

.btn-back {
    background: none;
    border: none;
    text-decoration: underline;
    margin-top: 20px;
    cursor: pointer;
    width: 100%;
    color: #888;
    font-size: 0.9rem;
    display: block;
    text-align: center;
}

.btn-back:hover {
    color: #333;
}


/* BOTON*/
.btn-full {
    width: 100%;
    margin-top: 20px;
    background: transparent;
    border: 2px solid var(--dark-color);
    padding: 20px;
    cursor: pointer;
    position: relative;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 700;
}

/* Mensaje Carrito Vacío */
.empty-cart {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 0;
}




/* MEDIA COMPLETOS */
/* =============================================
   RESPONSIVE DESIGN (Media Queries)
   ============================================= */

/* Celulares pequeños a medianos (320px a 480px) */
@media screen and (min-width: 320px) {
    .simple-nav {
        padding: 15px 20px;
        flex-direction: column;
        /* Apilamos logo y link si el espacio es muy reducido */
        gap: 10px;
        text-align: center;
    }

    .logo {
        font-size: 1.2rem;
    }

    .checkout-section {
        padding: 30px 20px;
    }

    .checkout-container {
        grid-template-columns: 1fr;
        /* Una sola columna en móvil */
        gap: 30px;
    }

    .section-title {
        font-size: 1.5rem;
        text-align: center;
    }
}

/* Celulares grandes y Tablets (481px a 768px) */
@media screen and (min-width: 481px) {
    .simple-nav {
        flex-direction: row;
        /* Volvemos a línea horizontal */
        padding: 20px 5%;
    }

    .logo {
        font-size: 1.4rem;
    }

    .section-title {
        font-size: 1.8rem;
        text-align: left;
    }
}

/* Tablets grandes y Laptops (769px a 1024px) */
@media screen and (min-width: 769px) {
    .checkout-container {
        /* Reducimos el ancho de la columna lateral para que no rompa el diseño en tablets */
        grid-template-columns: 1fr 320px;
        gap: 40px;
    }

    .section-title {
        font-size: 2rem;
    }
}

/* Pantallas Desktop estándar (1025px en adelante) */
@media screen and (min-width: 1025px) {
    .checkout-container {
        grid-template-columns: 1fr 380px;
        /* Tamaño original solicitado */
        gap: 50px;
    }
}

/* Pantallas muy grandes (1400px+) */
@media screen and (min-width: 1400px) {
    .checkout-section {
        max-width: 1300px;
        /* Un poco más de aire en pantallas ultra-wide */
    }
}

/* =============================================
   RESPONSIVE DESIGN - CARRITO Y RESUMEN
   ============================================= */

/* Celulares pequeños a medianos (320px a 480px) */
@media screen and (min-width: 320px) {

    /* Transformamos la tabla en bloques para evitar desbordamiento */
    .cart-table thead {
        display: none;
        /* Ocultamos encabezados de tabla en móvil */
    }

    .cart-item td {
        display: block;
        width: 100%;
        padding: 10px 0;
        border: none;
    }

    .item-info {
        flex-direction: row;
        align-items: flex-start;
        gap: 15px;
    }

    .item-info img {
        width: 70px;
        /* Imagen ligeramente más pequeña */
        height: 70px;
    }

    .item-info h4 {
        font-size: 1rem;
    }

    /* Alineamos el control de cantidad y precio */
    .cart-item td:nth-child(2),
    .cart-item td:nth-child(3) {
        display: inline-block;
        width: auto;
        margin-right: 20px;
    }

    /* Ajustes del Resumen de Pago */
    .summary-card {
        padding: 25px 20px;
        position: static;
        /* Quitamos el sticky en móvil para flujo natural */
    }

    .total-row {
        font-size: 1.2rem;
    }
}

/* Celulares grandes y Tablets (481px a 768px) */
@media screen and (min-width: 481px) {
    .item-info img {
        width: 80px;
        height: 80px;
    }

    .cart-item td {
        padding: 20px 0;
    }

    .summary-card {
        padding: 30px;
    }
}

/* Tablets grandes y Laptops (769px a 1024px) */
@media screen and (min-width: 769px) {

    /* Restauramos comportamiento de tabla estándar */
    .cart-table thead {
        display: table-header-group;
    }

    .cart-item td {
        display: table-cell;
        padding: 25px 0;
    }

    .summary-card {
        position: sticky;
        /* El resumen vuelve a seguir el scroll */
        top: 20px;
    }
}

/* Pantallas Desktop estándar (1025px en adelante) */
@media screen and (min-width: 1025px) {
    .item-info img {
        width: 90px;
        height: 90px;
    }

    .total-row {
        font-size: 1.4rem;
    }
}

/* =============================================
   RESPONSIVE DESIGN - FORMULARIO DE PAGO
   ============================================= */

/* Celulares pequeños a medianos (320px a 480px) */
@media screen and (min-width: 320px) {
    .payment-centered-wrapper {
        padding: 10px;
        /* Reducimos espacio lateral para ganar área de escritura */
    }

    .payment-form-container {
        padding: 25px 15px;
        /* Padding interno más ajustado */
    }

    .payment-header h2 {
        font-size: 1.5rem;
    }

    /* El grid de pago pasa a una sola columna */
    .payment-grid-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* Filas de formularios (como fecha y CVV) se apilan */
    .form-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    /* Métodos de pago: 2 columnas para que los iconos no se vean diminutos */
    .methods-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .method-option {
        padding: 12px 5px;
    }

    .payment-form input {
        font-size: 16px;
        /* Evita el zoom automático en iOS al hacer focus */
        padding: 14px;
        /* Área de toque más grande */
    }
}

/* Celulares grandes y Tablets (481px a 768px) */
@media screen and (min-width: 481px) {
    .payment-form-container {
        padding: 35px;
    }

    .payment-header h2 {
        font-size: 1.8rem;
    }

    /* Restauramos las 2 columnas en campos cortos como CVV/Fecha */
    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    /* Métodos de pago: 3 columnas */
    .methods-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablets grandes y Laptops (769px a 1024px) */
@media screen and (min-width: 769px) {

    /* Volvemos al layout de dos columnas principal */
    .payment-grid-layout {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 30px;
    }

    .payment-header h2 {
        font-size: 2rem;
    }
}

/* Pantallas Desktop estándar (1025px en adelante) */
@media screen and (min-width: 1025px) {
    .payment-grid-layout {
        gap: 40px;
    }

    .payment-form-container {
        padding: 40px;
    }
}

/* =============================================
   RESPONSIVE DESIGN - ACCIONES Y ESTADOS
   ============================================= */

/* Celulares pequeños a medianos (320px a 480px) */
@media screen and (min-width: 320px) {
    .btn-full {
        padding: 16px;
        /* Un poco más compacto verticalmente pero fácil de tocar */
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .empty-cart {
        padding: 60px 20px;
        /* Reducimos el padding excesivo en móviles */
    }

    .empty-cart h2 {
        font-size: 1.5rem;
    }
}

/* Celulares grandes y Tablets (481px a 768px) */
@media screen and (min-width: 481px) {
    .btn-full {
        padding: 18px;
        font-size: 0.9rem;
    }

    .empty-cart {
        padding: 80px 0;
    }
}

/* Tablets grandes y Laptops (769px a 1024px) */
@media screen and (min-width: 769px) {
    .btn-full {
        padding: 20px;
        /* Restauramos el tamaño original de escritorio */
    }

    .empty-cart {
        padding: 100px 0;
    }
}

/* Pantallas Desktop estándar (1025px en adelante) */
@media screen and (min-width: 1025px) {
    .btn-full {
        /* Efecto de hover solo para dispositivos con puntero (ratón) */
        transition: all 0.3s ease;
    }

    .btn-full:hover {
        background: var(--dark-color);
        color: #fff;
    }
}