/* ===== MODERN DESIGN SYSTEM (REDISEÑO) ===== */
:root {
    /* Paleta de colores (Mantenida) */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Fondos (Mantenidos) */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* Colores de Texto (Mantenidos) */
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Bordes (Ajustados para el nuevo diseño) */
    --border-primary: rgba(255, 255, 255, 0.1);
    --border-secondary: rgba(255, 255, 255, 0.2);
    --border-accent: var(--primary);
    
    /* Sombras (Ajustadas) */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    /* Espaciado (Mantenido) */
    --space-xs: 0.25rem; --space-sm: 0.5rem; --space-md: 1rem;
    --space-lg: 1.5rem; --space-xl: 2rem; --space-2xl: 3rem;

    /* Radios de borde (Reducidos para un look más afilado) */
    --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 0.75rem;

    /* Tipografía (Ajustada) */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; }
.delay-1 { animation-delay: 0.1s; } .delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; } .delay-4 { animation-delay: 0.4s; }

/* ===== LAYOUT & GRID (REDISEÑADO) ===== */
.product-detail-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

@media (min-width: 1024px) {
    .product-layout {
        grid-template-columns: 1.2fr 1fr;
        gap: var(--space-2xl);
    }
}

/* ===== BREADCRUMB (REDISEÑADO) ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    font-size: 0.875rem;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.breadcrumb a:hover { color: var(--primary-light); }
.breadcrumb span { color: var(--text-muted); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* ===== IMAGE GALLERY (REDISEÑADO) ===== */
.image-gallery {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: var(--space-md);
    position: sticky;
    top: var(--space-lg);
}
.thumbnails-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.thumbnail-item {
    aspect-ratio: 1;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}
.thumbnail-item:hover { border-color: var(--primary); transform: scale(1.05); }
.thumbnail-item.active { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.main-image-wrapper {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-primary);
}
.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: zoom-in;
}
.price-highlight-effect {
    animation: priceHighlight 0.6s ease;
}
@keyframes priceHighlight {
    50% { filter: brightness(1.2); }
}

/* ===== PRODUCT INFO (REDISEÑADO) ===== */
.product-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}
.product-header .category-link {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.product-header .product-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin: var(--space-xs) 0 var(--space-md) 0;
}
.product-header .sku-info {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* RATING (REDISEÑADO) */
.rating-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.stars { display: flex; gap: 2px; font-size: 1.1rem; color: var(--warning); }
.stars .star-empty { color: var(--text-muted); }
.rating-text { color: var(--text-secondary); font-size: 0.875rem; }
.rating-text a { color: inherit; text-decoration: none; }
.rating-text a:hover { text-decoration: underline; }

/* PRICE (REDISEÑADO) */
.price-section {
    background-color: var(--bg-secondary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
}
.price-display { display: flex; align-items: baseline; gap: var(--space-md); }
.price-current {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}
.price-original {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* VARIANTS (REDISEÑADO) */
.variants-section .variants-title {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}
.variant-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.variant-btn {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    background-color: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}
.variant-btn:hover { border-color: var(--primary); background-color: var(--bg-glass); }
.variant-btn.active { border-color: var(--primary); background-color: var(--primary); }
.variant-btn.disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }

/* ACTIONS (REDISEÑADO) */
.actions-panel {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-md);
    margin-top: var(--space-md);
}
.quantity-selector {
    display: flex;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
}
.quantity-selector input {
    width: 100%;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem;
}
.quantity-selector input:focus { outline: none; }
/* Ocultar flechas en input number */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] { -moz-appearance: textfield; }

.add-to-cart-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}
.add-to-cart-btn:hover:not(:disabled) { background-color: var(--primary-dark); transform: translateY(-2px); }
.add-to-cart-btn:disabled { background-color: var(--text-muted); cursor: not-allowed; }

