* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: #fafafa;
    overflow-x: hidden;
    max-width: 100vw;
}

/* === BOTONES OPTIMIZADOS MOBILE FIRST === */
.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

@media (min-width: 640px) {
    .btn-primary {
        padding: 15px 28px;
        font-size: 1rem;
        min-height: 52px;
    }
}

@media (min-width: 768px) {
    .btn-primary {
        padding: 16px 32px;
        font-size: 1.0625rem;
        min-height: 56px;
    }
}

.btn-primary:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.5);
}

@media (max-width: 767px) {
    .btn-primary:active {
        transform: scale(0.98);
    }
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

@media (min-width: 640px) {
    .btn-secondary {
        padding: 13px 24px;
        font-size: 1rem;
        min-height: 52px;
    }
}

@media (min-width: 768px) {
    .btn-secondary {
        padding: 14px 28px;
        min-height: 56px;
    }
}

.btn-secondary:hover {
    border-color: var(--color-primario);
    background: #faf5ff;
    color: var(--color-primario);
}

@media (max-width: 767px) {
    .btn-secondary:active {
        transform: scale(0.98);
        background: #f3e8ff;
    }
}

/* === LAYOUT MOBILE FIRST === */
.container-mobile {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: hidden;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .container-mobile {
        padding: 0 24px;
    }
}

@media (min-width: 1024px) {
    .container-mobile {
        max-width: 1280px;
        padding: 0 32px;
    }
}

/* === TIPOGRAFÍA OPTIMIZADA === */
.h1-mobile {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
}

.h2-mobile {
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
}

.text-mobile {
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    line-height: 1.7;
    color: var(--text-secondary);
}

/* === GALERÍA OPTIMIZADA MOBILE FIRST CON ZOOM INTERACTIVO === */
.gallery-container {
    position: relative;
    width: 100%;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .gallery-container {
        margin-bottom: 24px;
    }
}

.gallery-main {
    aspect-ratio: 1/1;
    width: 100%;
    position: relative;
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    min-height: 280px;
}

@media (min-width: 640px) {
    .gallery-main {
        min-height: 400px;
    }
}

@media (min-width: 768px) {
    .gallery-main {
        aspect-ratio: 4/3;
        min-height: 480px;
    }
}

.gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (min-width: 640px) {
    .gallery-slide {
        padding: 28px;
    }
}

@media (min-width: 768px) {
    .gallery-slide {
        padding: 32px;
    }
}

.gallery-slide.active {
    opacity: 1;
    z-index: 1;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.gallery-slide img:hover {
    transform: scale(1.02);
}

@media (max-width: 767px) {
    .gallery-slide img:active {
        transform: scale(0.98);
    }
}

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primario) #f1f1f1;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
}

@media (min-width: 640px) {
    .gallery-thumbnails {
        gap: 12px;
        padding: 16px;
    }
}

@media (min-width: 768px) {
    .gallery-thumbnails {
        padding: 20px;
    }
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}

@media (min-width: 768px) {
    .gallery-thumbnails::-webkit-scrollbar {
        height: 6px;
    }
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--color-primario);
    border-radius: 10px;
}

.gallery-thumbnail {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
    background: white;
}

@media (min-width: 640px) {
    .gallery-thumbnail {
        width: 80px;
        height: 80px;
        border-width: 3px;
    }
}

@media (min-width: 768px) {
    .gallery-thumbnail {
        width: 96px;
        height: 96px;
    }
}

.gallery-thumbnail:hover,
.gallery-thumbnail.active {
    opacity: 1;
    border-color: var(--color-primario);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 95, 191, 0.3);
}

@media (max-width: 767px) {
    .gallery-thumbnail:active {
        transform: scale(0.95);
    }
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === CONTROLES DE NAVEGACIÓN MOBILE FIRST === */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    touch-action: manipulation;
}

@media (min-width: 640px) {
    .nav-btn {
        width: 44px;
        height: 44px;
    }
}

@media (min-width: 768px) {
    .nav-btn {
        width: 48px;
        height: 48px;
    }
}

.nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 767px) {
    .nav-btn:active {
        transform: translateY(-50%) scale(0.95);
    }
}

.nav-btn.prev {
    left: 12px;
}

@media (min-width: 768px) {
    .nav-btn.prev {
        left: 16px;
    }
}

.nav-btn.next {
    right: 12px;
}

@media (min-width: 768px) {
    .nav-btn.next {
        right: 16px;
    }
}

.nav-btn i {
    font-size: 1rem;
}

@media (min-width: 768px) {
    .nav-btn i {
        font-size: 1.125rem;
    }
}

