/* =========================================
   1. VARIABLES GLOBALES & RESET — estilo Kyte
   ================================********* */
:root {
    --primary-color: #00B37E;       /* Verde-turquesa Kyte */
    --primary-color-dark: #00875C;  /* Verde-turquesa oscuro */
    --accent-color: #FFB020;        /* Naranja de acento (alertas, destacados) */
    --bg-body: #F4F7F6;             /* Fondo gris muy claro */
    --bg-card: #ffffff;
    --text-main: #1F2933;
    --text-muted: #6B7785;

    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-pill: 50px;
    --sidebar-width: 260px;
    --bottom-nav-height: 64px;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
}

/* =========================================
   2. ESTRUCTURA DEL LAYOUT (ESCRITORIO)
   ================================********* */
body:not(.login-page) {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-color-dark) 100%) !important;
    box-shadow: 4px 0 15px rgba(0, 179, 126, 0.15);
    color: white;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 1050;
    transition: transform 0.3s ease-in-out;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    overflow-y: auto;
    transition: margin-left 0.3s ease-in-out;
}

/* =========================================
   3. MENÚ, BOTONES, CARDS
   ================================********* */
.kyte-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    padding: 10px 15px;
    transition: all 0.2s ease;
}

.kyte-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white !important;
    transform: translateX(4px);
}

.kyte-nav .nav-link.active {
    background-color: white !important;
    color: var(--primary-color) !important;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.kyte-nav .nav-link i {
    width: 22px;
    text-align: center;
    margin-right: 8px;
}

.card {
    background-color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px -2px rgba(31, 41, 51, 0.06);
    margin-bottom: 20px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: var(--radius-pill);
    padding: 8px 20px;
    font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--primary-color-dark) !important;
    border-color: var(--primary-color-dark) !important;
}

.form-control, .form-select {
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid #DEE3E7;
}

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

.table thead th {
    background-color: #EEF4F2 !important;
    color: var(--text-main) !important;
    border-bottom: 2px solid #E3ECE8;
}

/* Sobrescritura de colores "primary" de Bootstrap */
.bg-primary { background-color: var(--primary-color) !important; }
.text-primary { color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.mobile-header {
    background-color: var(--primary-color) !important;
}

/* =========================================
   3b. TARJETAS DE ACCESO ESTILO KYTE (hub de Finanzas / Pedidos, etc.)
   ================================********* */
.kyte-tile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text-main);
    box-shadow: 0 4px 12px -2px rgba(31, 41, 51, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
}
.kyte-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -4px rgba(31, 41, 51, 0.12);
    color: var(--text-main);
}
.kyte-tile-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(0, 179, 126, 0.12);
    color: var(--primary-color);
}
.kyte-tile-title { font-weight: 700; margin: 0; }
.kyte-tile-desc { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* KPI cards del dashboard / estadística */
.kyte-kpi {
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    background: var(--bg-card);
    box-shadow: 0 4px 12px -2px rgba(31, 41, 51, 0.06);
}
.kyte-kpi .kyte-kpi-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
.kyte-kpi .kyte-kpi-value { font-size: 1.6rem; font-weight: 800; }

/* =========================================
   4. ESTILOS LOGIN
   ================================********* */
body.login-page {
    background-color: #ffffff;
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-layout { display: flex; width: 100%; height: 100%; }
.login-left {
    width: 50%; background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: white; text-align: center; clip-path: ellipse(120% 100% at 0% 50%); z-index: 10;
}
.illustration-icon { font-size: 10rem; margin-bottom: 20px; animation: floatAnimation 4s infinite; }
.login-right { width: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; }
.login-form-container { width: 100%; max-width: 400px; }
.form-control-custom { width: 100%; padding: 15px 20px; border-radius: 50px; background: #F3F6F5; border: 1px solid transparent; }
.btn-login-blue { width: 100%; padding: 15px; background: var(--primary-color); color: white; border-radius: 50px; border: none; margin-top: 10px; }
.btn-login-blue:hover { background: var(--primary-color-dark); }
@keyframes floatAnimation { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }

/* =========================================
   5. BARRA DE NAVEGACIÓN INFERIOR (MÓVIL) — estilo Kyte
   ================================********* */
.kyte-bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-card);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    display: flex;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.kyte-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
}
.kyte-bottom-nav-item i { font-size: 1.25rem; }
.kyte-bottom-nav-item.active { color: var(--primary-color); }

.pb-nav-movil { padding-bottom: 0; }
@media (max-width: 991.98px) {
    .pb-nav-movil { padding-bottom: calc(var(--bottom-nav-height) + 12px); }
}

/* Botón flotante de acción rápida (usado en Vender) */
.kyte-fab {
    position: fixed;
    right: 20px;
    bottom: calc(var(--bottom-nav-height) + 20px);
    z-index: 1025;
    border-radius: 50%;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 6px 16px rgba(0,179,126,0.4);
    border: none;
    font-size: 1.4rem;
}
@media (min-width: 992px) {
    .kyte-fab { bottom: 24px; }
}

/* =========================================
   6. RESPONSIVE (MÓVIL Y TABLET)
   ================================********* */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

@media (max-width: 991.98px) {
    body:not(.login-page) {
        flex-direction: column;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px !important;
        transform: translateX(-100%);
        box-shadow: none;
    }

    #sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 15px rgba(0,0,0,0.3);
    }

    .main-content {
        width: 100%;
        padding: 20px 15px;
        margin-left: 0;
    }

    .login-layout { flex-direction: column; }
    .login-left { width: 100%; min-height: 35vh; clip-path: none; border-radius: 0 0 40px 40px; padding: 20px; }
    .login-right { width: 100%; min-height: 65vh; padding: 20px; }
    .illustration-icon { font-size: 5rem; }
    .login-welcome-title { font-size: 2rem; }
    .login-title { font-size: 2rem; margin-bottom: 20px; }

    .d-flex.justify-content-between,
    .d-flex.justify-content-center.gap-2,
    #capture-controls,
    #preview-controls {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .d-flex.justify-content-between > .btn,
    .d-flex.justify-content-between > a.btn {
        flex-shrink: 0;
    }

    .table-responsive .table {
        margin-bottom: 0;
    }
}