/* STOCK INFO (REDISEÑADO) */
.stock-info {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}
.stock-info.available { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.stock-info.low { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stock-info.out { background-color: rgba(239, 68, 68, 0.1); color: var(--error); }

/* ==== TABS & SECTIONS (NUEVO DISEÑO DE PESTAÑAS) ==== */
.product-details-tabs {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    margin-top: var(--space-2xl);
    overflow: hidden;
}
.tabs-header {
    display: flex;
    background-color: var(--bg-tertiary);
    padding: 0 var(--space-md);
}
.tab-button {
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    transition: color 0.2s ease;
}
.tab-button:hover {
    color: var(--text-primary);
}
.tab-button.active {
    color: var(--text-primary);
}
.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-lg);
    right: var(--space-lg);
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}
.tab-content-panel {
    padding: var(--space-xl);
}
.tab-content {
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 80ch;
}
.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md) var(--space-xl);
}
.spec-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-primary);
}
.spec-label { color: var(--text-secondary); }
.spec-value { color: var(--text-primary); font-weight: 500; }

/* REVIEWS (REDISEÑADO) */
.reviews-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}
.review-card {
    border: 1px solid var(--border-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    background-color: var(--bg-tertiary);
}
.review-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-sm); }
.review-title { font-size: 1.1rem; font-weight: 600; }
.review-author { font-size: 0.875rem; color: var(--text-secondary); }
.review-date { font-size: 0.8rem; color: var(--text-muted); }
.review-content { margin: var(--space-sm) 0; color: var(--text-secondary); }
.toggle-reviews-btn {
    margin-top: var(--space-lg);
    width: 100%;
    padding: 0.8rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.toggle-reviews-btn:hover { background-color: var(--bg-tertiary); }

/* RELATED PRODUCTS (CORREGIDO) */
.related-products-section {
    margin-top: var(--space-2xl);
}
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
}
.related-card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.related-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--border-accent); }
.related-image-container {
    aspect-ratio: 1 / 1;
    background-color: var(--bg-primary);
    padding: var(--space-sm);
}
.related-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.related-info {
    padding: var(--space-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.related-name {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    flex-grow: 1; /* CORRECCIÓN: Hace que el nombre ocupe el espacio disponible */
}
.related-price {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: var(--space-sm); /* Se quita margin-top: auto para que el flex-grow del nombre funcione */
}

/* NOTIFICATIONS & LIGHTBOX (Mantenidos con ajustes menores) */
.notification { position: fixed; bottom: var(--space-lg); right: var(--space-lg); background: var(--bg-tertiary); border-left: 4px solid var(--primary); border-radius: var(--radius-md); padding: var(--space-md) var(--space-lg); color: var(--text-primary); z-index: 10000; box-shadow: var(--shadow-lg); transform: translateX(calc(100% + 2rem)); opacity: 0; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.notification.show { transform: translateX(0); opacity: 1; }
.notification-success { border-color: var(--success); }
.notification-error { border-color: var(--error); }
.notification-warning { border-color: var(--warning); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(8px); }
.lightbox img { max-width: 90%; max-height: 90%; }
.lightbox-close { position: absolute; top: var(--space-lg); right: var(--space-lg); width: 44px; height: 44px; background: rgba(0,0,0,0.5); border: none; border-radius: 50%; color: white; font-size: 1.5rem; cursor: pointer; }

/* UTILITIES */
/*
    Important: Do NOT override Tailwind's `.hidden` utility here.
    A previous rule `.hidden { display: none !important; }` caused conflicts
    with responsive classes like `sm:inline-flex`, hiding the brand title in the header.
    Rely on Tailwind's own `.hidden` implementation instead.
*/
[x-cloak] { display: none !important; }

/* Responsive adjustments */
@media (max-width: 1023px) {
    .image-gallery { grid-template-columns: 1fr; }
    .thumbnails-list { flex-direction: row; flex-wrap: wrap; justify-content: center; order: 2; margin-top: var(--space-md); }
    .thumbnail-item { width: 65px; height: 65px; }
    .main-image-wrapper { order: 1; }
}
@media (max-width: 767px) {
    .product-header .product-title { font-size: 2rem; }
    .price-current { font-size: 2.2rem; }
    .actions-panel { grid-template-columns: 1fr; }
    .quantity-selector { grid-column: 1 / -1; }
    .add-to-cart-btn { width: 100%; }
    .tabs-header { flex-wrap: wrap; }
    .specs-grid { grid-template-columns: 1fr; }
}
