/* ============================================================
   PÁGINA DE PRODUCTO — AVICOM
   ============================================================ */

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb-catalogo ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: #9ca3af;
    gap: 0.25rem;
}
.breadcrumb-catalogo li { display: inline; }
.breadcrumb-catalogo li:not(:last-child)::after {
    content: "/";
    margin: 0 0.4rem;
    color: #d1d5db;
}
.breadcrumb-catalogo a { color: var(--color-primario); text-decoration: none; }
.breadcrumb-catalogo a:hover { text-decoration: underline; }
.breadcrumb-catalogo .active { color: #6b7280; }


/* ── Layout principal ──────────────────────────────────────── */
.prod-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
    align-items: start;
}


/* ── Columna imagen ────────────────────────────────────────── */
.prod-col-img {
    position: sticky;
    top: 90px;
    min-width: 0; /* Evita que el grid item desborde el viewport */
    overflow: hidden;
}

.prod-img-principal {
    position: relative;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    width: 100%;
    margin-bottom: 0.75rem;
    touch-action: pan-y;
    user-select: none;
}

.prod-img-principal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.prod-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Galería */
.producto-galeria-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primario) #e5e7eb;
}
.producto-galeria-wrapper::-webkit-scrollbar { height: 4px; }
.producto-galeria-wrapper::-webkit-scrollbar-track { background: #e5e7eb; border-radius: 4px; }
.producto-galeria-wrapper::-webkit-scrollbar-thumb { background: var(--color-primario); border-radius: 4px; }

.producto-galeria {
    display: flex;
    gap: 0.5rem;
    width: max-content;
    min-width: 100%;
    padding-bottom: 4px;
}

.galeria-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #f8f9fa;
}
.galeria-thumb:hover { border-color: #9ca3af; }
.galeria-thumb.active {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 2px rgba(215, 20, 20, 0.15);
}
.galeria-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
}

/* Video en galería */
.video-thumb { position: relative; }
.video-thumb-overlay { position: relative; width: 100%; height: 100%; }
.video-thumb-overlay img { width: 100%; height: 100%; object-fit: cover; }
.play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
}
.play-icon svg {
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    padding: 6px;
}

