:root {
    /* --- DARK THEME (Por defecto) --- */
    --bg-body: #05060a;
    --bg-sidebar: #090b10;
    --bg-surface: #11151f;
    --bg-surface-hover: #1a202e;
    
    --border-color: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-on-accent: #ffffff;

    --accent-primary: #4f46e5;      /* Indigo 600 */
    --accent-hover: #4338ca;        /* Indigo 700 */
    --accent-glow: rgba(79, 70, 229, 0.25);
    --accent-gradient: linear-gradient(135deg, #6366f1, #06b6d4); /* Gradient Wildu */
    
    /* Colores de estado mejorados */
    --success-bg: rgba(16, 185, 129, 0.2);
    --success-text: #34d399;
    --danger-bg: rgba(239, 68, 68, 0.2);
    --danger-text: #f87171;
    --warning-bg: #f59e0b;          /* Amber 500 para el top banner */
    --warning-text: #000000;        /* Texto negro sobre amarillo */
    --warning-surface: rgba(245, 158, 11, 0.15); /* Fondo sutil para disclaimer producto */
    --warning-border: rgba(245, 158, 11, 0.3);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --radius-pill: 9999px;
}

/* --- LIGHT THEME --- */
[data-theme="light"] {
    --bg-body: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;

    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;

    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.15);

    --success-bg: #dcfce7;
    --success-text: #15803d;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --warning-bg: #fbbf24;
    --warning-text: #451a03;
    --warning-surface: #fef3c7;
    --warning-border: #fcd34d;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    padding-top: 36px; /* ESPACIO PARA EL BANNER SUPERIOR */
}

/* --- BANNER SUPERIOR DE AVISO --- */
.top-system-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 36px;
    background: var(--warning-bg);
    color: var(--warning-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    text-align: center;
    padding: 0 15px;
}
.top-system-banner i { margin-right: 6px; }

/* LAYOUT */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 36px);
}

/* SIDEBAR */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 36px; /* Ajustado por el banner */
    height: calc(100vh - 36px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    z-index: 10;
    overflow-y: auto;
}

/* LOGO ESTILIZADO */
.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.logo-text-group {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 26px; /* Más grande */
    font-weight: 900; /* Extra negrita */
    letter-spacing: -1px; /* Letras juntas */
    line-height: 1;
}

.logo-wildu {
    color: var(--text-main);
}

.logo-merch {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-left: 1px;
}

.family-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.family-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.family-pill:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-main);
}

.family-pill.is-active {
    background-color: var(--bg-surface-hover);
    color: var(--accent-primary);
    box-shadow: inset 3px 0 0 var(--accent-primary);
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
}

/* MAIN CONTENT */
.main { padding: 32px 40px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-title { margin: 0; font-size: 24px; font-weight: 700; color: var(--text-main); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.crumb-pill { 
    background: var(--bg-surface); 
    border: 1px solid var(--border-color); 
    padding: 2px 8px; border-radius: var(--radius-sm); 
}

/* ACTIONS (Theme toggle & Cart) */
.topbar-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
    width: 40px; height: 40px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--text-muted); color: var(--text-main); transform: translateY(-1px); }

.cart-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.cart-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.cart-count {
    background: var(--accent-primary);
    color: white;
    font-size: 11px; padding: 2px 6px;
    border-radius: 10px;
}

/* SEARCH & FILTERS */
.toolbar { margin-bottom: 24px; }
.search-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    display: flex; align-items: center; gap: 10px;
    max-width: 500px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input {
    background: transparent; border: none; outline: none;
    color: var(--text-main); font-size: 14px; width: 100%;
}

/* PRODUCTS GRID */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease-out;
    display: flex; flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.product-image-wrapper {
    height: 180px;
    padding: 20px;
    background: var(--bg-surface-hover);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}
.product-image-wrapper img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    mix-blend-mode: multiply;
}
:root:not([data-theme="light"]) .product-image-wrapper img { mix-blend-mode: normal; }

.stock-badge {
    position: absolute; top: 12px; right: 12px;
    padding: 4px 10px; border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 700;
    backdrop-filter: blur(4px);
}
.stock-badge.in-stock { background: var(--success-bg); color: var(--success-text); }
.stock-badge.out-stock { background: var(--danger-bg); color: var(--danger-text); }

.product-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.product-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.product-title { margin: 0; font-size: 15px; color: var(--text-main); line-height: 1.4; font-weight: 600; }

.product-footer { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; padding-top: 12px; }
.price-label { font-size: 10px; color: var(--text-muted); display: block; }
.price-value { font-size: 18px; font-weight: 700; color: var(--text-main); }

/* --- DISCLAIMER DE PRODUCTO (MEJORADO) --- */
.price-disclaimer-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px; /* Más pequeño */
    background: var(--warning-surface);
    border: 1px solid var(--warning-border);
    border-radius: 6px;
    color: var(--text-secondary);
}

