/*
 * Estilos: Página de producto individual WooCommerce
 * Archivo: woo-single.css
 * Encolar desde functions.php con wp_enqueue_style()
 */

:root {
    --wsp-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --wsp-color-text:  #111111;
    --wsp-color-muted: #6b6b6b;
    --wsp-color-bg:    #ffffff;
    --wsp-color-surf:  #f5f5f3;
    --wsp-color-border:#e5e5e5;
    --wsp-color-green: #1a7a4a;
    --wsp-color-green-bg: #edf7f1;
    --wsp-color-red:   #c0392b;
    --wsp-radius-sm:   4px;
    --wsp-radius-md:   8px;
    --wsp-radius-lg:   12px;
    --wsp-transition:  0.2s ease;
    --wsp-max-width:   1360px;
}

/* ── Wrapper ──────────────────────────────────────────── */
.wsp-wrapper {
    max-width: var(--wsp-max-width);
    margin: 0 auto;
    padding: 0 24px 64px;
    font-family: var(--wsp-font);
    color: var(--wsp-color-text);
}

/* ── Breadcrumb ───────────────────────────────────────── */
.wsp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 0 24px;
    font-size: 13px;
    color: var(--wsp-color-muted);
    flex-wrap: wrap;
}
.wsp-breadcrumb a {
    color: var(--wsp-color-muted);
    text-decoration: none;
    transition: color var(--wsp-transition);
}
.wsp-breadcrumb a:hover { color: var(--wsp-color-text); }
.wsp-breadcrumb span[aria-current] { color: var(--wsp-color-text); }
.wsp-breadcrumb-sep { opacity: 0.4; }

/* ── Layout: 2 columnas ───────────────────────────────── */
.wsp-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: flex-start;
    margin-bottom: 56px;
}

/* ══ GALERÍA ══════════════════════════════════════════════ */
.wsp-gallery {
    position: sticky;
    top: 24px;
}

/* Imagen principal */
.wsp-main-image {
    background: var(--wsp-color-surf);
    border-radius: var(--wsp-radius-lg);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.wsp-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.25s ease;
}
.wsp-main-img.is-loading { opacity: 0; }

/* Miniaturas */
.wsp-thumbnails {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.wsp-thumb {
    width: 72px;
    height: 72px;
    background: var(--wsp-color-surf);
    border: 2px solid transparent;
    border-radius: var(--wsp-radius-md);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--wsp-transition);
    flex-shrink: 0;
}
.wsp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wsp-thumb:hover { border-color: #aaa; }
.wsp-thumb.is-active { border-color: var(--wsp-color-text); }

/* ══ INFO ══════════════════════════════════════════════════ */
.wsp-info {
    padding-top: 4px;
}

/* Meta: proveedor / tipo / sku */
.wsp-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--wsp-color-muted);
    margin-bottom: 12px;
}
.wsp-meta-label { font-weight: 500; color: var(--wsp-color-muted); }
.wsp-meta-value { color: var(--wsp-color-text); }
.wsp-meta-link {
    color: var(--wsp-color-text);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity var(--wsp-transition);
}
.wsp-meta-link:hover { opacity: 0.65; }
.wsp-meta-sep { opacity: 0.35; }

/* Título */
.wsp-title {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--wsp-color-text);
    margin: 0 0 20px;
    letter-spacing: -0.02em;
}

/* Precio */
.wsp-price-block { margin-bottom: 16px; }
.wsp-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--wsp-color-text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}
.wsp-wrapper .wsp-price .price { font-size: inherit !important; font-weight: inherit !important; color: inherit !important; }
.wsp-wrapper .wsp-price del { font-size: 18px !important; font-weight: 400 !important; color: var(--wsp-color-muted) !important; margin-right: 8px !important; }
.wsp-wrapper .wsp-price ins { text-decoration: none !important; }
.wsp-tax-note {
    font-size: 13px;
    color: var(--wsp-color-muted);
    margin: 0;
}
.wsp-shipping-link {
    color: var(--wsp-color-text);
    text-underline-offset: 2px;
}

/* Características checkmarks */
.wsp-features {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.wsp-feature {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wsp-color-text);
}
.wsp-feature svg {
    color: var(--wsp-color-text);
    flex-shrink: 0;
}

/* Divisor */
.wsp-divider {
    border: none;
    border-top: 1px solid var(--wsp-color-border);
    margin: 20px 0;
}

/* Stock */
.wsp-stock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 6px 14px;
    border-radius: 999px;
}
.wsp-stock.is-instock {
    background: var(--wsp-color-green-bg);
    color: var(--wsp-color-green);
}
.wsp-stock.is-outofstock {
    background: #fef2f2;
    color: var(--wsp-color-red);
}
.wsp-stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wsp-stock.is-instock .wsp-stock-dot { background: var(--wsp-color-green); }
.wsp-stock.is-outofstock .wsp-stock-dot { background: var(--wsp-color-red); }

/* Descripción corta */
.wsp-short-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--wsp-color-text);
    margin-bottom: 24px;
}
.wsp-short-desc p { margin: 0 0 12px; }
.wsp-short-desc p:last-child { margin-bottom: 0; }
.wsp-short-desc strong { font-weight: 600; }

/* Añadir al carrito */
.wsp-add-to-cart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

