/* css/style.css */
:root {
    --primary: #007bff;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
}



body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
}

.sidebar .nav-link.active {
    color: var(--primary);
    background-color: #e9ecef;
    border-left-color: var(--primary);
}

.sidebar .nav-link:hover {
    color: var(--primary);
    background-color: #f8f9fa;
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
}

.main-content {
    margin-left: 0px;
}

/* Tarjetas personalizadas */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
}

/* Tablas */
.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark);
    background-color: #f8f9fa;
}

.table td {
    vertical-align: middle;
}

/* Botones */
.btn {
    border-radius: 0.35rem;
    font-weight: 500;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Formularios */
.form-control {
    border-radius: 0.35rem;
    border: 1px solid #d1d3e2;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Select2 personalizado */
.select2-container--default .select2-selection--single {
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem);
}

/* DataTables */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 0.35rem !important;
    margin: 0 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        padding: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alertas personalizadas */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* Colores de stock */
.stock-low {
    color: var(--danger);
    font-weight: bold;
}

.stock-warning {
    color: var(--warning);
    font-weight: bold;
}

.stock-normal {
    color: var(--success);
}

/* Gráficos */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Header fijo */
.fixed-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 240px;
    z-index: 1030;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

@media (max-width: 768px) {
    .fixed-header {
        left: 0;
    }
}
/* Estilos para loading y mejoras de accesibilidad */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mejoras de accesibilidad para formularios */
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Estilos para invalid feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4'/%3e%3cpath d='M6 7v1'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Tooltips vanilla */
.vanilla-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none;
    max-width: 200px;
    word-wrap: break-word;
}
/* Estilos para el layout principal */
.sidebar-wrapper {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1030;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Toast notifications */
.toast {
    z-index: 9999;
}

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 56px;
    --transition-speed: 0.3s;
}




body {
    padding-top: var(--header-height);
    background-color: #f8f9fa;
    overflow-x: hidden;
    transition: padding-left var(--transition-speed) ease;
    position: relative;
    min-height: 100vh;
}

/* Header fijo */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--header-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: left var(--transition-speed) ease;
}

/* Sidebar fijo */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 1020;
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
    overflow-y: auto;
    background: #fff;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
}


        /* Header fijo */
        .navbar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1030;
            height: var(--header-height);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: left var(--transition-speed) ease;
        }
        
        /* Sidebar fijo */
        .sidebar {
            position: fixed;
            top: var(--header-height);
            left: 0;
            bottom: 0;
            width: var(--sidebar-width);
            z-index: 1020;
            transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
            overflow-y: auto;
        }
        
        .sidebar-collapsed {
            width: var(--sidebar-collapsed-width);
        }
        


/* Contenido principal - Ahora se ajusta dinámicamente */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 10px;
    padding-top: 0px;
    transition: margin-left var(--transition-speed) ease;
    min-height: calc(100vh - var(--header-height));
}

/* CAMBIO AQUÍ: Usar body.sidebar-collapsed en lugar del selector + */
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}



        /* Contenido Principal */


        .sidebar-collapsed .main-content {
            /*margin-left:0px; /*-sidebar-collapsed);*/
             /*width: 100%;*/
             margin-left: var(--sidebar-collapsed-width);
            width: 100%;
        }



        
/* Reducir espacios internos */
.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.75rem !important;
}

.row.mb-3 {
    margin-bottom: 0.5rem !important;
}

.card {
    margin-bottom: 10px;
}

.card-body {
    padding: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    
    .sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 8px 10px;
        padding-bottom: 60px;

    body.sidebar-collapsed .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    }
    
    .navbar {
        left: 0 !important;
    }
    
    .card-body {
        padding: 0.5rem;
    }
}

/* Estilos específicos para productos */
.table th {
    background-color: #f8f9fa;
    border-top: none;
}

.stock-low {
    color: #dc3545;
    font-weight: bold;
}

.stock-warning {
    color: #ffc107;
    font-weight: bold;
}

/* Estilos para DataTables */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 8px 0;
    padding: 3px 0;
}

/* Footer ajustado */
.main-footer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width);
    background: #f8f9fa;
    padding: 5px 15px;
    border-top: 1px solid #dee2e6;
    transition: left var(--transition-speed) ease;
    z-index: 1000;
}

.sidebar-collapsed ~ .main-footer {
    left: var(--sidebar-collapsed-width);
}

@media (max-width: 768px) {
    .main-footer {
        left: 0 !important;
        padding: 5px 10px;
    }
}

/* Estilos para imágenes de productos */
.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.product-image:hover {
    transform: scale(1.1);
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview {
    position: relative;
    width: 100px;
    height: 100px;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.image-preview .remove-image {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Mejoras para móviles */
@media (max-width: 576px) {
    .main-content {
        padding: 5px 8px;
        padding-bottom: 50px;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .image-preview {
        width: 80px;
        height: 80px;
    }
}

/* Modal de galería de imágenes */
.image-gallery-modal .modal-body {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.gallery-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-image:hover {
    transform: scale(1.05);
}

