/* ==========================================================================
   CSS PRINCIPAL - M & A Repuestos Automotriz S.A.C
   Diseño Premium Dark-Mode First para Mecánicos y Talleres
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Sistema de Colores HSL */
    --hue-primary: 175; /* Teal / Esmeralda */
    --color-primary: hsl(var(--hue-primary), 85%, 35%);
    --color-primary-hover: hsl(var(--hue-primary), 85%, 28%);
    --color-primary-light: hsl(var(--hue-primary), 85%, 95%);
    --color-primary-glow: hsla(var(--hue-primary), 85%, 35%, 0.15);
    
    --color-bg-base: #090d16;
    --color-bg-surface: #111827;
    --color-bg-card: #1f2937;
    --color-bg-input: #151c2c;
    
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    --color-text-dark: #111827;
    
    --color-border: #374151;
    --color-border-hover: #4b5563;
    
    --color-success: #10b981; /* Punto verde de stock */
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    
    /* Tipografía */
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Sombras y Bordes */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
    
    /* Layout */
    --header-height: 80px;
    --container-width: 1200px;
}

/* Reset de Estilos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg-base);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

input, button, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Contenedores */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--color-primary-glow);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.3);
}

.btn-secondary {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    border-color: var(--color-border-hover);
    background-color: var(--color-border);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--color-success);
    color: #fff;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

.btn-whatsapp {
    background-color: #25d366;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
    background-color: #20ba5a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

/* Cabecera / Header */
.header {
    background-color: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 48px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    position: relative;
    padding: 8px 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--color-text);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.cart-icon-wrapper {
    position: relative;
    cursor: pointer;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.cart-icon-wrapper:hover {
    border-color: var(--color-primary);
    background-color: rgba(13, 148, 136, 0.05);
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Banner de Información Superior */
.top-info-bar {
    background-color: var(--color-bg-base);
    border-bottom: 1px solid var(--color-border);
    padding: 6px 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.top-info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-info-left {
    display: flex;
    gap: 15px;
}
.top-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Secciones de Contenido */
.main-content {
    flex: 1;
}

.hero-section {
    background: radial-gradient(circle at top right, rgba(13, 148, 136, 0.15) 0%, rgba(9, 13, 22, 1) 70%);
    padding: 60px 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

/* Buscador Flotante / Barra de Búsqueda */
.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid var(--color-border);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(13, 148, 136, 0.25);
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 15px;
}

.search-input {
    width: 100%;
    padding: 12px 10px;
    font-size: 1.05rem;
}

.search-icon-svg {
    width: 20px;
    height: 20px;
    fill: var(--color-text-muted);
}

/* Modo Mock Warning */
.mock-warning-banner {
    background: linear-gradient(90deg, #b45309 0%, #78350f 100%);
    color: #fff;
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* Grilla del Catálogo */
.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
    padding: 40px 0;
}

/* Sidebar de Filtros */
.filter-sidebar {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-group-label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 12px;
}

.brand-list {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.brand-list::-webkit-scrollbar {
    width: 5px;
}
.brand-list::-webkit-scrollbar-track {
    background: transparent;
}
.brand-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 5px;
}

.brand-item {
    margin-bottom: 8px;
}

.brand-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.brand-link:hover, .brand-link.active {
    color: var(--color-text);
    background-color: rgba(255, 255, 255, 0.05);
}

.brand-link.active {
    color: var(--color-primary-light);
    background-color: var(--color-primary-glow);
    font-weight: 600;
}

/* Resultados del Catálogo */
.catalog-results {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-count {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Tarjetas de Producto */
.product-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
}

.product-img-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
}

.product-img {
    width: 60%;
    opacity: 0.85;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img {
    transform: scale(1.1);
    opacity: 1;
}

/* Fallback de Imagen / Icono de Repuesto */
.product-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    gap: 8px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}
.placeholder-icon {
    width: 48px;
    height: 48px;
    fill: var(--color-border);
}

.product-badge-brand {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-sku {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.product-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8rem;
}

/* Punto Verde de Stock */
.stock-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.stock-dot {
    width: 10px;
    height: 10px;
    background-color: var(--color-success);
    border-radius: 50%;
    position: relative;
}

/* Efecto de pulso en el punto verde */
.stock-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-success);
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
}

.product-price {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

.btn-add-cart-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-cart-icon:hover {
    background-color: var(--color-primary-hover);
    transform: scale(1.1);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.page-num {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
    background-color: var(--color-bg-surface);
}

.page-num:hover, .page-num.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Ficha de Detalle del Producto */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 50px;
    padding: 60px 0;
}

.product-detail-gallery {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
}

.product-detail-gallery img {
    max-width: 60%;
    opacity: 0.9;
}

.product-detail-gallery .product-img-placeholder {
    padding: 40px;
}
.product-detail-gallery .placeholder-icon {
    width: 96px;
    height: 96px;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
}

.product-detail-brand {
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    font-size: 1rem;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.product-detail-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
}

.product-detail-sku-box {
    display: inline-flex;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    width: fit-content;
}

.product-detail-price {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 25px;
}

.product-detail-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-surface);
    overflow: hidden;
}

.qty-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    background-color: transparent;
}
.qty-btn:hover {
    background-color: rgba(255,255,255,0.05);
}

.qty-input {
    width: 50px;
    text-align: center;
    font-weight: 600;
}

.specifications-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
}

.specifications-table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid var(--color-border);
    font-weight: bold;
}

