.cart-item {
    transition: all 0.2s ease;
}

.image-card img {
    border: 2px solid transparent;
    cursor: pointer;
}

.image-card img.active {
    border: 2px solid red;
}


.order-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-title {
    padding: 20px;
}




.product-card {
    max-width: 400px;
    margin: 20px auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: box-shadow 0.2s ease;
    padding: 10px;
    text-align: center;
    cursor: pointer;
}


.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-detail {
    display: flex;
    gap: 30px;
    max-width: 1000px;
    margin: 40px auto;
}

.product-detail-image {
    width: 400px;
}

.product-detail-image img {
    width: 100%;
}

.product-detail-info {
    max-width: 400px;
}

.product-info {
    flex: 1;
    max-width: 400px;
}

/* THUMBNAILS */
.product-gallery {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    gap: 10px;
}

.product-gallery .thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #ccc;
}

.product-gallery .thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #ccc;
}


.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.product-image {
    max-width: 400px;
    margin: 20px auto;
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid #eee;
}

/* IZQUIERDA */
.product-images {
    display: flex;
    gap: 10px;
}

.product-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.product-info {
    flex: 1;
    padding: 10px;
    max-width: 400px;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}


/* 🔥 CLAVE: CONTENEDOR FIJO */
.product-main-image {
    width: 400px;
    height: 400px;
    border: 1px solid #ddd;
    text-align: center;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
    /* 🔥 clave */
}

.product-main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #00a650;
    margin: 20px 0;
    /* estilo ML */
}

.product-title {
    font-size: 14px;
    margin: 5px 0;
}



.qty-control {
    display: flex;
    gap: 5px;
}

.qty-control button {
    width: 30px;
    height: 30px;
    cursor: pointer;
}


.status.cancelled {
    color: red;
}

.status.paid {
    color: green;
}


.status.pending {
    color: orange;
}

.thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    cursor: pointer;
}

#preview img {
    border: 2px solid black;
}

.catalog-layout {
    display: flex;
    gap: 30px;
}

.sidebar {
    width: 220px;
}

.products-grid {
    flex: 1;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

:root {
    --bg: #f7f2ea;
    --surface: #ffffff;
    --text: #1f1f1f;
    --muted: #777066;
    --accent: #7a4f32;
    --border: #e5ded4;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.home-page {
    padding-bottom: 40px;
}

.home-hero {
    min-height: 72vh;
    padding: 24px 18px;
    display: flex;
    align-items: flex-end;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.58)),
        url("/static/img/hero-vintage.jpg");
    background-size: cover;
    background-position: center;
    color: white;
}

.home-hero-content {
    max-width: 520px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    margin-bottom: 10px;
}

.home-hero h1 {
    font-size: clamp(42px, 13vw, 72px);
    line-height: 0.95;
    margin: 0;
}

.tagline {
    font-size: 17px;
    margin: 14px 0 24px;
    color: inherit;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 999px;
    background: white;
    color: #1f1f1f;
    text-decoration: none;
    font-weight: 700;
}

.home-categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 18px;
    scrollbar-width: none;
}

.home-categories::-webkit-scrollbar {
    display: none;
}

