/* =========================
    ESTILOS GENERALES
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #faf7f2;
    color: #2c2c2c;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    padding: 70px 0;
}

h1, h2, h3 {
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

/* =========================
    HEADER
========================= */

header {
    background-color: #fff;
    border-bottom: 1px solid #e8dfd2;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #8a5a44;
}

.logo-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.logo-text {
    white-space: nowrap;
}

nav ul {
    display: flex;
    gap: 25px;
    list-style: none;
}

nav a {
    font-size: 0.95rem;
    color: #333;
}

nav a:hover {
    color: #8a5a44;
}

.cart-button {
    background-color: #8a5a44;
    color: #fff;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
}

/* =========================
    HERO
========================= */

.hero {
    background:
        linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
        url("/assets/images/hero.jpeg") center / cover no-repeat;
    color: #ffffff;
    min-height: 60vh;
    display: flex;
    align-items: center;
    text-align: center;
}

.hero-content {
    max-width: 750px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.primary-button {
    background-color: #fff;
    color: #8a5a44;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: bold;
    display: inline-block;
}

.primary-button:hover {
    background-color: #f2e7da;
}

/* =========================
    CATEGORÍAS
========================= */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 25px;
}

.category-card {
    background-color: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-card h3 {
    padding: 20px;
    text-align: center;
    color: #8a5a44;
}

.category-image {
    height: 300px;
    object-fit: cover;
    border-radius: 0;
}

/* =========================
    PRODUCTOS
========================= */

.products-header {
    text-align: center;
    margin-bottom: 35px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.filter-button {
    padding: 10px 18px;
    border-radius: 25px;
    background-color: #fff;
    border: 1px solid #d7c4b2;
    color: #8a5a44;
}

.filter-button:hover,
.filter-button.active {
    background-color: #8a5a44;
    color: #fff;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.product-card {
    background-color: #fff;
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.product-card .add-to-cart {
    cursor: pointer;
}

.product-image-wrapper {
    position: relative;
}

.product-availability {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1.2;
}

.product-image-wrapper .product-availability {
    position: absolute;
    top: 10px;
    left: 10px;
}

.availability-in-stock {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.availability-made-to-order {
    background-color: #fff3e0;
    color: #ef6c00;
}

.cart-item-info .product-availability {
    margin-top: 4px;
    margin-bottom: 4px;
}

.product-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.product-detail-badges .product-availability {
    position: static;
}

.product-detail-measures {
    color: #666;
    margin-bottom: 18px;
}

.product-detail-measures.hidden {
    display: none;
}

body.product-detail-open {
    overflow: hidden;
}

.product-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-detail-modal.hidden {
    display: none;
}

.product-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.product-detail-dialog {
    position: relative;
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.product-detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f2e7da;
    color: #8a5a44;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
}

.product-detail-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.product-detail-main-image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(70vh, 640px);
    object-fit: contain;
    border-radius: 16px;
}

.product-detail-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    overflow-x: auto;
}

.product-detail-thumbs.hidden {
    display: none;
}

.product-detail-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: none;
    cursor: pointer;
}

.product-detail-thumb.active {
    border-color: #8a5a44;
}

.product-detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-info h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    text-align: left;
}

.product-detail-description {
    color: #666;
    margin-bottom: 18px;
}

.product-detail-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: #8a5a44;
    margin-bottom: 22px;
}

@media (max-width: 768px) {
    .product-detail-dialog {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
}

.product-info {
    padding-top: 15px;
}

.product-id {
    font-size: 0.8rem;
    color: #8a5a44;
    font-weight: bold;
    margin-bottom: 6px;
}

.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.product-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

.product-price {
    font-weight: bold;
    color: #8a5a44;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.add-to-cart {
    width: 100%;
    background-color: #8a5a44;
    color: #fff;
    padding: 12px;
    border-radius: 25px;
}

.add-to-cart:hover {
    background-color: #6f4635;
}

/* =========================
    SOBRE LA MARCA
========================= */

.about {
    background-color: #8a5a44;
    color: #fff;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-text p {
    margin-bottom: 15px;
    color: #fff;
}

.about-image {
    border-radius: 16px;
    object-fit: cover;
}

/* =========================
    FOOTER
========================= */

footer {
    background-color: #2c2c2c;
    color: #fff;
    padding: 45px 0 20px;
}

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

footer h3 {
    margin-bottom: 15px;
    color: #f2e7da;
}

footer ul {
    list-style: none;
}

footer li {
    margin-bottom: 8px;
    color: #ccc;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #444;
    padding-top: 20px;
    color: #aaa;
    font-size: 0.9rem;
}

/* =========================
    CARRITO LATERAL
========================= */

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 360px;
    height: 100vh;
    background-color: #fff;
    box-shadow: -4px 0 14px rgba(0,0,0,0.15);
    z-index: 2000;
    transition: right 0.3s ease;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.close-cart {
    background: none;
    font-size: 1.5rem;
    color: #333;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    color: #555;
}

.cart-empty {
    text-align: center;
    color: #888;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-name {
    font-weight: bold;
    color: #333;
}

.cart-item-price {
    font-size: 0.9rem;
    color: #8a5a44;
}

.remove-from-cart {
    background: none;
    color: #999;
    font-size: 1.4rem;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
}

.remove-from-cart:hover {
    color: #c62828;
}

.cart-footer {
    margin-top: auto;
    padding-top: 20px;
}

.cart-total {
    font-weight: bold;
    font-size: 1.2rem;
}

.clear-cart-button {
    width: 100%;
    margin-top: 15px;
    background-color: #fff;
    color: #8a5a44;
    border: 1px solid #d7c4b2;
    padding: 12px;
    border-radius: 25px;
}

.clear-cart-button:hover:not(:disabled) {
    background-color: #f2e7da;
}

.clear-cart-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-button {
    width: 100%;
    margin-top: 10px;
    background-color: #8a5a44;
    color: #fff;
    padding: 14px;
    border-radius: 25px;
}

.checkout-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-status {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.checkout-status-card {
    width: 100%;
    max-width: 560px;
    background-color: #fff;
    border: 1px solid #e8dfd2;
    border-radius: 20px;
    padding: 40px 32px;
    text-align: center;
}

.checkout-status-card h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.checkout-status-card p {
    color: #666;
    margin-bottom: 28px;
}

.checkout-status-badge {
    display: inline-block;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: bold;
}

.checkout-status-badge.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.checkout-status-badge.cancel {
    background-color: #fff3e0;
    color: #ef6c00;
}

.order-summary {
    text-align: left;
    margin-bottom: 28px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.order-summary h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    text-align: left;
}

.order-summary p {
    margin-bottom: 10px;
    text-align: left;
}

.order-summary-list {
    list-style: none;
    margin-top: 16px;
    padding: 0;
}

.order-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.order-summary-list li span {
    color: #666;
    white-space: nowrap;
}

/* =========================
    RESPONSIVE
========================= */

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

    .categories-grid,
    .about-content,
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero h1 {
        font-size: 2.3rem;
    }
}

@media (max-width: 600px) {
    nav ul {
        display: none;
    }

    .products-grid,
    .categories-grid,
    .about-content,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
}
