html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    scroll-behavior: smooth;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #64748b; /* #666666 equivalentish */

    /* Typography System */
    --font-family-base: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    
    --font-size-h1: 28px;     /* Desktop Title */
    --font-size-h1-mobile: 24px;
    --font-size-subtitle: 15px;
    --font-size-body: 14px;
    --font-size-small: 13px;
    --font-size-btn: 14px;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --letter-spacing-tight: -0.2px;
    --letter-spacing-wide: 0.1px;

    --line-height-base: 1.5;
    --line-height-tight: 1.4;
}

@media (max-width: 768px) {
    :root {
        --font-size-h1: var(--font-size-h1-mobile);
        --font-size-subtitle: 14px;
    }
}

body {
    color: var(--text-dark);
    background-color: var(--surface-page, #f1f5f9);
    -webkit-font-smoothing: antialiased;
}

/* Los títulos heredan el color del contenedor: así se leen sobre fondos oscuros o degradados */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    color: inherit;
    letter-spacing: -0.01em;
}

/* Page Titles & Subtitles */
.page-title {
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-semibold);
    color: var(--text-dark);
}

.page-subtitle {
    font-size: var(--font-size-subtitle);
    font-weight: var(--font-weight-normal);
    color: #666666; /* Specific request */
    line-height: var(--line-height-base);
}

a {
    text-decoration: none;
}

/* Utilities */
.text-primary-custom { color: var(--primary-color) !important; }
.bg-primary-custom { background-color: var(--primary-color) !important; }
.text-accent { color: var(--accent-color) !important; }

/* Buttons */
.btn {
    font-size: var(--font-size-btn);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-wide);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .55);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Cards */
.card {
    border: none;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* Hero Section (Landing Page) */
.landing-hero-gradient {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Inputs */
.form-control, .form-select {
    border-radius: var(--radius-sm, .5rem);
    border: 1px solid var(--border-color, #e2e8f0);
}

.form-control:not(.form-control-sm):not(.form-control-lg) {
    padding: .55rem .85rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* Blazor Defaults */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Loading Spinner (Componente interno) */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    min-height: 200px;
}

.spinner-svg {
    width: 3rem;
    height: 3rem;
    animation: rotate 2s linear infinite;
    transform-origin: center center;
}

.spinner-circle {
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    fill: none;
    animation: dash 1.5s ease-in-out infinite;
    stroke-linecap: round;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -35px;
    }
    100% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -124px;
    }
}

/* Custom Soft Grid - Refactored */
.custom-soft-grid {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    background: #ffffff;
    border: 1px solid #E0E0E0;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.custom-soft-grid thead th {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-tight);
}

.custom-soft-grid tbody td {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-tight);
}

.custom-soft-grid th,
.custom-soft-grid td {
    white-space: nowrap;
}

/* Grid Search Input Improvements */
.custom-soft-grid thead input.form-control {
    background-color: #fff;
    border: 1px solid #ced4da;
    font-size: 0.85rem;
    height: 32px; /* Compact height */
    padding: 4px 8px;
    border-radius: 4px;
}

.custom-soft-grid thead input.form-control:focus {
    background-color: #fff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.custom-soft-grid thead select.form-select {
    font-size: 0.85rem;
    height: 32px;
}

/* =========================================
   BLAZOR LOADING PROGRESS (Fix Blob Negro)
   ========================================= */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary-color, #1b6ec2);
    stroke-dasharray: calc(3.141 * 100% * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Cargando...");
}

/* =========================================================================
   SISTEMA DE DISEÑO v2 — aspecto profesional unificado para todas las pantallas
   ========================================================================= */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --brand-gradient: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    --sidebar-bg: linear-gradient(180deg, #0b1220 0%, #111c33 55%, #13223f 100%);
    --surface-page: #f3f6fb;
    --surface-card: #ffffff;
    --border-color: #e5e9f2;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --radius-sm: .5rem;
    --radius: .85rem;
    --radius-lg: 1.1rem;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 10px 24px -12px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .05);
}

html, body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; }
::selection { background: rgba(37, 99, 235, .18); }

/* Títulos de página */
.page-title { font-weight: 700; letter-spacing: -0.02em; color: var(--text-dark); }
.page-subtitle { color: var(--text-muted); }

