/* ========================================
   SISTEMA INVENTARIO - DESIGN SYSTEM
   Modern Dark Theme with Glassmorphism
   ======================================== */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222842;
    --bg-sidebar: #0d1117;
    --bg-input: #1e2439;

    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.2);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary-hover); }

/* ========== APP WRAPPER ========== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-footer { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-link i { margin: 0; font-size: 1.2rem; }

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo i {
    font-size: 1.6rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--accent-primary); background: rgba(99,102,241,0.1); }

.sidebar-nav {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 16px 14px 6px;
    text-transform: uppercase;
}

.nav-item { margin: 2px 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.nav-link.active {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: var(--accent-glow);
}
.nav-link.active i { color: #fff; }

.nav-link i { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.avatar-sm i { font-size: 1.8rem; color: var(--accent-primary); }

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

.top-bar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-area { padding: 24px; flex: 1; }

/* ========== GLASS CARDS ========== */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}
.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.glass-alert {
    background: rgba(26, 31, 53, 0.9) !important;
    border: 1px solid var(--border-color) !important;
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md) !important;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stat-icon.primary { background: rgba(99,102,241,0.15); color: var(--accent-primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-top: 8px;
    line-height: 1;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========== BUTTONS ========== */
.btn-gradient {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.875rem;
}
.btn-gradient:hover {
    box-shadow: var(--accent-glow);
    transform: translateY(-1px);
    color: #fff;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}
.btn-glass:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary-hover);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition);
}
.btn-icon:hover { background: rgba(99,102,241,0.1); color: var(--accent-primary); border-color: var(--accent-primary); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-icon.success:hover { background: var(--success-bg); color: var(--success); border-color: var(--success); }

/* ========== TABLES ========== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table {
    margin: 0;
    color: var(--text-primary);
}
.table thead th {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    vertical-align: middle;
}
.table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
.table tbody tr:last-child td { border-bottom: none; }

/* ========== FORMS ========== */
.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
.form-control::placeholder { color: var(--text-muted); }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group-text {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
}

/* ========== BADGES ========== */
.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ========== SEARCH BAR ========== */
.search-bar {
    position: relative;
    max-width: 350px;
}
.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-bar input {
    padding-left: 40px !important;
}

/* ========== POS STYLES ========== */
.pos-container { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - var(--topbar-height) - 48px); }

.pos-products {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

.pos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

.pos-list .pos-product-card {
    display: flex;
    align-items: center;
    text-align: left;
    padding: 10px 16px;
    gap: 16px;
}
.pos-list .pos-product-card > div:first-child { margin-bottom: 0 !important; }
.pos-list .pos-product-card .product-name { flex: 1; margin-bottom: 0; font-size: 0.95rem; }
.pos-list .pos-product-card .product-price { min-width: 120px; text-align: right; }
.pos-list .pos-product-card .product-stock { min-width: 80px; text-align: right; }

.pos-product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.pos-product-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.pos-product-card .product-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-product-card .product-price {
    color: var(--accent-primary-hover);
    font-weight: 700;
    font-size: 1.1rem;
}
.pos-product-card .product-stock {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pos-cart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pos-cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.pos-cart-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    background: rgba(255,255,255,0.02);
    transition: var(--transition);
}
.pos-cart-item:hover { background: rgba(99,102,241,0.05); }
.pos-cart-item .item-name { flex: 1; font-size: 0.78rem; font-weight: 500; line-height: 1.2; }
.pos-cart-item .item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.pos-cart-item .item-qty button {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.pos-cart-item .item-qty button:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.pos-cart-item .item-total { font-weight: 700; color: var(--accent-primary-hover); min-width: 60px; text-align: right; font-size: 0.8rem; }
.pos-cart-item .item-remove { cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.pos-cart-item .item-remove:hover { color: var(--danger); }

.pos-cart-footer {
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
}
.pos-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 0.8rem;
}
.pos-total-row.grand-total {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-primary-hover);
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
}

.payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0;
}
.payment-method-btn {
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}
.payment-method-btn:hover, .payment-method-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99,102,241,0.1);
}

/* ========== BARCODE SCANNER ========== */
.scanner-input-wrapper {
    position: relative;
}
.scanner-input-wrapper .scanner-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-primary);
    font-size: 1.1rem;
    animation: pulse-scanner 2s infinite;
}
.scanner-input-wrapper input {
    padding-left: 40px !important;
    border-color: var(--accent-primary) !important;
    background: rgba(99,102,241,0.05) !important;
}

@keyframes pulse-scanner {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== CHART CONTAINER ========== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.chart-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-title i { color: var(--accent-primary); }

/* ========== MODAL STYLES ========== */
.modal-content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
}
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; color: var(--text-muted); opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* ========== RESPONSIVE ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .pos-cart { min-height: 400px; }
}

@media (max-width: 767.98px) {
    .content-area { padding: 16px; }
    .stat-value { font-size: 1.3rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease-out; }

/* ========== LOW STOCK INDICATOR ========== */
.stock-low { color: var(--danger); font-weight: 700; }
.stock-ok { color: var(--success); }
.stock-warning { color: var(--warning); }

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Remove default _Layout.cshtml.css overrides */
.nav-link { color: inherit; }