.specifications-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
}

.specifications-table tr:last-child td {
    border-bottom: none;
}

/* Vista del Carrito */
.cart-layout {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 40px;
    padding: 50px 0;
}

.cart-items-container {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 30px;
}

.cart-item-row {
    display: grid;
    grid-template-columns: 80px 2fr 100px 120px 40px;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--color-border);
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    background-color: var(--color-bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-name {
    font-weight: 600;
}

.cart-item-sku {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.cart-item-price {
    font-weight: 700;
}

.cart-remove-btn {
    cursor: pointer;
    color: var(--color-text-muted);
}
.cart-remove-btn:hover {
    color: var(--color-danger);
}

/* Formulario de Checkout / Resumen del Pedido */
.cart-summary {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.form-control {
    width: 100%;
    background-color: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 15px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--color-primary);
}

/* Página de Contacto e Información */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding: 60px 0;
}

.info-cards {
    display: grid;
    gap: 24px;
}

.info-card {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 30px;
}

.info-card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-form-container {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
}

/* Pie de Página / Footer */
.footer {
    background-color: #0c0f17;
    border-top: 1px solid var(--color-border);
    padding: 60px 0 30px 0;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #fff;
}

.footer-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
}

.footer-link-item {
    margin-bottom: 10px;
}

.footer-link {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.footer-link:hover {
    color: var(--color-primary-light);
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Toast de Notificaciones */
.toast {
    position: fixed;
    bottom: 30px;
    right: -400px;
    background-color: var(--color-bg-card);
    border-left: 5px solid var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    right: 30px;
}

.toast-success {
    border-left-color: var(--color-success);
}

/* ==========================================================================
   DISEÑO RESPONSIVO (MÓVILES) - OPTIMIZACIÓN TALLERES
   ========================================================================== */

@media (max-width: 992px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    
    .filter-sidebar {
        position: static;
        margin-bottom: 20px;
    }
    
    .product-detail-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    .contact-layout {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        height: auto;
        padding: 15px 0;
    }
    
    .header-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .top-info-container {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .cart-item-row {
        grid-template-columns: 60px 1fr 40px;
        grid-template-rows: auto auto;
        gap: 10px;
    }
    
    .cart-item-price-qty {
        grid-column: 2;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 5px;
    }
    
    .cart-item-row .quantity-selector {
        transform: scale(0.9);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}