.price-disclaimer-box i {
    color: #f59e0b; /* Icono naranja/amarillo siempre visible */
    flex-shrink: 0;
    width: 14px; height: 14px;
    margin-top: 1px;
}

.price-disclaimer-text {
    font-size: 11px; /* Letra pequeña y fina */
    line-height: 1.3;
    font-weight: 400;
}
.price-disclaimer-text strong {
    color: var(--text-main);
    font-weight: 600;
}

/* BUTTONS */
.primary-btn, .secondary-btn, .ghost-btn {
    border: none; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 8px 16px; border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none; transition: all 0.2s;
}
.primary-btn {
    background: var(--accent-primary); color: white;
    box-shadow: 0 4px 10px var(--accent-glow);
}
.primary-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(1); }

.secondary-btn {
    background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-main);
}
.secondary-btn:hover { background: var(--bg-surface-hover); border-color: var(--text-secondary); }

.ghost-btn { background: transparent; color: var(--text-muted); }
.ghost-btn:hover { color: var(--text-main); background: var(--bg-surface-hover); }

/* PAGINATION */
.pagination-container {
    margin-top: 40px; padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}

/* MODAL */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
    background: var(--bg-sidebar);
    width: 100%; max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { margin: 0; color: var(--text-main); font-size: 20px; }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; }

.modal-field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; }
.modal-field select, .modal-field input, .modal-field textarea {
    width: 100%; background: var(--bg-surface);
    border: 1px solid var(--border-color); color: var(--text-main);
    padding: 10px; border-radius: var(--radius-md); outline: none;
    font-size: 14px;
}
.modal-field select:focus, .modal-field input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); }

/* TOAST NOTIFICATION */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 10px; z-index: 200;
}
.toast {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 500;
    animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.success { border-left: 4px solid var(--success-text); }
.toast.error { border-left: 4px solid var(--danger-text); }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* UTILS */
.hidden { display: none !important; }
.tech-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.tech-badge { 
    font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 2px 5px; border-radius: 4px;
    background: var(--bg-surface-hover); border: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* MOBILE */
@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main { padding: 16px; }
    .products-grid { grid-template-columns: 1fr 1fr; }
    .top-system-banner { font-size: 10px; padding: 0 5px; }
}


/* --- NUEVOS BADGES TÉCNICOS (Estilo Fila) --- */

.tech-list {
    display: flex;
    flex-direction: column; /* Ahora van uno debajo de otro para leerse bien */
    gap: 6px;
    margin: 10px 0;
}

.tech-row-badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 10px;
    overflow: hidden;
    max-width: fit-content;
}

.tech-name {
    padding: 4px 8px;
    font-weight: 700;
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tech-separator {
    width: 1px;
    height: 14px;
    background-color: var(--border-color);
}

.tech-options {
    padding: 4px 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: monospace, sans-serif; /* Para que los números se vean técnicos */
}

.tech-options i {
    width: 10px;
    height: 10px;
    color: var(--accent-secondary); /* Color Cyan para el icono */
}
/* --- FILTROS SIDEBAR (PREMIUM STYLE) --- */

.filter-group {
    background-color: var(--bg-surface); /* Fondo sutil */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    display: block;
}

/* SWITCH (TOGGLE) MODERNO */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-body); /* Fondo apagado */
    border: 1px solid var(--border-strong);
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 99px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Estado Activo */
input:checked + .slider {
    background: var(--accent-gradient);
    border-color: transparent;
}
input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* INPUTS DE PRECIO */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Quitar flechas feas de los inputs number */
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.price-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    text-align: center;
    outline: none;
    -moz-appearance: textfield; /* Firefox */
}
/* LINK DEL LOGOTIPO */
.logo-link {
    text-decoration: none;   /* Quita el subrayado */
    color: inherit;          /* Quita el color azul y usa el de los spans */
    display: inline-flex;    /* Mantiene WILDU y MERCH alineados */
    align-items: center;
    cursor: pointer;
}

.logo-link:hover, 
.logo-link:visited, 
.logo-link:active {
    text-decoration: none;   /* Asegura que no vuelva a salir la línea */
    color: inherit;          /* Mantiene los colores originales */
    opacity: 0.9;            /* Efecto sutil al pasar el ratón */
}
.price-input:focus {
    color: var(--accent-primary);
    font-weight: 600;
}
.price-input::placeholder { color: var(--text-muted); opacity: 0.5; }

.price-separator { color: var(--text-muted); font-size: 14px; font-weight: 300; }

/* Botón pequeño de aplicar filtro */
.filter-btn-small {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.filter-btn-small:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* SELECT DE ORDENACIÓN (TOOLBAR) */
.sort-select {
    appearance: none;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 36px 10px 14px; /* Espacio para la flecha */
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    /* Flecha personalizada */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.sort-select:hover { border-color: var(--text-muted); }
.sort-select:focus { border-color: var(--accent-primary); }