/* Estilos Premium Mobile-First - Portal de Ventas "demodiego" */

:root {
    --bg-main: #0b0f19;
    --bg-navbar: rgba(15, 23, 42, 0.6);
    --bg-card: rgba(30, 41, 59, 0.45);
    --bg-input: rgba(15, 23, 42, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Acentos */
    --color-primary: #4f46e5; /* Indigo */
    --color-primary-hover: #6366f1;
    --color-accent: #06b6d4; /* Cyan */
    
    /* Estados */
    --color-success: #10b981;  /* Emerald */
    --color-warning: #f59e0b;  /* Amber */
    --color-danger: #ef4444;   /* Red */
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout Principal */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.app-sidebar {
    width: 280px;
    background-color: #0d1222;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    flex-shrink: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-left: 8px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-text span {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-text small {
    font-size: 11px;
    color: var(--color-accent);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Badge de Vendedor / Admin en Sidebar */
.user-profile-badge {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    width: fit-content;
    margin-top: 4px;
}

.role-admin {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.role-vendedor {
    background: rgba(6, 182, 212, 0.15);
    color: #99f6e4;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Menú de Sidebar */
.sidebar-menu {
    flex-grow: 1;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
}

.menu-item svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    transition: stroke 0.3s ease;
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item:hover svg {
    stroke: var(--text-primary);
}

.menu-item.active {
    color: white;
    background: var(--color-primary);
    font-weight: 600;
}

.menu-item.active svg {
    stroke: white;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fca5a5;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-logout svg {
    stroke: #ef4444;
    fill: none;
    stroke-width: 2;
    width: 20px;
    height: 20px;
}

/* Área de Contenido Principal */
.app-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 50%, #0d1326 0%, #060913 100%);
    min-width: 0;
}

/* Barra Superior */
.top-navbar {
    height: 75px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-navbar);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.top-navbar h2 {
    font-size: 20px;
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

.content-wrapper {
    padding: 30px 40px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Tarjetas (Cards) Glassmorphism */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Grid de Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke-width: 2;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Colores de Iconos de Estadísticas */
.icon-indigo { background: rgba(79, 70, 229, 0.15); color: #818cf8; }
.icon-indigo svg { stroke: #818cf8; }

.icon-cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.icon-cyan svg { stroke: #22d3ee; }

.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-emerald svg { stroke: #34d399; }

.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.icon-amber svg { stroke: #fbbf24; }

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #3730a3 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success) 0%, #047857 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--color-primary-hover);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.01);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

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

/* Badges / Insignias */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-secondary { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.2); }
.badge-info { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.35); }
.badge-primary { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }

/* Alertas */
.alert {
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* --- CATÁLOGO DE PRODUCTOS (VISTA MÓVIL PRINCIPAL) --- */

.catalog-header {
    margin-bottom: 20px;
}

/* Buscador y selectores flotantes */
.search-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* Categorías en deslizamiento horizontal (Premium Mobile) */
.categories-scroll {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    padding-bottom: 8px;
    scrollbar-width: none; /* Firefox */
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch !important;
}

.categories-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.cat-pill {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cat-pill:hover {
    background: rgba(255, 255, 255, 0.08);
}

.cat-pill.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary-hover);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* Subcategorías */
.subcategories-scroll {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding-bottom: 6px;
    scrollbar-width: none;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch !important;
}

.subcategories-scroll::-webkit-scrollbar {
    display: none;
}

.subcat-pill {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.subcat-pill.active {
    background: var(--color-accent);
    color: #0b0f19;
    border-color: var(--color-accent);
    font-weight: 600;
}

/* Contenedor de Productos (Infinite Scroll Grid) */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

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

.product-card {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.product-image-container {
    width: 100%;
    aspect-ratio: 4/3;
    background-color: rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image-container img {
    transform: scale(1.05);
}

.product-stock-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
}

.product-stock-in {
    color: #4ade80 !important; /* Verde esmeralda visible en modo oscuro */
    border-color: rgba(74, 222, 128, 0.3) !important;
}

.product-stock-out {
    color: #f87171 !important; /* Rojo claro */
    border-color: rgba(248, 113, 113, 0.3) !important;
}

.product-stock-low {
    color: #fbbf24 !important; /* Amarillo ámbar */
    border-color: rgba(251, 191, 36, 0.3) !important;
}

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

.product-code {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 6px;
    height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-prices {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.price-original {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: line-through;
    height: 14px;
}

.price-current {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-accent);
}

.product-action {
    margin-top: 10px;
}

.product-action .btn {
    width: 100%;
    padding: 8px;
    font-size: 12px;
}

/* Spinner de Carga de Scroll Infinito */
.scroll-loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    width: 100%;
    grid-column: 1 / -1;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- DETALLE DE PRODUCTO EN MODAL --- */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: #0d1222;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 550px;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-card {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
}

.modal-body {
    overflow-y: auto;
    padding: 20px;
}

/* Carrusel de Imágenes en Modal */
.image-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.carousel-slides {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-in-out;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
}

.carousel-dot.active {
    background: white;
    width: 16px;
    border-radius: 4px;
}

/* --- CARRITO DE COMPRAS FLOTANTE MÓVIL --- */

.cart-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--color-primary);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    z-index: 99;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s ease;
}

.cart-float-btn:active {
    transform: scale(0.9);
}

.cart-float-btn svg {
    width: 26px;
    height: 26px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

.cart-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
}

/* Bottom Sheet / Panel de Carrito */
.cart-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: none;
    justify-content: flex-end; /* Panel Lateral en Desktop, Panel inferior en móvil */
}

.cart-sheet {
    width: 100%;
    max-width: 480px;
    background: #0d1222;
    border-left: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sheet-backdrop.active {
    display: flex;
}

.cart-sheet-backdrop.active .cart-sheet {
    transform: translateX(0);
}

.cart-sheet-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-sheet-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.cart-sheet-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.cart-item-img {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    overflow: hidden;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex-grow: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 13px;
    color: var(--color-accent);
    font-weight: 600;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qty-val {
    font-size: 14px;
    font-weight: 600;
    width: 20px;
    text-align: center;
}

.cart-item-remove {
    color: var(--color-danger);
    cursor: pointer;
    padding: 4px;
}

.cart-item-remove svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.cart-sheet-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
}

.cart-summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.cart-summary-line.total {
    font-size: 18px;
    font-weight: 700;
    color: white;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 8px;
}

.cart-empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.cart-empty-message svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    fill: none;
    margin-bottom: 12px;
}

/* Formulario de Subida de Imágenes en Admin */
.image-upload-wrapper {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: rgba(255,255,255,0.01);
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.image-upload-wrapper:hover {
    border-color: var(--color-primary);
    background: rgba(79, 70, 229, 0.05);
}

.image-upload-wrapper svg {
    width: 36px;
    height: 36px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    margin-bottom: 10px;
}

.image-previews-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.img-preview-box {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    background: #000;
}

.img-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    font-weight: bold;
}

.img-preview-box.main-tag::after {
    content: 'P';
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: var(--color-primary);
    color: white;
    font-size: 8px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 4px;
}

/* --- VISTA DE LOGIN PREMIUM --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, #111827 0%, #030712 100%);
    padding: 20px;
}

.login-card {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    padding: 35px 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.login-logo .brand-icon {
    width: 50px;
    height: 50px;
    font-size: 26px;
    border-radius: 12px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsividad General */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 90;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 95;
        box-shadow: 15px 0 35px rgba(0,0,0,0.5);
    }

    .app-sidebar.mobile-open {
        left: 0;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .top-navbar {
        padding: 0 16px;
        height: 64px;
        gap: 10px;
    }

    .top-navbar h2 {
        font-size: 18px;
    }

    .content-wrapper {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    .top-navbar h2 {
        font-size: 16px;
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }

    .table th, .table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .stat-card {
        padding: 15px;
        gap: 12px;
    }

    .stat-value {
        font-size: 18px;
    }

    .product-image-container {
        aspect-ratio: 16/9;
        max-height: 140px;
    }
}

@media (max-width: 480px) {
    .top-navbar {
        padding: 0 12px;
        height: 60px;
    }

    .top-navbar h2 {
        font-size: 15px;
        max-width: 140px;
    }

    /* Ocultar fecha y texto de Modo Claro/Oscuro para evitar desbordamiento horizontal en celulares */
    .navbar-date {
        display: none !important;
    }

    #themeSwitchBtn span, .theme-switch-btn span {
        display: none !important;
    }

    .theme-switch-btn {
        padding: 8px !important;
    }

    .content-wrapper {
        padding: 12px;
    }

    .cart-sheet {
        max-width: 100%;
    }

    .cart-sheet-body {
        padding: 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    
    .product-card {
        border-radius: 14px;
    }

    .product-image-container {
        aspect-ratio: 16/10;
        max-height: 110px;
    }

    .image-carousel {
        aspect-ratio: 16/9 !important;
        max-height: 180px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 13px;
        height: 32px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .price-current {
        font-size: 15px;
    }

    .modal-card {
        width: 95%;
        max-height: 92vh;
        margin: 10px auto;
        border-radius: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .cart-float-btn {
        width: 52px;
        height: 52px;
        bottom: 16px;
        right: 16px;
    }

    .cart-float-btn svg {
        width: 22px;
        height: 22px;
    }

    .mobile-filters-trigger {
        bottom: 16px;
        left: 16px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .search-filter-bar {
        gap: 10px;
    }
}

@media (max-width: 360px) {
    .top-navbar h2 {
        max-width: 110px;
        font-size: 14px;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .product-image-container {
        aspect-ratio: 16/9;
        max-height: 90px;
    }

    .product-info {
        padding: 8px;
    }

    .product-name {
        font-size: 12px;
        height: 30px;
    }

    .price-current {
        font-size: 14px;
    }

    .product-action .btn {
        padding: 6px;
        font-size: 11px;
    }
}

/* =========================================================
   MODO CLARO ELEGANTE (LIGHT MODE & TEMA DINÁMICO)
   ========================================================= */

:root[data-theme="light"],
html[data-theme="light"],
body[data-theme="light"] {
    --bg-main: #eaeff5 !important; /* Gris platinado suave / humo bajo, nunca blanco cegador */
    --bg-navbar: rgba(248, 250, 252, 0.95) !important;
    --bg-card: #ffffff !important;
    --bg-input: #ffffff !important;
    --border-color: rgba(15, 23, 42, 0.12) !important;
    --text-primary: #0f172a !important; /* Azul marino / carbón nítido para máximo contraste */
    --text-secondary: #475569 !important;
    --text-muted: #64748b !important;
}

/* Fondo principal y contenedores en Modo Claro */
html[data-theme="light"] body,
html[data-theme="light"] .app-layout,
html[data-theme="light"] .content-wrapper,
html[data-theme="light"] .tienda-container,
html[data-theme="light"] main {
    background-color: #eaeff5 !important;
    color: #0f172a !important;
}

/* Sidebar e Identidad en Modo Claro */
html[data-theme="light"] .app-sidebar {
    background-color: #f8fafc !important;
    border-right: 1px solid rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .sidebar-header .brand-text span,
html[data-theme="light"] .brand-text span {
    color: #0f172a !important;
}

html[data-theme="light"] .sidebar-header .brand-text small,
html[data-theme="light"] .brand-text small {
    color: #64748b !important;
}

html[data-theme="light"] .menu-item {
    color: #475569 !important;
}

html[data-theme="light"] .menu-item:hover {
    background: rgba(79, 70, 229, 0.08) !important;
    color: var(--color-primary) !important;
}

/* El elemento activo del menú lateral SIEMPRE debe tener fondo índigo y LETRAS BLANCAS NÍTIDAS */
html[data-theme="light"] .menu-item.active {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

html[data-theme="light"] .menu-item.active i {
    stroke: #ffffff !important;
}

html[data-theme="light"] .user-profile-badge {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
}

html[data-theme="light"] .user-profile-badge .user-name {
    color: #0f172a !important;
}

html[data-theme="light"] .user-profile-badge .user-role {
    color: #64748b !important;
}

/* Cabeceras y Barras Superiores */
html[data-theme="light"] .top-navbar,
html[data-theme="light"] .tienda-navbar {
    background: rgba(248, 250, 252, 0.92) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02) !important;
}

html[data-theme="light"] .top-navbar h2,
html[data-theme="light"] .tienda-logo-link span {
    color: #0f172a !important;
}

/* Tarjetas y Contenedores */
html[data-theme="light"] .card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .product-card,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .cart-sheet,
html[data-theme="light"] .tienda-sidebar,
html[data-theme="light"] .cart-summary {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .card-header h3,
html[data-theme="light"] .stat-card h3,
html[data-theme="light"] .stat-card p,
html[data-theme="light"] .product-name,
html[data-theme="light"] .product-code,
html[data-theme="light"] .cart-sheet-header h3,
html[data-theme="light"] .modal-body h3,
html[data-theme="light"] .modal-body p {
    color: #0f172a !important;
}

html[data-theme="light"] .stat-card .text-muted,
html[data-theme="light"] .product-code {
    color: #64748b !important;
}

/* Formularios e Inputs */
html[data-theme="light"] .form-control,
html[data-theme="light"] select.form-control,
html[data-theme="light"] input.form-control,
html[data-theme="light"] textarea.form-control {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .form-control:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

html[data-theme="light"] .form-label,
html[data-theme="light"] label {
    color: #1e293b !important;
}

/* Tablas */
html[data-theme="light"] .table-responsive {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02) !important;
}

html[data-theme="light"] .table th {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border-bottom: 2px solid #cbd5e1 !important;
}

html[data-theme="light"] .table td {
    color: #0f172a !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

html[data-theme="light"] .table tr:hover {
    background-color: #f8fafc !important;
}

/* Píldoras de Categoría / Subcategoría / Marcas en Modo Claro */
html[data-theme="light"] .cat-pill,
html[data-theme="light"] .subcat-pill,
html[data-theme="light"] .brand-filter-item {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .cat-pill:hover,
html[data-theme="light"] .subcat-pill:hover,
html[data-theme="light"] .brand-filter-item:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

/* LA REGLA DE ORO DEL USUARIO: LAS LETRAS BLANCAS NO SE DEBEN PERDER NUNCA */
/* Todas las píldoras activas, botones primarios, botones de éxito, íconos de marca SIEMPRE usan fondos oscuros/saturados con letras blancas nítidas */
html[data-theme="light"] .cat-pill.active,
html[data-theme="light"] .subcat-pill.active,
html[data-theme="light"] .brand-filter-item.active,
html[data-theme="light"] .btn-primary,
html[data-theme="light"] .btn-success,
html[data-theme="light"] .btn-danger,
html[data-theme="light"] .mobile-filters-trigger {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-color: var(--color-primary) !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
}

html[data-theme="light"] .btn-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .btn-danger {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .btn-secondary {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Sugerencias de Búsqueda y Dropdowns */
html[data-theme="light"] .search-suggestions-dropdown {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

html[data-theme="light"] .suggestion-item:hover {
    background: #f1f5f9 !important;
}

html[data-theme="light"] .suggestion-name {
    color: #0f172a !important;
}

html[data-theme="light"] .suggestion-meta {
    color: #64748b !important;
}

/* Botón Conmutador de Tema (Theme Switcher) */
.theme-switch-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

html[data-theme="light"] .theme-switch-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03) !important;
}

.theme-switch-btn:hover {
    background: rgba(79, 70, 229, 0.1) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

/* Visibilidad y Contraste de Stock en Modo Claro */
html[data-theme="light"] .product-stock-tag {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

html[data-theme="light"] .product-stock-tag.product-stock-in,
html[data-theme="light"] .product-stock-tag:not(.product-stock-out):not(.product-stock-low) {
    background: #f0fdf4 !important;
    color: #15803d !important; /* Verde esmeralda oscuro nítido y legible */
    border: 1px solid #86efac !important;
}

html[data-theme="light"] .product-stock-tag.product-stock-low {
    background: #fffbeb !important;
    color: #b45309 !important; /* Ámbar oscuro nítido y legible */
    border: 1px solid #fde68a !important;
}

html[data-theme="light"] .product-stock-tag.product-stock-out {
    background: #fef2f2 !important;
    color: #b91c1c !important; /* Rojo oscuro nítido y legible */
    border: 1px solid #fecaca !important;
}