/* === PRECIO DESTACADO === */
.price-section {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 2px solid #e9d5ff;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .price-section {
        padding: 24px;
    }
}

.price-current {
    font-size: clamp(2.25rem, 7vw, 3rem);
    font-weight: 800;
    color: var(--color-primario);
    line-height: 1;
}

.price-original {
    font-size: 1.5rem;
    color: var(--text-secondary);
    text-decoration: line-through;
    font-weight: 500;
}

.savings-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* === BADGES MEJORADOS === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-discount {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.badge-new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge-stock-producto {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* === SELECTOR DE CANTIDAD MOBILE FIRST === */
.quantity-selector {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 180px;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .quantity-selector {
        max-width: 200px;
    }
}

.quantity-btn {
    width: 48px;
    height: 48px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 1.125rem;
    font-weight: 700;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
    .quantity-btn {
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }
}

.quantity-btn:hover {
    background: var(--color-primario);
    color: white;
}

@media (max-width: 639px) {
    .quantity-btn:active {
        background: var(--color-secundario);
        color: white;
    }
}

.quantity-input {
    width: 70px;
    height: 48px;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-weight: 700;
    font-size: 1.125rem;
    background: white;
    color: var(--text-primary);
    -moz-appearance: textfield;
    appearance: textfield;
}

@media (min-width: 640px) {
    .quantity-input {
        width: 80px;
        height: 52px;
        font-size: 1.25rem;
    }
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.quantity-input:focus {
    outline: none;
    background: #fafafa;
}

/* === STOCK STATUS === */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.stock-in {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.stock-low {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.stock-out {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

/* === INFO SECTION === */
.info-section {
    background: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

@media (min-width: 640px) {
    .info-section {
        padding: 24px;
    }
}

/* === DESCRIPCIÓN ARREGLADA === */
.description-text {
    color: #374151;
    font-size: 1rem;
    line-height: 1.7;
}

.description-text p {
    margin-bottom: 10px;
}

.description-text p:last-child {
    margin-bottom: 0;
}

.description-text strong {
    color: #111827;
    font-weight: 700;
}


/* === NUEVO LAYOUT DEL PRODUCTO - 3 FILAS === */
.product-layout-new {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 768px) {
    .product-layout-new {
        gap: 32px;
    }
}

/* FILA 1: Galería + Nombre (2 columnas en desktop) */
.product-row-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .product-row-1 {
        grid-template-columns: 1fr 1fr;
        gap: 48px;
    }
}

/* FILA 2: Descripción (Ancho completo) */
.product-row-2 {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* FILA 3: Precio + Compra (2 columnas solo en desktop) */
.product-row-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .product-row-3 {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}


/* === MODAL DE ZOOM ESTILO EBAY - MOBILE FIRST === */
#zoomModal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

@media (min-width: 768px) {
    #zoomModal {
        backdrop-filter: blur(8px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#zoomedImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#zoomedImage.zoomed {
    cursor: grab;
}

#zoomedImage.zoomed:active {
    cursor: grabbing;
}

/* === PRODUCTOS RELACIONADOS === */
.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .related-grid {
        gap: 24px;
    }
}

.producto-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border);
    overflow: hidden;
}

.producto-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(139, 95, 191, 0.15);
    border-color: var(--color-primario);
}

/* === RATING STARS === */
.rating-stars {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-star {
    color: #fbbf24;
    width: 20px;
    height: 20px;
}

/* === BREADCRUMB === */
.breadcrumb {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    max-width: 100%;
}

.breadcrumb span,
.breadcrumb a {
    word-break: break-word;
    overflow-wrap: break-word;
}



/* === STICKY BOTTOM CTA BAR (solo móvil) === */
#sticky-cta-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: white;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sticky-cta-bar.visible {
    transform: translateY(0);
}

@media (min-width: 768px) {
    #sticky-cta-bar {
        display: none !important;
    }
}

.sticky-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-primario);
    white-space: nowrap;
}

.sticky-btn {
    flex: 1;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-weight: 700;
    font-size: 0.9375rem;
    cursor: pointer;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    white-space: nowrap;
    overflow: hidden;
}

/* === GALLERY DOT INDICATORS === */
.gallery-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 0 4px;
}

@media (min-width: 768px) {
    .gallery-dots {
        display: none;
    }
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.gallery-dot.active {
    background: var(--color-primario);
    width: 20px;
    border-radius: 4px;
}

/* === RESPONSIVE UTILITIES === */
@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }
}

/* === PREVENCIÓN GLOBAL DE OVERFLOW === */
* {
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Prevenir overflow en elementos de grid */
.product-row-1>*,
.product-row-2>*,
.product-row-3>* {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}