/* assets/css/style.css */

/* Estilos generales */
:root {
    --primary-color: #155724;
    --secondary-color: #95c11f;
    --accent-color: #5cb85c;
    --light-bg: #f8f9fa;
    --dark-bg: #1c2331;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

/* Estilos del sidebar mejorado */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    width: var(--sidebar-width);
    transition: all 0.3s;
    overflow-y: auto; /* Permite scroll si el contenido es más largo que la pantalla */
    max-height: 100vh; /* Limita la altura al 100% de la ventana */
}

.sidebar-logo {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-logo-img {
    max-height: 50px; /* Reducir el tamaño del logo */
    max-width: 100%;
}

.sidebar .nav-link {
    padding: 0.5rem 1rem; /* Reducir el padding vertical */
    font-size: 0.9rem; /* Reducir el tamaño de fuente */
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.2s;
    border-radius: 0;
}

.sidebar .nav-link:hover {
    background-color: rgba(0, 128, 0, 0.05);
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(0, 128, 0, 0.1);
    border-left: 3px solid var(--primary-color);
}

/* Estilos para los submenús */
.sidebar .collapse .nav-link {
    padding-left: 1rem;
    font-size: 0.85rem;
    border-left: none; /* Quitar borde izquierdo para submenús */
}

.sidebar .collapse .nav-link.active {
    background-color: rgba(0, 128, 0, 0.05);
    border-left: none;
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar .collapse .nav-link:hover {
    background-color: rgba(0, 128, 0, 0.1);
}

/* Estilos para los íconos */
.sidebar .nav-link i {
    min-width: 1.5rem; /* Ancho fijo para íconos para alineación */
    text-align: center;
    transition: all 0.2s;
}

.sidebar .nav-link:hover i {
    transform: translateX(2px);
}

/* Estilos para dropdown */
.sidebar .nav-link.dropdown-toggle::after {
    margin-left: auto; /* Mover la flecha a la derecha */
}

/* Estilos para enlaces colapsados */
.sidebar .collapse {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Modo compacto opcional (activado con JavaScript) */
.sidebar.compact {
    width: 60px; /* Ancho reducido en modo compacto */
}

.sidebar.compact .nav-link span, 
.sidebar.compact .nav-link.dropdown-toggle::after {
    display: none; /* Ocultar texto y flechas en modo compacto */
}

.sidebar.compact .nav-link i {
    font-size: 1.25rem; /* Íconos más grandes en modo compacto */
    margin: 0 auto; /* Centrar íconos */
}

.sidebar.compact .collapse {
    position: absolute;
    left: 60px;
    top: 0;
    width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    background-color: #f8f9fa;
    z-index: 1000;
}

.sidebar.compact .collapse .nav-link span {
    display: inline; /* Mostrar texto en submenús incluso en modo compacto */
}

/* Botón para alternar modo compacto */
.toggle-sidebar-btn {
    position: fixed;
    bottom: 20px;
    left: calc(var(--sidebar-width) - 20px);
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: none;
    transition: all 0.3s;
}

.toggle-sidebar-btn:hover {
    background-color: #0e3e19;
}

.sidebar.compact .toggle-sidebar-btn {
    left: 40px;
}

/* Estilos del contenido principal */
main {
    margin-left: var(--sidebar-width);
    padding: 1rem;
    transition: all 0.3s;
}

/* Modo responsivo */
@media (max-width: 768px) {
    main {
        margin-left: 0;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        max-height: none;
    }
    
    .sidebar.compact {
        width: 100%;
    }
    
    .sidebar.compact .nav-link span, 
    .sidebar.compact .nav-link.dropdown-toggle::after {
        display: inline-block;
    }
    
    .sidebar.compact .collapse {
        position: static;
        box-shadow: none;
        width: 100%;
    }
    
    .toggle-sidebar-btn {
        display: none; /* Ocultar botón de toggle en móviles */
    }
}

/* Estilos de tarjetas */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s;
}

.card-dashboard {
    border-left: 4px solid var(--accent-color);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Estilos de botones */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0e3e19;
    border-color: #0e3e19;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Estilos de formularios */
.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(92, 184, 92, 0.25);
}

/* Estilos de tablas */
.table th {
    background-color: var(--light-bg);
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: rgba(92, 184, 92, 0.1);
}

/* Estilos para login */
.login-container {
    max-width: 400px;
    margin: 30px auto;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    max-width: 300px;
    margin-bottom: 20px;
}

.login-card {
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 2rem;
}

/* Estilos para notificaciones */
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out forwards;
    background-color: #fff;
    border-left: 5px solid;
}

.notification-popup.success {
    border-left-color: #28a745;
}

.notification-popup.error {
    border-left-color: #dc3545;
}

.notification-popup.warning {
    border-left-color: #ffc107;
}

.notification-popup.info {
    border-left-color: #17a2b8;
}

.notification-icon {
    margin-right: 15px;
}

.notification-content {
    flex-grow: 1;
}

.notification-content h4 {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 600;
}

.notification-content p {
    margin: 0;
    font-size: 14px;
}

.notification-close {
    margin-left: 15px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-close:hover {
    color: #333;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Estilos para los modales de confirmación */
.modal-confirm .modal-header {
    border-bottom: none;
    position: relative;
}

.modal-confirm .modal-content {
    border-radius: 0.5rem;
}

.modal-confirm .modal-footer {
    border-top: none;
}

.modal-confirm .icon-box {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    z-index: 9;
    text-align: center;
    border: 3px solid #f15e5e;
}

.modal-confirm.delete .icon-box {
    border-color: #f15e5e;
}

.modal-confirm.success .icon-box {
    border-color: #28a745;
}

.modal-confirm.warning .icon-box {
    border-color: #ffc107;
}

.modal-confirm .icon-box i {
    color: #f15e5e;
    font-size: 46px;
    display: inline-block;
    margin-top: 13px;
}

.modal-confirm.delete .icon-box i {
    color: #f15e5e;
}

.modal-confirm.success .icon-box i {
    color: #28a745;
}

.modal-confirm.warning .icon-box i {
    color: #ffc107;
}

/* Estilos para las imágenes de insumos */
.insumo-img-container {
    height: 150px;
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #fff;
}

.insumo-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.insumo-img-preview {
    max-height: 200px;
    max-width: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.title {
    padding-left: 10px;
}

/* Estilos para reportes */
.filter-container {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Estilos responsivos */
@media (max-width: 992px) {
    main {
        padding: 0.5rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
}