/* =========================================
    VARIABLES AND BASE CONFIGURATION
    ========================================= */
:root {
    --color-bg: #f4f4f9;
    --color-text: #2b2b2b;
    --color-accent: #d90429;
    --color-white: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-image: var(--site-content-background, url('/assets/img/background-content.jpg'));
    background-repeat: no-repeat;
    background-position: center top;
    background-attachment: scroll;
    background-size: cover;
    background-color: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;

    /* REGLAS PARA EL STICKY FOOTER */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Fixed: Corregido de 50vh a 100vh */
}

.page-wrapper {
    position: relative;
    z-index: 1;
}

.vanta-layer {
    display: none;
    pointer-events: none;
}

.vanta-layer.is-active {
    display: block;
}

.vanta-content-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.42;
}

main {
    flex: 1;
}

/* =========================================
    HEADER AND NAVIGATION
    ========================================= */
.main-header {
    position: relative;
    background-image: var(--site-header-background, url('/assets/img/background.jpg'));
    background-repeat: no-repeat;
    background-position: center 35%;
    background-attachment: scroll;
    background-size: cover;
    background-color: var(--color-white);
    min-height: clamp(220px, 34vh, 360px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: clamp(28px, 4vw, 44px) 20px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    overflow: hidden;
}

.vanta-banner-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.48;
}

.vanta-banner-layer .vanta-canvas,
.vanta-content-layer .vanta-canvas {
    pointer-events: none;
}

.main-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.34) 100%);
    pointer-events: none;
}

.main-header h1,
.main-header .filters {
    position: relative;
    z-index: 1;
}

.main-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 10px 18px;
    backdrop-filter: blur(3px);
}

.filters {
    margin-top: 20px;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    padding: 10px;
    backdrop-filter: blur(4px);
}

.btn-filter {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.18);
    color: #111827;
    padding: 8px 20px;
    margin: 0;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-filter.active,
.btn-filter:hover {
    background-color: #111827;
    color: var(--color-white);
}

/* =========================================
    VIEW: MAIN CATALOG
    ========================================= */
#catalog-view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.product-card img {
    width: 100%;
    height: 250px;
    min-height: 250px;
    object-fit: cover;
    display: block;
}

.card-info {
    padding: 20px;
    text-align: center;
}

.card-info h3 {
    margin: 0;
    font-size: 1.2rem;
}

/* =========================================
    VIEW: PRODUCT DETAIL
    ========================================= */
#detail-view {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 60px;
}

.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.btn-back {
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.btn-share {
    background-color: #1fee49;
    color: var(--color-text);
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-share:hover {
    background-color: #04ea32;
}

.btn-back:hover {
    color: var(--color-accent);
}

.detail-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 40px;
    align-items: start;
}

.detail-image img#detail-img {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    margin: 0 auto 15px auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.thumbnail-item {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.15);
}

.detail-specs h2 {
    margin-top: 0;
    font-size: 2rem;
    color: var(--color-text);
}

.long-description {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.technical-list {
    background: var(--color-bg);
    padding: 20px;
    border-radius: 8px;
    list-style: none;
    margin-bottom: 30px;
}

.technical-list li {
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.technical-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* =========================================
    TOAST NOTIFICATION
    ========================================= */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #28a745;
    /* Verde de éxito */
    color: var(--color-white);
    padding: 22px 44px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    font-size: 1.2rem;
    font-weight: 500;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.toast p {
    margin: 0;
}

/* =========================================
    IMAGE MODAL
    ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 1024px;
    max-height: 90vh;
    display: flex;
    /* Ayuda a centrar la imagen si es más pequeña */
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 8px;
    margin: auto;
    /* Centra la imagen dentro del contenedor */
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2.8rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 1102;
    /* Asegura que esté sobre la imagen y las flechas */
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.2s;
    z-index: 1101;
}

.modal-nav:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-nav.prev {
    left: 15px;
}

.modal-nav.next {
    right: 15px;
}

/* =========================================
    UTILITIES
    ========================================= */
.hidden {
    display: none !important;
}

/* =========================================
    RESPONSIVENESS
    ========================================= */
@media (max-width: 768px) {
    body {
        background-position: center top;
        background-size: auto 100vh;
    }

    .main-header {
        min-height: 210px;
        background-position: center 24%;
        margin-bottom: 26px;
        padding: 26px 14px;
    }

    .main-header h1 {
        font-size: clamp(1.6rem, 6vw, 2rem);
        padding: 8px 12px;
    }

    .filters {
        margin-top: 12px;
        padding: 8px;
    }

    .btn-filter {
        padding: 8px 14px;
    }

    .detail-content {
        grid-template-columns: 1fr;
    }
}

/* =========================================
    SITE FOOTER
    ========================================= */
.site-footer {
    position: fixed;
    bottom: 0%;
    width: 100%;
    background-color: var(--color-text);
    color: var(--color-white);
    text-align: center;
    padding: 10px 20px;
    margin-top: 40px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
}

.site-footer p {
    margin: 0;
    letter-spacing: 0.5px;
}

/* =========================================
    INQUIRY FORM
    ========================================= */
.form-container {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px dashed #eee;
}

.form-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: var(--color-text);
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--color-text);
}

.field-group input[type="text"],
.field-group input[type="email"],
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: var(--color-white);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(43, 43, 43, 0.1);
}

.field-group input.is-invalid,
.field-group textarea.is-invalid {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.1);
}

.error-message {
    color: var(--color-accent);
    font-size: 0.85rem;
    margin-top: 5px;
}

.field-group textarea {
    resize: vertical;
}

.btn-submit-form {
    background-color: var(--color-text);
    color: var(--color-white);
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    text-align: center;
}

.btn-submit-form:hover {
    background-color: var(--color-accent);
}



/* =========================================
    VIEW TRANSITIONS
    ========================================= */
.view-transition-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

.view-transition-fade-in {
    animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}