/* 
 * MalenaApp - Estilos Globales
 * Encomienda al Señor tus obras, y tus planes se cumplirán -Prov 16:3
 */

/* Variables de colores */
:root {
    --primary-color: #3f61de;
    --primary-dark: #2a4cb8;
    --primary-light: #657fe0;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --body-bg: #f7f9fc;
    --card-bg: #ffffff;
}

/* Estilos Generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg) !important;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Mejorar visibilidad de menús desplegables */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

.dropdown-item {
    color: #212529 !important;
    font-weight: 500 !important;
}

.dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #155724 !important;
}

html {
    background-color: var(--body-bg) !important;
}

/* Estilos específicos para Resumen de Despacho */
.dispatch-summary-row {
    background-color: #f8f9fa !important;
    visibility: visible !important;
    display: table-row !important;
    opacity: 1 !important;
    z-index: 999 !important;
}

.dispatch-summary-row td {
    padding: 12px !important;
    border: none !important;
    vertical-align: middle !important;
}

.dispatch-summary-boxes {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.dispatch-box {
    padding: 8px 12px !important;
    border-radius: 4px !important;
    font-weight: bold !important;
    color: white !important;
    min-width: 100px !important;
    text-align: center !important;
}

.dispatch-box-primary {
    background-color: #0d6efd !important;
}

.dispatch-box-success {
    background-color: #198754 !important;
}

.navbar {
    background-color: var(--card-bg) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e3e6f0;
}

.navbar-nav .nav-link {
    color: #5a5c69 !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    font-size: 0.875rem; /* Ajustado: 13.6px + 0.4px = 14px */
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.dropdown-menu {
    border: 0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
    border-radius: 0.35rem;
}

/* Sidebar fijo en el lado izquierdo */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background-color: #343a40;
    color: white;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 20px;
    background-color: #2c3034;
    border-bottom: 1px solid #495057;
}

.sidebar-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid #495057;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-menu li a i {
    width: 20px;
    margin-right: 10px;
}

/* Ajustar el contenido principal */
.main-content {
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
}

/* Mejoras para el navbar toggler */
.navbar-toggler {
    border: 2px solid #fff !important;
    background-color: transparent !important;
    padding: 4px 8px !important;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25) !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Responsive - Mejoras para móviles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block !important;
    }
    
    /* Mejorar navbar en móviles */
    .navbar-collapse {
        background-color: var(--card-bg) !important;
        border-radius: 8px;
        margin-top: 10px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
    
    .navbar-nav {
        width: 100% !important;
    }
    
    .navbar-nav .nav-item {
        width: 100% !important;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 20px !important;
        border-bottom: 1px solid #f1f3f4;
    }
    
    .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0 !important;
        background-color: #f8f9fa !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .dropdown-item {
        padding: 10px 30px !important;
    }
    
    /* Mejoras específicas para la página moderno en móviles */
    .filter-card {
        padding: 15px !important;
    }
    
    .filter-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    
    .filter-controls .btn-group {
        width: 100% !important;
    }
    
    .filter-controls .btn-group .btn {
        flex: 1 !important;
        font-size: 0.85rem !important;
        padding: 8px 4px !important;
    }
    
    .custom-date-range {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .custom-date-range input {
        width: 100% !important;
    }
    
    .year-selector {
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }
    
    .kpi-card {
        margin-bottom: 15px !important;
    }
    
    .gradient-header .d-flex {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .gradient-header .text-end {
        text-align: center !important;
        margin-top: 15px !important;
    }
}

/* Mejoras adicionales para dispositivos muy pequeños */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.9rem !important;
    }
    
    .navbar-brand img {
        height: 24px !important;
        margin-right: 4px !important;
    }
    
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .filter-controls .btn-group .btn {
        font-size: 0.75rem !important;
        padding: 6px 2px !important;
    }
    
    .kpi-value {
        font-size: 1.2rem !important;
    }
    
    .kpi-label {
        font-size: 0.8rem !important;
    }
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
}

/* Pie del sidebar para usuario */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #2c3034;
    padding: 15px 20px;
    border-top: 1px solid #495057;
}

.user-info {
    color: #adb5bd;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.user-info i {
    margin-right: 8px;
}

.logout-btn {
    display: block;
    color: #dc3545 !important;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.logout-btn:hover {
    color: #ff6b6b !important;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn {
    border-radius: 5px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--light-color);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