/* Quantity input — WooCommerce nativo + override */
.wsp-wrapper .quantity {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--wsp-color-border);
    border-radius: var(--wsp-radius-md);
    overflow: hidden;
    flex-shrink: 0;
}
.wsp-wrapper .quantity .qty {
    width: 52px !important;
    height: 48px !important;
    border: none !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    background: transparent !important;
    color: var(--wsp-color-text) !important;
    -moz-appearance: textfield;
    appearance: textfield;
    outline: none !important;
    box-shadow: none !important;
}
.wsp-wrapper .quantity .qty::-webkit-outer-spin-button,
.wsp-wrapper .quantity .qty::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Botones +/- del quantity (si el tema los genera) */
.wsp-wrapper .quantity .qty-plus,
.wsp-wrapper .quantity .qty-minus,
.wsp-wrapper .quantity button {
    width: 40px;
    height: 48px;
    background: var(--wsp-color-surf);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--wsp-color-text);
    transition: background var(--wsp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wsp-wrapper .quantity .qty-plus:hover,
.wsp-wrapper .quantity .qty-minus:hover,
.wsp-wrapper .quantity button:hover {
    background: #e8e8e8;
}

/* Cart form */
.wsp-cart-form { flex: 1; }
.wsp-btn-cart {
    width: 100%;
    height: 50px;
    background: var(--wsp-color-text);
    color: #ffffff;
    border: none;
    border-radius: var(--wsp-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: opacity var(--wsp-transition), transform var(--wsp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.wsp-btn-cart:hover { opacity: 0.85; }
.wsp-btn-cart:active { transform: scale(0.985); }
.wsp-btn-cart:disabled { opacity: 0.5; cursor: not-allowed; }

/* Agotado */
.wsp-outofstock-notice {
    font-size: 14px;
    color: var(--wsp-color-muted);
    background: var(--wsp-color-surf);
    border-radius: var(--wsp-radius-md);
    padding: 14px 18px;
    margin-bottom: 24px;
}

/* Atributos */
.wsp-attributes {
    margin-top: 8px;
    border-top: 1px solid var(--wsp-color-border);
    padding-top: 16px;
}
.wsp-attr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.wsp-attr-table th,
.wsp-attr-table td {
    padding: 7px 0;
    border-bottom: 1px solid var(--wsp-color-border);
    vertical-align: top;
}
.wsp-attr-table th {
    width: 40%;
    font-weight: 500;
    color: var(--wsp-color-muted);
    text-align: left;
    padding-right: 12px;
}
.wsp-attr-table td { color: var(--wsp-color-text); }

/* ── Descripción completa ─────────────────────────────── */
.wsp-full-desc {
    border-top: 1px solid var(--wsp-color-border);
    padding-top: 40px;
    margin-bottom: 56px;
}
.wsp-full-desc-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--wsp-color-text);
    letter-spacing: -0.01em;
}
.wsp-full-desc-body {
    font-size: 15px;
    line-height: 1.75;
    color: var(--wsp-color-text);
    max-width: 72ch;
}
.wsp-full-desc-body p { margin: 0 0 16px; }
.wsp-full-desc-body strong { font-weight: 600; }

/* ── Productos relacionados ───────────────────────────── */
.wsp-related { border-top: 1px solid var(--wsp-color-border); padding-top: 40px; }
.wsp-related-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--wsp-color-text);
    letter-spacing: -0.01em;
}
.wsp-related-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.wsp-related-card {
    background: var(--wsp-color-bg);
    border-radius: var(--wsp-radius-md);
    overflow: hidden;
    transition: transform var(--wsp-transition), box-shadow var(--wsp-transition);
}
.wsp-related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
}
.wsp-related-img-wrap {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--wsp-color-surf);
    border-radius: var(--wsp-radius-md) var(--wsp-radius-md) 0 0;
    overflow: hidden;
}
.wsp-related-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.wsp-related-card:hover .wsp-related-img-wrap img { transform: scale(1.04); }
.wsp-related-info { padding: 10px 12px 12px; }
.wsp-related-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wsp-related-name a { color: var(--wsp-color-text); text-decoration: none; }
.wsp-related-name a:hover { text-decoration: underline; }
.wsp-related-price { font-size: 14px; font-weight: 600; color: var(--wsp-color-text); }

/* Badges heredados del archivo de categoría */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.badge-agotado {
    background: rgba(255,255,255,0.85);
    color: #555;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,.08);
}

/* ── Miniaturas FlexSlider en fila ───────────────────── */
.flex-control-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    list-style: none;
}

.flex-control-nav li {
    width: auto !important;
    margin: 0 !important;
}

.flex-control-nav li img {
    width: 70px !important;
    height: 70px !important;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

/* Miniatura activa */
.flex-control-nav li img.flex-active {
    border-color: #000;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
    .wsp-layout { gap: 36px; }
    .wsp-related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .wsp-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .wsp-gallery { position: static; }
    .wsp-title { font-size: 22px; }
    .wsp-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wsp-wrapper { padding: 0 16px 48px; }
}
@media (max-width: 480px) {
    .wsp-add-to-cart-row { flex-direction: column; align-items: stretch; }
    .wsp-wrapper .quantity { justify-content: center; }
    .wsp-btn-cart { height: 52px; }
}