/* Botones: tamaño estable, esquinas suaves, sin saltos */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.btn-success { background-color: #16a34a; border-color: #16a34a; }
.btn-success:hover { background-color: #15803d; border-color: #15803d; box-shadow: 0 6px 14px -6px rgba(22, 163, 74, .55); }
.btn-outline-secondary { border-color: var(--border-color); color: #475569; }
.btn-outline-secondary:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--text-dark); }

/* Tarjetas */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card.shadow-sm, .card.shadow { box-shadow: var(--shadow-sm) !important; }
.card-header {
    background: #fbfcfe;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0 !important; }
.hover-shadow:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }

/* Tablas: encabezado claro y legible, filas con hover */
.table { --bs-table-hover-bg: #f5f8ff; color: var(--text-dark); margin-bottom: 0; }
.table > thead > tr > th,
.table > thead.table-dark > tr > th,
.table-dark > :not(caption) > * > * {
    background: #f6f8fc !important;
    color: #475569 !important;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border-color) !important;
    border-color: var(--border-color) !important;
    vertical-align: middle;
    white-space: nowrap;
}
.table > tbody > tr > td { border-color: #eef1f6; vertical-align: middle; }
.table-bordered > :not(caption) > * > * { border-color: #eef1f6; }
.table-responsive { border-radius: var(--radius-sm); }
.table > tfoot > tr > td, .table > tfoot > tr > th { background: #f8fafc; }

/* Insignias en tono suave */
.badge { font-weight: 600; letter-spacing: .01em; padding: .38em .62em; border-radius: 999px; }
.badge.bg-success { background-color: #dcfce7 !important; color: #166534 !important; }
.badge.bg-danger { background-color: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-warning { background-color: #fef3c7 !important; color: #92400e !important; }
.badge.bg-info { background-color: #e0f2fe !important; color: #075985 !important; }
.badge.bg-primary { background-color: #dbeafe !important; color: #1e40af !important; }
.badge.bg-secondary { background-color: #f1f5f9 !important; color: #475569 !important; }

/* Alertas */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); }
.alert-info { background: #eff6ff; border-color: #dbeafe; color: #1e3a8a; }
.alert-success { background: #f0fdf4; border-color: #dcfce7; color: #14532d; }
.alert-warning { background: #fffbeb; border-color: #fef3c7; color: #78350f; }
.alert-danger { background: #fef2f2; border-color: #fee2e2; color: #7f1d1d; }

/* Modales */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: 0 25px 60px -20px rgba(15, 23, 42, .45); }
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); background: #fbfcfe; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-backdrop.show { opacity: .45; }

/* Formularios */
.form-label { font-weight: 600; font-size: .82rem; color: #334155; }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }

/* Barras de desplazamiento */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* Pantalla de carga inicial con marca */
.loading-progress circle:last-child { stroke: var(--primary-color); }
.loading-progress-text { color: var(--text-muted); font-weight: 600; }

/* Error global de Blazor en español y visible */
#blazor-error-ui { background: #fef2f2; color: #7f1d1d; border-top: 1px solid #fecaca; }

/* Encabezado de pantalla (PageHeader) */
.bb-header { margin-bottom: 1.5rem !important; }
.bb-header .page-title { position: relative; font-size: 1.6rem; padding-left: .9rem; }
.bb-header .page-title::before {
    content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px;
    border-radius: 4px; background: var(--brand-gradient);
}
.bb-header .page-subtitle { padding-left: .9rem; margin-top: .15rem; font-size: .9rem; }
.bb-header .breadcrumb { padding-left: .9rem; }
.bb-header-divider { height: 1px; margin-top: 1.1rem; background: linear-gradient(90deg, var(--border-color) 0%, transparent 100%); }
.btn-new { padding: .55rem 1.1rem; box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .9); }

/* Notificaciones: debajo de la barra superior, con acento de color */
.toast-container { top: 4.5rem !important; }
.toast { border: none; border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden; border-left: 4px solid var(--primary-color); }
.toast.text-bg-success { border-left-color: #15803d; }
.toast.text-bg-danger { border-left-color: #991b1b; }
.toast.text-bg-warning { border-left-color: #b45309; }

/* Banner del panel principal */
.landing-hero-gradient { background: var(--brand-gradient); border-radius: var(--radius-lg) !important; box-shadow: 0 20px 40px -24px rgba(30, 58, 138, .8) !important; }

/* =========================================================================
   TIENDA ONLINE (/store)
   ========================================================================= */
:root { --store-nav-h: 68px; }

.store-navbar {
    min-height: var(--store-nav-h);
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.store-brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--text-dark); }
.store-brand:hover { color: var(--text-dark); }
.store-brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-gradient); color: #fff; font-size: 1.05rem; box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .9);
}
.store-nav .nav-link { font-weight: 600; color: #475569; padding: .5rem 1rem !important; border-radius: 999px; }
.store-nav .nav-link:hover { color: var(--primary-color); background: var(--primary-soft); }
.store-nav .nav-link.active { color: var(--primary-color); background: var(--primary-soft); }
.store-cart-btn {
    position: relative; display: inline-flex; align-items: center; gap: .45rem;
    background: var(--text-dark); color: #fff; border-radius: 999px; padding: .5rem 1.1rem; font-weight: 600;
}
.store-cart-btn:hover { background: var(--primary-color); color: #fff; }
.store-cart-count {
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.store-footer { background: #0b1220; color: #cbd5e1; }
.store-footer-title { color: #fff; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1rem; }
.store-footer-text { color: #94a3b8; font-size: .92rem; }
.store-footer-links li { margin-bottom: .55rem; color: #94a3b8; font-size: .92rem; }
.store-footer-links a { color: #cbd5e1; }
.store-footer-links a:hover { color: #fff; }
.store-footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); color: #64748b; font-size: .85rem; text-align: center; }

/* Banner principal */
.store-hero {
    background:
        radial-gradient(900px 420px at 85% 10%, rgba(59, 130, 246, .16), transparent 60%),
        radial-gradient(700px 380px at 0% 100%, rgba(99, 102, 241, .10), transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
    border-bottom: 1px solid var(--border-color);
}
.store-hero-title { font-size: clamp(2.2rem, 4.5vw, 3.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: var(--text-dark); }
.store-hero-title .text-gradient { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.store-hero-lead { font-size: 1.12rem; color: #475569; max-width: 520px; }
.store-eyebrow { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 999px; background: var(--primary-soft); color: #1e40af; font-weight: 700; font-size: .8rem; }
.store-trust { display: flex; flex-wrap: wrap; gap: .75rem; }
.store-trust-item { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem; border-radius: 12px; background: #fff; border: 1px solid var(--border-color); box-shadow: var(--shadow-xs); font-size: .88rem; font-weight: 600; color: #334155; }
.store-trust-item .bi { font-size: 1.1rem; }
.store-hero-media { border-radius: 1.4rem; overflow: hidden; box-shadow: 0 40px 80px -40px rgba(30, 58, 138, .55), 0 0 0 1px rgba(15, 23, 42, .05); background: linear-gradient(135deg, #dbeafe, #eef2ff); }
.store-hero-media img { background: linear-gradient(135deg, #dbeafe, #eef2ff); }
.store-hero-caption {
    position: absolute; left: 1rem; right: 1rem; bottom: 1rem; padding: .85rem 1.1rem; border-radius: 14px;
    background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md); text-align: left;
}
.store-hero-caption h5 { margin: 0; font-weight: 700; color: var(--text-dark); }
.store-hero .carousel-indicators { margin-bottom: 5.5rem; }
.store-hero .carousel-indicators [data-bs-target] { width: 8px; height: 8px; border-radius: 50%; border: 0; }

.btn-store-primary { background: var(--brand-gradient); border: 0; color: #fff; border-radius: 999px; padding: .8rem 1.6rem; font-weight: 700; box-shadow: 0 14px 28px -14px rgba(37, 99, 235, .9); }
.btn-store-primary:hover { color: #fff; filter: brightness(1.05); box-shadow: 0 18px 32px -14px rgba(37, 99, 235, 1); }
.btn-store-ghost { background: #fff; border: 1px solid var(--border-color); color: var(--text-dark); border-radius: 999px; padding: .8rem 1.6rem; font-weight: 700; }
.btn-store-ghost:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--text-dark); }

/* Secciones */
.store-section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; color: var(--text-dark); }
.store-section-sub { color: var(--text-muted); }

/* Tarjeta de producto */
.store-product {
    background: #fff; border: 1px solid var(--border-color); border-radius: 1.1rem; overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; height: 100%;
    display: flex; flex-direction: column;
}
.store-product:hover { transform: translateY(-4px); box-shadow: 0 24px 40px -24px rgba(15, 23, 42, .35); border-color: #dbe3f0; }
.store-product-media { position: relative; height: 240px; background: #fff; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid #f1f4f9; }
.store-product-media img { width: 100%; height: 100%; object-fit: contain; padding: 1.1rem; transition: transform .4s ease; }
.store-product:hover .store-product-media img { transform: scale(1.04); }
.store-product-quick {
    position: absolute; left: .9rem; right: .9rem; bottom: .9rem; opacity: 0; transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
}
.store-product:hover .store-product-quick, .store-product:focus-within .store-product-quick { opacity: 1; transform: translateY(0); }
@media (hover: none) { .store-product-quick { display: none; } }
.store-product-cat { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-color); }
.store-product-name { font-size: 1.02rem; font-weight: 700; color: var(--text-dark); line-height: 1.3; }
.store-product-name a { color: inherit; }
.store-product-name a:hover { color: var(--primary-color); }
.store-product-desc { font-size: .85rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.store-product-price { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); letter-spacing: -0.01em; }
.store-product-price small { font-size: .8rem; font-weight: 700; color: var(--text-muted); margin-right: .15rem; }
.store-add-btn {
    width: 44px; height: 44px; border-radius: 12px; border: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-gradient); color: #fff; box-shadow: 0 10px 20px -10px rgba(37, 99, 235, .9); transition: transform .15s ease, filter .15s ease;
}
.store-add-btn:hover { transform: translateY(-1px); filter: brightness(1.06); color: #fff; }

/* Barra de filtros del catálogo */
.store-toolbar { top: var(--store-nav-h) !important; background: rgba(255, 255, 255, .92) !important; backdrop-filter: blur(10px); }

/* Blazor enfoca el <h1> al navegar (accesibilidad): sin contorno visible en títulos */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus { outline: none !important; }

/* Blazor.Bootstrap define overflow en <main>; en la tienda la ventana debe desplazarse para que la barra de filtros quede pegada bajo el menú */
main.store-content { overflow: visible !important; }