/* Navbar personalizada */
.navbar {
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: rgba(255, 255, 255, 1);
}

.navbar-dark .navbar-nav .active > .nav-link,
.navbar-dark .navbar-nav .nav-link.active {
    color: white;
    font-weight: 600;
}

/* Estilos personalizados para tablas */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
}

.table th, .table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Paginación personalizada */
.pagination .page-link {
    position: relative;
    display: block;
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid #dee2e6;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.pagination .page-link:hover {
    color: var(--primary-dark);
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Tooltips personalizados */
.product-tooltip-section {
    min-width: 250px;
}

.product-tooltip-title {
    font-weight: 600;
    color: #ffffff;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.product-tooltip-label {
    font-weight: 500;
    color: #e9ecef;
}

.product-tooltip-value {
    font-weight: 600;
    color: #ffffff;
}

.stock-critical {
    color: #f8d7da;
    margin-top: 8px;
    font-weight: 500;
}

.badge-animated {
    position: relative;
    display: inline-block;
}

.info-icon {
    opacity: 0.6;
}

.badge-animated:hover .info-icon {
    opacity: 1;
}

/* Estilos para productos populares */
.trending-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
}

.trending-icon {
    margin-right: 0.25rem;
    font-size: 0.875rem;
}

.trending-row {
    background-color: rgba(220, 53, 69, 0.05);
}

.trending-product {
    border: 1px solid rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.trending-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.15);
}

.related-product-card {
    transition: all 0.3s ease;
}

.related-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Modificadores para clases de animate.css */
.animate__pulse {
    animation-duration: 2s;
}

.animate__infinite {
    animation-iteration-count: infinite;
}

.animate__fadeIn {
    animation-duration: 1.5s;
}

/* Estilos para clasificación de clientes */
.cliente-premium {
    background-color: rgba(218, 165, 32, 0.2);
    border-left: 4px solid gold;
}

.cliente-frecuente {
    background-color: rgba(0, 123, 255, 0.05);
    border-left: 4px solid #007bff;
}

.cliente-regular {
    background-color: rgba(40, 167, 69, 0.05);
    border-left: 4px solid #28a745;
}

.cliente-nuevo {
    background-color: rgba(108, 117, 125, 0.05);
    border-left: 4px solid #6c757d;
}

/* Estilos para formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(63, 97, 222, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* Estilos para página de error */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--dark-color);
}

/* Responsive */
@media (max-width: 768px) {
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .table th, .table td {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
    }
    
    /* Barra de herramientas responsiva para página moderno */
    .btn-toolbar {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .btn-group {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .btn-group .btn {
        flex: 1 !important;
        min-width: auto !important;
        white-space: nowrap !important;
    }
    
    /* Filtros responsivos para moderno */
    .filter-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    
    .filter-controls .btn-group {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    .filter-controls .btn-group .btn {
        flex: 1 !important;
        font-size: 0.875rem !important;
        padding: 8px 4px !important;
    }
    
    .custom-date-range {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .custom-date-range input {
        width: 100% !important;
    }
    
    .year-selector {
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }
    
    .filter-status {
        text-align: center !important;
        margin-top: 10px !important;
    }
}

/* Estilos específicos para móviles muy pequeños */
@media (max-width: 576px) {
    /* Header responsive en moderno */
    .d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    /* Barra de herramientas en móviles pequeños */
    .btn-toolbar {
        order: 2 !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    .btn-group {
        width: 100% !important;
        margin-right: 0 !important;
    }
    
    .btn-group .btn {
        font-size: 0.875rem !important;
        padding: 10px 8px !important;
        flex: 1 !important;
    }
    
    /* Título h2 responsive */
    .h2 {
        font-size: 1.5rem !important;
        order: 1 !important;
        margin-bottom: 0 !important;
    }
    
    /* Filtros en móviles pequeños */
    .filter-group {
        margin-bottom: 15px !important;
        text-align: center !important;
    }
    
    .filter-controls .btn-group .btn {
        font-size: 0.75rem !important;
        padding: 6px 2px !important;
    }
    
    /* Ocultar elementos no esenciales en móviles */
    .filter-status small {
        font-size: 0.75rem !important;
    }
    
    /* Mejorar espaciado general */
    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .card {
        margin-bottom: 15px !important;
    }
    
    /* Asegurar visibilidad de controles */
    .btn-toolbar, .filter-controls, .btn-group {
        visibility: visible !important;
        display: flex !important;
        opacity: 1 !important;
    }
}