/* =========================================
   MODERN ERP / DASHBOARD UI
   TEMA DIFERENCIADO: MORADO / NEGRO
========================================= */

:root {
    /* ===== COLORES PRINCIPALES ===== */
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --primary-hover: #6d28d9;
    --secondary: #111827;
    --success: #10b981;

    /* ===== BACKGROUNDS ===== */
    --bg-main: #f5f3ff;
    --bg-sidebar: #1f1235;
    --bg-card: #ffffff;
    --bg-hover: rgba(124, 58, 237, 0.18);

    /* ===== TEXT ===== */
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #ffffff;

    /* ===== BORDERS ===== */
    --border-color: #ddd6fe;

    /* ===== SHADOWS ===== */
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.10);

    --radius: 18px;
}

/* =========================================
   GLOBAL
========================================= */

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 {
    color: var(--text-main);
    font-weight: 700;
}

a {
    text-decoration: none;
}

/* =========================================
   PAGE TITLES
========================================= */

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.3rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* =========================================
   MAIN CONTENT
========================================= */

.main-content-area {
    background: var(--bg-main);
    min-height: 100vh;
    padding: 2rem;
}

/* =========================================
   SIDEBAR
========================================= */

.bg-dark,
.offcanvas,
.offcanvas-lg,
.sidebar {
    background: var(--bg-sidebar) !important;
    border-right: 1px solid rgba(255,255,255,0.08);
}

/* =========================================
   SIDEBAR BRAND
========================================= */

.sidebar-title,
.offcanvas-title,
.logo-text,
.sidebar-brand,
.sidebar-brand h4,
.sidebar-brand h5 {
    color: #ffffff !important;
}

/* =========================================
   SUCURSAL BOX
========================================= */

.card-sucursal,
.sucursal-box {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #ffffff;
    border-radius: 18px;
    backdrop-filter: blur(8px);
}

/* =========================================
   MENU
========================================= */

.boutique-menu .nav-link {
    color: #ffffff;
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 8px;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    font-weight: 600;
}

.boutique-menu .nav-link i {
    margin-right: 8px;
}

.boutique-menu .nav-link:hover {
    background: var(--bg-hover);
    color: #ffffff;
    transform: translateX(4px);
}

.boutique-menu .nav-link.active {
    background: var(--primary);
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(124,58,237,0.35);
}

/* =========================================
   TPV BUTTON
========================================= */

.boutique-menu .nav-link.active-tpv {
    background: #f97316 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(249,115,22,0.35);
}

/* =========================================
   KPI CARDS
========================================= */

.kpi-card {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 1.4rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 120px;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.kpi-card::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--kpi-bg, rgba(124,58,237,0.08));
}

.kpi-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kpi-bg, rgba(124,58,237,0.1));
    color: var(--kpi-color, var(--primary));
    font-size: 1.5rem;
    flex-shrink: 0;
    z-index: 1;
}

.kpi-icon-wrap i {
    transition: all .3s ease;
}

.kpi-card:hover .kpi-icon-wrap i {
    transform: scale(1.15);
}

.kpi-data {
    z-index: 1;
    width: 100%;
    overflow: hidden;
}

.kpi-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* =========================================
   CARDS
========================================= */

.glass-card,
.widget-card,
.card {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.glass-card:hover,
.widget-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 1.5rem;
}

.card-title-modern {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    margin: 0;
}

/* =========================================
   BUTTONS
========================================= */

.btn {
    border-radius: 12px;
    font-weight: 600;
    transition: all .2s ease;
}

.btn-primary,
.bg-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(124,58,237,0.25);
}

.btn-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(16,185,129,0.25);
}

.text-primary {
    color: var(--primary) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

/* =========================================
   TABLES
========================================= */

.table {
    border-radius: 16px;
    overflow: hidden;
}

.table thead {
    background: #ede9fe;
}

.table th {
    border-bottom: 1px solid var(--border-color);
    color: #312e81;
    font-size: 0.85rem;
    font-weight: 700;
}

.table td {
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table-hover tbody tr:hover {
    background: #f5f3ff;
}

/* =========================================
   FORM CONTROLS
========================================= */

.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 0.7rem 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(124,58,237,0.15);
}

/* =========================================
   BADGES
========================================= */

.badge {
    border-radius: 999px;
    padding: 0.5em 0.8em;
    font-weight: 600;
}

/* =========================================
   CHARTS
========================================= */

.chart-container-line {
    position: relative;
    height: 350px;
}

.chart-container-doughnut {
    position: relative;
    height: 300px;
}

/* =========================================
   NAVBAR MOBILE
========================================= */

.navbar-mobile,
.navbar-dark {
    background: var(--bg-sidebar) !important;
}

/* =========================================
   SELECT2
========================================= */

.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    height: 38px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #212529 !important;
    line-height: 38px !important;
    padding-left: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
}

.select2-dropdown {
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
}
/* FIX MODALES BLOQUEADOS */
.modal {
    z-index: 1000000 !important;
}

.modal-dialog {
    z-index: 1000001 !important;
}

.modal-backdrop {
    z-index: 999990 !important;
}

#mainSidebar,
#sidebarMenu {
    z-index: 1040 !important;
}

#pageLoaderOverlay {
    z-index: 999998 !important;
}

/* =========================================
   RESPONSIVE
========================================= */

@media (min-width: 992px) {
    .offcanvas-lg {
        position: fixed !important;
        top: 0;
    }

    .main-content-area {
        margin-left: 260px;
        width: calc(100% - 260px);
    }
}

@media (max-width: 991px) {
    body {
        padding-left: 0 !important;
    }

    .main-content-area {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .kpi-card {
        padding: 1.1rem;
    }

    .chart-container-line {
        height: 280px;
    }

    .chart-container-doughnut {
        height: 260px;
    }
}