.category-pill {
    white-space: nowrap;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.home-section {
    padding: 0 14px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 4px 14px;
}

.section-header h2 {
    margin: 0;
    font-size: 22px;
}

.section-header a {
    color: var(--accent);
    font-size: 14px;
    text-decoration: none;
    font-weight: 700;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.product-card {
    margin: 0;
    padding: 0;
    max-width: none;
    border: none;
    border-radius: 14px;
    background: transparent;
    text-align: left;
    overflow: hidden;
}

.product-card:hover {
    box-shadow: none;
}

.product-image {
    margin: 0;
    max-width: none;
    height: auto;
    aspect-ratio: 4 / 5;
    border-radius: 14px;
    overflow: hidden;
    background: #eee;
    border-bottom: none;
}

.product-card img,
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card h3 {
    font-size: 14px;
    line-height: 1.25;
    margin: 8px 2px 4px;
    font-weight: 600;
}

.product-price {
    margin: 0 2px 8px;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.product-actions {
    padding: 0 2px 8px;
}

.product-actions p {
    display: none;
}

.product-actions .btn-secondary {
    display: none;
}

.product-actions .btn-primary,
.product-actions button {
    width: 100%;
    min-height: 40px;
    border: none;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.out-of-stock {
    display: block !important;
    color: #8a2d2d;
    font-size: 13px;
}

@media (min-width: 768px) {
    .home-hero {
        min-height: 620px;
        padding: 48px;
    }

    .home-section {
        max-width: 1180px;
        margin: 0 auto;
        padding: 0 24px;
    }

    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 22px;
    }
}

/* =========================
   PRODUCT DETAIL - MOBILE
   ========================= */

@media (max-width: 767px) {

    .product-detail {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 14px;
        box-sizing: border-box;
    }

    .product-images {
        display: flex;
        flex-direction: column-reverse;
        width: 100%;
        gap: 12px;
    }

    .product-main-image {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
        box-sizing: border-box;
        border-radius: 16px;
        background: #fff;
    }

    .product-main-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .product-gallery {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        margin-top: 0;
        padding-bottom: 4px;
    }

    .product-gallery .thumb,
    .product-images>.thumb {
        width: 64px;
        height: 64px;
        min-width: 64px;
        border-radius: 10px;
        object-fit: cover;
    }

    .product-info {
        max-width: 100%;
        padding: 16px 0 80px;
    }
}

@media (max-width: 767px) {

    .product-gallery {
        display: flex;
        justify-content: center;
        gap: 12px;
    }

    .product-gallery .thumb {
        width: 100px;
        height: 100px;
        border-radius: 12px;
    }
}

/* =========================
   PRODUCT DETAIL FINAL
   ========================= */

.product-images {
    display: flex;
    gap: 16px;
}

.product-main-image {
    order: 1;
}

.product-gallery {
    order: 2;
}

/* MÓVIL */
@media (max-width: 767px) {

    .product-images {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .product-main-image {
        order: 1;
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
    }

    .product-gallery {
        order: 2;
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: 100%;
    }

    .product-gallery .thumb {
        width: 92px;
        height: 92px;
        min-width: 92px;
    }
}

/* PC */
@media (min-width: 768px) {

    .product-images {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
    }

    .product-main-image {
        order: 1;
    }

    .product-gallery {
        order: 2;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

/* Miniaturas móviles con scroll horizontal */
@media (max-width: 767px) {

    .product-gallery {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        padding: 6px 2px 12px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .product-gallery .thumb {
        flex: 0 0 auto;
        width: 92px;
        height: 92px;
        min-width: 92px;
        scroll-snap-align: start;
    }
}

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

.site-footer {
    margin-top: 60px;
    background: #efe8dd;
    border-top: 1px solid #ddd3c4;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.footer-brand {
    margin-bottom: 30px;
}

.footer-brand h3 {
    margin: 0 0 8px;
}

.footer-brand p {
    margin: 0;
    color: #666;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-column h4 {
    margin: 0 0 10px;
    font-size: 15px;
}

.footer-column a {
    text-decoration: none;
    color: #333;
}

.footer-column a:hover {
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid #ddd3c4;
    text-align: center;
    padding: 15px;
    font-size: 13px;
    color: #777;
}

@media (max-width: 767px) {

    .footer-content {
        padding: 30px 20px;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.product-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f0ebe4;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-status {
    margin: 16px 0;
    font-weight: 700;
}

.in-stock {
    color: #0a8f4d;
}

.out-stock {
    color: #b53939;
}

.detail-add-to-cart {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 999px;
    background: #1f1f1f;
    color: white;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 24px;
}

.detail-add-to-cart.disabled {
    background: #c9c9c9;
    cursor: not-allowed;
}

.product-actions .btn-stock-out {
    width: 100%;
    min-height: 40px;
    border: none;
    border-radius: 999px;
    background: #d9d9d9 !important;
    color: #666 !important;
    font-weight: 700;
    cursor: not-allowed;
}

.product-actions .btn-stock-out,
.product-actions button.btn-stock-out,
button.btn-stock-out:disabled {
    background: #d9d9d9 !important;
    color: #666 !important;
    cursor: not-allowed !important;
}


/* Botón agotado - override final */
.product-actions button.btn-stock-out,
.product-actions .btn-stock-out,
button.btn-stock-out,
button.btn-stock-out:disabled {
    background-color: #d9d9d9 !important;
    color: #666 !important;
}

/* Botón agotado - mobile */
@media (max-width: 767px) {

    .product-actions button.btn-stock-out,
    .product-actions .btn-stock-out,
    button.btn-stock-out,
    button.btn-stock-out:disabled {
        background-color: #d9d9d9 !important;
        color: #666 !important;
    }
}

button:disabled {
    background-color: red !important;
}


.site-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(247, 242, 234, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 18px;
}

.nav-main,
.nav-user,
.nav-admin {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-main {
    justify-content: space-between;
}

.nav-logo {
    color: var(--text);
    text-decoration: none;
    font-weight: 900;
    font-size: 20px;
    letter-spacing: 0.08em;
}

.nav-links,
.nav-user,
.nav-admin {
    display: flex;
    gap: 10px;
}

.site-navbar a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.nav-links a,
.nav-user a,
.nav-admin a {
    padding: 8px 12px;
    border-radius: 999px;
}

.nav-links a:hover,
.nav-user a:hover,
.nav-admin a:hover {
    background: #efe8dd;
}

.nav-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#cart-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-user {
    margin-top: 8px;
    justify-content: flex-end;
}

.nav-admin {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.nav-admin a {
    background: #fff;
    border: 1px solid var(--border);
}

.flash-message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #efe8dd;
    color: var(--text);
}

/* MOBILE */
@media (max-width: 767px) {

    .site-navbar {
        padding: 12px 14px;
    }

    .nav-main {
        display: block;
    }

    .nav-logo {
        display: block;
        margin-bottom: 10px;
    }

    .nav-links,
    .nav-user,
    .nav-admin {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .nav-links::-webkit-scrollbar,
    .nav-user::-webkit-scrollbar,
    .nav-admin::-webkit-scrollbar {
        display: none;
    }

    .nav-user {
        justify-content: flex-start;
    }
}

/* =========================
   CART
   ========================= */

.cart-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 22px 16px 40px;
}

.cart-header {
    margin-bottom: 20px;
}

.cart-header h1 {
    margin: 0;
    font-size: 34px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cart-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
}

.cart-item-info h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.cart-item-subtotal {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.cart-item-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
}

.qty-control button {
    width: 42px;
    height: 42px;
    border: none;
    background: #f0ebe4;
    font-size: 20px;
    cursor: pointer;
}

.qty-control input {
    width: 52px;
    height: 42px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    background: white;
}

.cart-remove {
    border: none;
    background: transparent;
    color: #9b3d3d;
    font-weight: 700;
    cursor: pointer;
}

.cart-summary {
    margin-top: 22px;
    background: #efe8dd;
    border-radius: 20px;
    padding: 18px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 20px;
    margin-bottom: 16px;
}

.cart-trust {
    margin-bottom: 18px;
    color: #555;
    font-size: 14px;
}

.cart-trust p {
    margin: 6px 0;
}

.checkout-button {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.continue-shopping {
    display: block;
    margin-top: 14px;
    text-align: center;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.empty-cart {
    background: white;
    border-radius: 20px;
    padding: 28px 20px;
    text-align: center;
}

.empty-cart h2 {
    margin-top: 0;
}

@media (min-width: 768px) {
    .cart-page {
        padding-top: 40px;
    }

    .cart-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .cart-item-actions {
        margin-top: 0;
        min-width: 280px;
    }
}

/* =========================
   SHIPPING
   ========================= */

.shipping-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 16px 44px;
}

.shipping-header {
    margin-bottom: 22px;
}

.shipping-header h1 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.1;
}

.shipping-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.shipping-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shipping-option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    cursor: pointer;
}

.shipping-option input {
    width: 20px;
    height: 20px;
}

.shipping-option span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shipping-option strong {
    font-size: 16px;
}

.shipping-option small {
    color: var(--muted);
    font-size: 13px;
}

.shipping-option b {
    white-space: nowrap;
}

.shipping-trust {
    margin-top: 6px;
    padding: 14px;
    border-radius: 16px;
    background: #efe8dd;
    color: #555;
    font-size: 14px;
}

.shipping-trust p {
    margin: 6px 0;
}

.shipping-submit {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
}

.shipping-back {
    display: block;
    text-align: center;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    margin-top: 4px;
}

@media (max-width: 767px) {
    .shipping-page {
        box-sizing: border-box;
        padding-left: 18px;
        padding-right: 18px;
    }

    .shipping-header h1 {
        font-size: 28px;
    }
}

/* =========================
   CUSTOMER DATA
   ========================= */

.customer-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 16px 44px;
}

.customer-header {
    margin-bottom: 22px;
}

.customer-header h1 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.1;
}

.customer-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.customer-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field label {
    font-size: 14px;
    font-weight: 700;
}

.form-field input,
.form-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 15px;
    font-size: 16px;
    background: white;
    color: var(--text);
    font-family: inherit;
}

.form-field textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 12px;
}

.customer-trust {
    margin-top: 6px;
    padding: 14px;
    border-radius: 16px;
    background: #efe8dd;
    color: #555;
    font-size: 14px;
}

.customer-trust p {
    margin: 6px 0;
}

.customer-submit {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
}

.customer-back {
    display: block;
    text-align: center;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    margin-top: 4px;
}

@media (max-width: 767px) {
    .customer-page {
        box-sizing: border-box;
        padding-left: 18px;
        padding-right: 18px;
    }

    .customer-header h1 {
        font-size: 28px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}


/* =========================
   ORDERS
   ========================= */

.orders-page,
.order-detail-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 16px 44px;
}

.orders-header h1,
.order-detail-header h1 {
    margin: 0 0 10px;
    font-size: 32px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.order-card,
.order-item,
.order-summary {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
}

.order-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.order-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.order-card-total {
    margin: 14px 0;
    display: flex;
    justify-content: space-between;
    font-size: 18px;
}

.order-detail-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    width: 100%;
    border-radius: 999px;
    background: var(--text);
    color: white;
    text-decoration: none;
    font-weight: 800;
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item h2 {
    margin: 0 0 8px;
    font-size: 17px;
}

.order-item p {
    margin: 4px 0;
}

.order-summary {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-summary div {
    display: flex;
    justify-content: space-between;
}

.order-summary-total {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    font-size: 20px;
}

.status {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    background: #efe8dd;
}

.status.paid {
    color: #0a8f4d;
}

.status.pending_payment {
    color: #9b6a00;
}

.status.cancelled,
.status.rejected {
    color: #b53939;
}

@media (min-width: 768px) {
    .order-card {
        display: grid;
        grid-template-columns: 1fr 180px 160px;
        align-items: center;
        gap: 18px;
    }

    .order-card-total {
        margin: 0;
    }
}