/* ==========================================================================
   SISTEMA DE DISEÑO & TOKENS - APPZULED
   ========================================================================== */

:root {
    /* Colores corporativos AppZuled basados en Logo_Zuled_Solo.png */
    --primary-color: #3954A1;       /* Azul original del logo */
    --secondary-color: #1E2C5B;     /* Deep Navy Blue para sidebar */
    --accent-blue: #3954A1;         /* Azul original del logo para foco/botones */
    --accent-blue-hover: #2E4483;   /* Variación hover del azul */
    --bg-light: #ECEAE3;            /* Gris claro / Warm off-white del logo */
    --bg-inner: #F7F6F2;            /* Fondo suave de tarjetas (Warm Off-White) */
    --text-dark: #2D3246;           /* Slate Charcoal para tipografía legible */
    --text-muted: #64748b;          /* Texto secundario */
    --border-color: #e2e8f0;        /* Color de bordes */
    
    /* Bordes y Sombras */
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --shadow-premium: 0 10px 30px -10px rgba(17, 46, 81, 0.08), 0 1px 3px rgba(17, 46, 81, 0.02);
    --shadow-hover: 0 20px 40px -15px rgba(17, 46, 81, 0.15);
    
    /* Fuentes */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ==========================================================================
   RESET & TIPOGRAFÍA GLOBAL
   ========================================================================== */

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

body {
    font-family: var(--font-body);
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.5;
    background-color: var(--bg-light);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* ==========================================================================
   DISEÑO DE VISTAS DE AUTENTICACIÓN (LOGIN)
   ========================================================================== */

.auth-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
}

.auth-page-wrapper {
    background: radial-gradient(circle at top right, rgba(24, 123, 245, 0.15), transparent 400px);
}

.auth-card {
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 900px;
    display: flex;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Columna gráfica derecha */
.auth-graphic-column {
    background: linear-gradient(135deg, #112e51 0%, #187bf5 100%);
    position: relative;
    overflow: hidden;
}

.auth-graphic-column::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.auth-graphic-content {
    max-width: 340px;
    z-index: 2;
}

.glass-widget {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
}

/* Controles de formulario personalizados */
.input-group-custom {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 0.9rem;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.input-group-custom:focus-within {
    border-color: var(--accent-blue);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(24, 123, 245, 0.15);
}

.input-icon {
    color: var(--text-muted);
    margin-right: 0.75rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.form-control-custom {
    border: none;
    background: transparent;
    padding: 0;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.form-control-custom::placeholder {
    color: #94a3b8;
}

/* Checkbox personalizado */
.form-check-input-custom {
    width: 1.1em;
    height: 1.1em;
    margin-top: 0.2em;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
}

.form-check-input-custom:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.btn-primary-custom {
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary-custom:hover {
    background-color: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

.icon-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.bg-white-10 {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   DISEÑO DE ESTRUCTURA DEL DASHBOARD (HOME)
   ========================================================================== */

.dashboard-body {
    background-color: var(--bg-inner);
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar Estilo web_design.jpg */
.app-sidebar {
    width: 260px;
    background-color: var(--secondary-color);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-left: 0.5rem;
}

.brand-logo {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #00d2ff 100%);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Perfil de Usuario en Sidebar */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-md);
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar-wrapper {
    position: relative;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px stroke rgba(255, 255, 255, 0.1);
}

.user-status-indicator {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    bottom: 2px;
    right: 2px;
    border: 2px solid var(--secondary-color);
}

.user-status-indicator.online {
    background-color: #22c55e;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
}

/* Menú de Navegación */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: auto;
}

.menu-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.menu-item i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    color: #ffffff;
    background-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(24, 123, 245, 0.3);
}

/* Widget en el Sidebar */
.sidebar-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 2rem;
}

.card-stat-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.progress-dark {
    background-color: rgba(255, 255, 255, 0.08);
}

.progress-bar-accent {
    background-color: var(--accent-blue);
}

.card-stat-sub {
    font-size: 0.75rem;
}

/* Contenedor Principal de la App */
.app-main-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0; /* Evita que rompan elementos anchos */
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Cuerpo principal del contenido */
.app-content-body {
    flex-grow: 1;
    width: 100%;
    min-width: 0;
}

/* Cabecera Superior */
.app-header {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: #f8fafc;
    color: var(--text-dark);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    margin-left: 0.25rem;
}

.btn-icon-sm:hover {
    background-color: var(--accent-blue-hover);
    color: #ffffff;
    border-color: var(--accent-blue-hover);
}

.sidebar-toggle-btn {
    border: none;
    color: var(--text-dark);
    font-size: 1.1rem;
}

/* Caja de búsqueda del header */
.header-search {
    display: flex;
    align-items: center;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.45rem 0.85rem;
    width: 100%;
    max-width: 380px;
    margin-left: 1rem;
}

.header-search i {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.header-search input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.85rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.header-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
}

.dropdown-toggle-no-caret::after {
    display: none;
}

.profile-dropdown-trigger {
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: background-color 0.2s ease;
}

.profile-dropdown-trigger:hover {
    background-color: #f8fafc;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-md {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-trigger-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* ==========================================================================
   COMPONENTES DEL DASHBOARD (TARJETAS KPI & TABLAS)
   ========================================================================== */

.dashboard-kpi-card {
    border-radius: var(--border-radius-md);
    transition: all 0.3s ease;
    border: 1px solid rgba(17, 46, 81, 0.03);
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    line-height: 1.2;
    margin-top: 0.15rem;
}

.badge-custom {
    padding: 0.35em 0.75em;
    font-weight: 500;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* Tablas personalizadas */
.custom-table {
    margin-bottom: 0;
}

.custom-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 1rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}

.card {
    border-radius: var(--border-radius-md);
}

/* ==========================================================================
   RESPONSIVIDAD Y COLLAPSE
   ========================================================================== */

/* Colapsar el sidebar en pantallas grandes */
@media (min-width: 992px) {
    .app-container.sidebar-collapsed .app-sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
    }
}

/* Menú móvil */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        height: 100vh;
        left: -260px;
        top: 0;
        z-index: 1040;
        box-shadow: var(--shadow-premium);
    }
    
    .app-container.sidebar-open .app-sidebar {
        left: 0;
    }
    
    .app-container.sidebar-collapsed .app-sidebar {
        left: -260px;
        margin-left: 0;
    }

    /* Overlay semi-transparente cuando el sidebar está abierto */
    .app-container.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 1030;
    }
}

/* Soporte para espacios en movil */
@media (max-width: 767.98px) {
    .app-header {
        padding: 0 0.85rem;
    }
    .app-content-body {
        padding: 0.85rem !important;
        min-width: 0 !important;
    }
    .header-actions .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* Submenu en Sidebar (Inventario) */
.submenu-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 0.45rem 1rem;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.825rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.submenu-item i {
    font-size: 0.55rem;
    width: 14px;
    opacity: 0.7;
}

.submenu-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.submenu-item.active {
    color: var(--accent-blue);
    font-weight: 600;
}

/* Animación y Rotación de Flechas de Submenú */
.menu-item[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.submenu-arrow {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

/* ==========================================================================
   MODO KIOSCO (CONSULTA DE PRECIO)
   ========================================================================== */

body.kiosk-mode {
    background-color: #f8fafc;
}

body.kiosk-mode .app-sidebar,
body.kiosk-mode .app-header,
body.kiosk-mode #kiosk-toggle-container {
    display: none !important;
}

body.kiosk-mode .app-main-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
}

body.kiosk-mode .app-content-body {
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

body.kiosk-mode .kiosk-card {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

body.kiosk-mode .kiosk-title {
    font-size: 1.9rem;
}

body.kiosk-mode .kiosk-input-group input {
    height: 60px;
    font-size: 1.5rem !important;
}

body.kiosk-mode .kiosk-input-group button {
    font-size: 1.15rem;
}

@media (max-width: 768px) {
    .kiosk-title {
        font-size: 1.5rem !important;
    }
    body.kiosk-mode .kiosk-title {
        font-size: 2rem !important;
    }
    body.kiosk-mode .display-5 {
        font-size: 2.5rem;
    }
    body.kiosk-mode .display-4 {
        font-size: 2rem;
    }
    
    /* Separar campo de texto de los botones en móvil (tanto en modo normal como en modo Kiosco) */
    .kiosk-input-group {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .kiosk-input-group > .input-group-text {
        display: none !important;
    }
    
    .kiosk-input-group > input.form-control {
        grid-column: 1 / 3;
        width: 100% !important;
        border-radius: var(--border-radius-sm) !important;
        border: 1px solid var(--border-color) !important;
        padding: 0.75rem !important;
        height: 52px;
        font-size: 1.1rem !important;
    }
    
    .kiosk-input-group > button {
        width: 100% !important;
        border-radius: var(--border-radius-sm) !important;
        margin: 0 !important;
        height: 44px;
        font-size: 0.85rem !important;
    }

    .kiosk-input-group > #btn_buscar {
        grid-column: 1 / 3;
    }
}

/* ==========================================================================
   ESTILO GLOBAL DE BOTONES (TAMAÑO COMPACTO)
   ========================================================================== */
.btn {
    font-size: 0.85rem !important;
}