/* Contenedor de video embed — ocupa toda la caja 1:1 */
.video-container {
    position: absolute;
    inset: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.prod-img-principal.video-activo {
    background: #000;
    padding: 0;
}

/* ── Flechas navegación galería ── */
.galeria-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.82);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    padding: 0;
}
.prod-img-principal:hover .galeria-nav { opacity: 1; }
.galeria-nav:hover { background: rgba(255,255,255,0.97); color: var(--color-primario, #d71414); }
.galeria-nav-prev { left: 8px; }
.galeria-nav-next { right: 8px; }
/* En móvil siempre visibles */
@media (max-width: 768px) {
    .galeria-nav { opacity: 0.75; width: 32px; height: 32px; font-size: 1.3rem; }
}


/* ── Columna info ──────────────────────────────────────────── */
.prod-col-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Marca + SKU */
.prod-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.prod-sku-badge {
    display: inline-block;
    background: var(--color-primario);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.25rem 1.1rem;
    border-radius: 6px;
}

.prod-marca-logo {
    height: 53px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.prod-marca-txt {
    font-weight: 600;
    font-size: 1rem;
    color: #4b5563;
}

/* Nombre */
.prod-nombre {
    font-size: 1.55rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.25;
    margin-bottom: 1rem;
}

/* Stock badge */
.prod-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.prod-stock-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.stock-disp { background: #dcfce7; color: #15803d; }
.stock-bajo { background: #fef9c3; color: #b45309; }
.stock-agot { background: #f3f4f6; color: #9ca3af; }

/* Bloque unificado grid 2x2 con areas nombradas */
.prod-accion-bloque {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "stock  qty"
        "precio boton";
    gap: 0.55rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    align-items: center;
}
.pab-stock  {
    grid-area: stock;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
}
.pab-qty    { grid-area: qty; }
.pab-precio {
    grid-area: precio;
    display: flex;
    justify-content: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
}
.pab-boton  { grid-area: boton; }

/* Qty y botón ocupan todo el ancho de su celda */
.pab-qty .prod-qty-controls { width: 100%; }
.pab-boton .btn-agregar-prod { width: 100%; }
.pab-boton .prod-en-carrito  { width: 100%; box-sizing: border-box; }

/* Mobile vertical: col izquierda arriba, col derecha abajo */
@media (max-width: 540px) {
    .prod-accion-bloque {
        grid-template-columns: 1fr;
        grid-template-areas:
            "stock"
            "precio"
            "qty"
            "boton";
    }
}
.prod-precio-derecha {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.prod-precio-moneda {
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
    align-self: center;
}

.prod-precio-valor {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--color-primario);
    letter-spacing: -0.03em;
    line-height: 1;
}

.prod-impuestos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.prod-imp-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    background: #e5e7eb;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.prod-precio-consultar {
    color: #6b7280;
    font-size: 0.95rem;
    font-style: italic;
}

/* Sección carrito */
#carrito-prod-section { width: 100%; }

.prod-qty-controls {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}
/* input ya tiene flex:1 definido abajo — no necesita override */

.prod-qty-btn {
    flex: 1;
    height: 44px;
    min-width: 0;
    background: #e2e8f0;
    border: none;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    color: #1e293b;
    transition: background 0.15s;
    line-height: 1;
}
.prod-qty-btn:hover { background: #cbd5e1; }

.prod-qty-input {
    flex: 1;
    min-width: 0;
    text-align: center;
    border: none;
    border-left: 1.5px solid #d1d5db;
    border-right: 1.5px solid #d1d5db;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    padding: 0;
    -moz-appearance: textfield;
}
.prod-qty-input::-webkit-outer-spin-button,
.prod-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prod-qty-input:focus { outline: none; background: #fff; }

.btn-agregar-prod {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 44px;
    background: var(--color-primario);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.btn-agregar-prod:hover { opacity: 0.88; }
.btn-agregar-prod:active { transform: scale(0.98); }
.btn-agregar-prod:disabled { opacity: 0.55; cursor: not-allowed; }

/* Estado: ya en carrito */
.prod-en-carrito {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.prod-en-carrito-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #15803d;
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-ver-carrito {
    background: none;
    border: 1.5px solid #15803d;
    color: #15803d;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.btn-ver-carrito:hover { background: #15803d; color: #fff; }

/* Spinner */
.prod-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: prod-spin 0.65s linear infinite;
    vertical-align: middle;
}
@keyframes prod-spin { to { transform: rotate(360deg); } }

/* Acciones secundarias */
.prod-acciones-sec {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.65rem;
    margin-bottom: 0.25rem;
}

.btn-accion-sec {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: border-color 0.15s, color 0.15s;
    text-align: center;
}
.btn-accion-sec:hover {
    border-color: var(--color-primario);
    color: var(--color-primario);
}
.btn-accion-sec.btn-accion-pdf:hover {
    border-color: #b91c1c;
    color: #b91c1c;
}

/* Separador */
.prod-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 1.25rem 0;
}

/* Tabs */
.prod-tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
}

.prod-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.prod-tab-btn:hover { color: #4b5563; }
.prod-tab-btn.active {
    color: var(--color-primario);
    border-bottom-color: var(--color-primario);
}

.prod-tab-pane { display: none; }
.prod-tab-pane.active { display: block; }

.prod-tab-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #4b5563;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Detalles con bullets sutiles */
.prod-detalles-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.prod-detalles-list li {
    display: flex;
    gap: 0.55rem;
    align-items: baseline;
    line-height: 1.55;
}
.prod-detalles-list li::before {
    content: "•";
    color: var(--color-primario);
    opacity: 0.4;
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Specs con clave:valor */
.prod-specs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.prod-specs-list li {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
}
.prod-specs-list li:last-child { border-bottom: none; }
.spec-key {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    width: 33.333%;
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    border-right: 1px solid #e2e8f0;
    font-size: 0.765rem; /* 0.85rem × 0.9 */
}
.spec-val {
    color: #111827;
    padding: 0.5rem 0.75rem;
    flex: 1;
}


/* ── Productos relacionados ────────────────────────────────── */
.prod-relacionados { margin-top: 3rem; }

.prod-relacionados-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.prod-relacionados-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #374151;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}
.prod-relacionados-titulo::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.related-carousel-nav {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.related-nav-btn {
    width: 32px;
    height: 32px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.related-nav-btn:hover:not(:disabled) {
    border-color: var(--color-primario);
    color: var(--color-primario);
}
.related-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Carrusel */
.related-carousel {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.related-carousel::-webkit-scrollbar { display: none; }

.related-carousel .producto-card {
    flex: 0 0 calc(25% - 0.9375rem);
    max-width: 300px;
    scroll-snap-align: start;
    min-width: 0;
}


/* ── Responsive ────────────────────────────────────────────── */

/* Evitar overflow horizontal global en páginas de producto */
body:has(.prod-layout) {
    overflow-x: hidden;
}
.prod-layout {
    /* min-width:0 en cada celda para que el grid no desborde */
    min-width: 0;
}
.prod-col-info {
    min-width: 0;
}

@media (max-width: 1024px) {
    .prod-layout { gap: 2rem; }
}

@media (max-width: 768px) {
    .prod-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .prod-col-img {
        position: static;
        overflow: visible;
        width: 100%;
    }
    .prod-img-principal {
        width: 100%;
        aspect-ratio: 1 / 1;
    }
    .producto-galeria-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
    }
    .prod-nombre { font-size: 1.25rem; }
    .prod-precio-valor { font-size: 2rem; }
    .related-carousel .producto-card { flex: 0 0 calc(50% - 0.625rem); }
    .prod-tab-content { max-height: 240px; }
}

@media (max-width: 480px) {
    .prod-img-principal { max-height: none; }
    .prod-precio-valor { font-size: 1.75rem; }
    .galeria-thumb { width: 56px; height: 56px; }
    .prod-qty-btn { font-size: 1.1rem; }
}

@media (max-width: 540px) {
    .prod-img-principal {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
}
