/* ===========================
   VARIABLES Y BASE
   =========================== */
:root {
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #3a3b45;
    --sidebar-width: 250px;
    --sidebar-collapsed: 80px;
    --header-height: 60px;
    --border-radius: 0.35rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background-color: #f8f9fc;
    color: #3a3b45;
    overflow-x: hidden;
}

/* ===========================
   LOGIN PAGE
   =========================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 50%, #1a2942 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    background: linear-gradient(135deg, #4e73df, #224abe);
    padding: 2rem;
    text-align: center;
    color: white;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-header p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.login-body {
    padding: 2rem;
}

.login-body .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #5a5c69;
}

.login-body .form-control {
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    border: 1px solid #d1d3e2;
    transition: var(--transition);
}

.login-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #4e73df, #224abe);
    border: none;
    color: white;
    transition: var(--transition);
}

.btn-login:hover {
    background: linear-gradient(135deg, #2e59d9, #1a2942);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(78, 115, 223, 0.4);
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #4e73df 0%, #224abe 100%);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-brand-text {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 0.75rem 1rem;
}

.sidebar-heading {
    padding: 0.5rem 1.5rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
}

.sidebar .nav-item {
    position: relative;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.sidebar .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
    border-left-color: white;
    font-weight: 700;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar .nav-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
}

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ===========================
   TOP HEADER
   =========================== */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.08);
}

.top-header .toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.top-header .toggle-sidebar:hover {
    background: var(--light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right .exchange-rate-badge {
    background: linear-gradient(135deg, #f6c23e, #dda20a);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-dropdown:hover {
    background: var(--light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info {
    line-height: 1.2;
}

.user-info .name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--dark);
}

.user-info .role {
    font-size: 0.7rem;
    color: var(--secondary);
}

/* ===========================
   PAGE CONTENT
   =========================== */
.page-content {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.page-header .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
}

/* ===========================
   STAT CARDS
   =========================== */
.stat-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.08);
    overflow: hidden;
    transition: var(--transition);
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
}

.stat-card.border-primary { border-left-color: var(--primary); }
.stat-card.border-success { border-left-color: var(--success); }
.stat-card.border-info { border-left-color: var(--info); }
.stat-card.border-warning { border-left-color: var(--warning); }
.stat-card.border-danger { border-left-color: var(--danger); }

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-card.border-primary .stat-label { color: var(--primary); }
.stat-card.border-success .stat-label { color: var(--success); }
.stat-card.border-info .stat-label { color: var(--info); }
.stat-card.border-warning .stat-label { color: var(--warning); }
.stat-card.border-danger .stat-label { color: var(--danger); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

/* ===========================
   TABLES
   =========================== */
.table-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.08);
}

.table-card .card-header {
    background: white;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-card .card-header h5 {
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.table-responsive {
    border-radius: var(--border-radius);
}

.table thead th {
    background: var(--light);
    border-bottom: 2px solid #e3e6f0;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.04);
}

/* ===========================
   BADGES & STATUS
   =========================== */
.badge-stock-ok {
    background-color: rgba(28, 200, 138, 0.15);
    color: #1cc88a;
}

.badge-stock-low {
    background-color: rgba(246, 194, 62, 0.15);
    color: #dda20a;
}

.badge-stock-out {
    background-color: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
}

.badge-movement-entry {
    background-color: rgba(28, 200, 138, 0.15);
    color: #1cc88a;
}

.badge-movement-exit {
    background-color: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
}

.badge-movement-adjustment {
    background-color: rgba(246, 194, 62, 0.15);
    color: #dda20a;
}

.badge-movement-transfer {
    background-color: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
}

/* ===========================
   MODALS
   =========================== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #4e73df, #224abe);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ===========================
   FORMS
   =========================== */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #d1d3e2;
    padding: 0.6rem 0.85rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #4e73df, #224abe);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2e59d9, #1a2942);
    box-shadow: 0 4px 15px rgba(78, 115, 223, 0.4);
}

/* ===========================
   FILTERS BAR
   =========================== */
.filters-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filters-bar .form-control,
.filters-bar .form-select {
    max-width: 220px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 992px) {
    .sidebar {
        left: calc(var(--sidebar-width) * -1);
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .main-content.active {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 1rem;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .filters-bar {
        flex-direction: column;
    }
    .filters-bar .form-control,
    .filters-bar .form-select {
        max-width: 100%;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
    .sidebar, .top-header, .btn, .filters-bar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}

/* ===========================
   ANIMATIONS
   =========================== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ===========================
   CATEGORY CARDS
   =========================== */
.category-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.08);
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
}

.category-card .card-body {
    text-align: center;
    padding: 1.5rem;
}

.category-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
}

.category-card .category-count {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--secondary);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: var(--secondary);
    margin-bottom: 0.5rem;
}
/* Tabla de inventario mejorada */
#inventoryTable thead th {
    font-size: 0.7rem;
    padding: 0.5rem 0.6rem;
}

#inventoryTable tbody td {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
}

#inventoryTable tfoot td {
    padding: 0.75rem 0.6rem;
    border-top: 2px solid #dee2e6;
}

/* Resaltar filas con stock bajo */
#inventoryTable tbody tr:has(.badge-stock-out) {
    background-color: rgba(231, 74, 59, 0.05);
}

#inventoryTable tbody tr:has(.badge-stock-low) {
    background-color: rgba(246, 194, 62, 0.05);
}

/* Resaltar filas de productos inactivos */
#productsTable tbody tr[data-status="inactive"] {
    background-color: rgba(220, 53, 69, 0.05);
    opacity: 0.7;
}

#productsTable tbody tr[data-status="inactive"]:hover {
    background-color: rgba(220, 53, 69, 0.1);
    opacity: 1;
}

#productsTable tbody tr[data-status="inactive"] td {
    text-decoration: line-through;
    text-decoration-color: rgba(220, 53, 69, 0.3);
}