/* Estilos generales */
body {
    font-size: 0.9rem;
    padding-top: 0;
    margin: 0;
}

/* Fix scroll para modales anidados y Select2 */
.modal.show .modal-dialog {
  overflow-y: auto !important;
  max-height: 90vh;
}


/* ===== Tablas uniformes y legibles ===== */
table,
table th,
table td {
    font-size: 1rem !important;
    left: 0;
    bottom: 0;
    z-index: 1030;
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
    padding-top: 56px; /* Ajuste para navbar */
}

/* Contenido principal */
.content-wrapper {
    margin-left: 250px;
    min-height: 100vh;
    transition: margin-left 0.3s ease-in-out;
    padding-top: 56px; /* Ajuste para navbar */
}

/* Sidebar colapsado */
.sidebar-collapse .main-sidebar {
    transform: translateX(-250px);
}

.sidebar-collapse .content-wrapper {
    margin-left: 0;
}

/* Sidebar sticky */
.sidebar-sticky {
    position: relative;
    height: calc(100vh - 56px);
    padding-top: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Usuario en sidebar */
.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Navbar brand */

/* ===== Carousel Controls para solicitudes ===== */
.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: none;
    background-image: none;
    /* Fondo personalizado usando SVG negro */
}
.carousel-control-prev-icon {
    background-image: url("data:image/svg+xml;charset=utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='black' fill-opacity='0.7' viewBox='0 0 8 8'><path d='M5.5 1L2.5 4l3 3'/></svg>");
}
.carousel-control-next-icon {
    background-image: url("data:image/svg+xml;charset=utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='black' fill-opacity='0.7' viewBox='0 0 8 8'><path d='M2.5 1l3 3-3 3'/></svg>");
}

.navbar-brand {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.25);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25);
}

/* Estilos para archivos adjuntos */
#attachments-section {
    margin: 0 0 2rem 0;
    position: relative;
    z-index: 1;
}

#attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

#attachments-list li {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    position: relative;
}

#attachments-list li:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.attachment-preview {
    text-align: center;
    margin-bottom: 0.75rem;
}

.attachment-preview img {
    max-width: 100%;
    max-height: 150px;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
}

.attachment-info {
    text-align: center;
    padding: 0.5rem 0;
}

.attachment-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.attachment-file {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.attachment-file i {
    font-size: 2.5rem;
    color: #6c757d;
}

.attachment-file.pdf i {
    color: #dc3545;
}

.attachment-file img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.attachment-filename {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: #333;
    margin-top: 0.5rem;
}

.delete-file {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.delete-file:hover {
    opacity: 1;
    transform: scale(1.1);
}

#file-size-error {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    #attachments-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 767px) {
    #attachments-list {
        grid-template-columns: 1fr;
    }
}

/* Formularios en navbar */
.navbar .form-control {
    padding: 0.75rem 1rem;
    border-width: 0;
    border-radius: 0;
}

.form-control-dark {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

.form-control-dark:focus {
    border-color: transparent;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* Cards */
.card {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.card-text.display-4 {
    font-size: 2.5rem;
    font-weight: 300;
}

/* Tablas */
.table th, 
.table td {
    padding: 0.5rem;
    vertical-align: middle;
}

/* Estilos para la búsqueda de productos */
.product-search-results {
    position: absolute;
    z-index: 1050;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 2px;
}

.product-search-results .list-group-item {
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.product-search-results .list-group-item:first-child {
    border-top: none;
}

.product-search-results .list-group-item:last-child {
    border-bottom: none;
}

.product-search-results .list-group-item:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Asegurar que el campo de búsqueda sea clickeable */
.product-search {
    cursor: text;
}

/* Mejorar la apariencia de los botones de limpiar */
.btn-clear-search {
    border-top-right-radius: 0.25rem !important;
    border-bottom-right-radius: 0.25rem !important;
}

/* Ajustar el ancho de las columnas de la tabla */
#requestItemsTable th:nth-child(1),
#requestItemsTable td:nth-child(1) {
    width: 5%;
}

#requestItemsTable th:nth-child(2),
#requestItemsTable td:nth-child(2) {
    width: 20%;
}

#requestItemsTable th:nth-child(n+3):nth-child(-n+9),
#requestItemsTable td:nth-child(n+3):nth-child(-n+9) {
    width: 9%;
}

#requestItemsTable th:last-child,
#requestItemsTable td:last-child {
    width: 8%;
}

.table thead th {
    border-bottom-width: 1px;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Formularios */
.form-group label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Alertas */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

/* Botones */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Footer */
.main-footer {
    margin-left: 250px;
    width: calc(100% - 250px);
    transition: margin-left 0.3s ease-in-out;
}

.sidebar-collapse .main-footer {
    margin-left: 0;
    width: 100%;
}

/* Responsive */
@media (max-width: 767.98px) {
    .main-sidebar {
        transform: translateX(-250px);
    }
    
    .sidebar-open .main-sidebar {
        transform: translateX(0);
    }
    
    .content-wrapper,
    .main-footer {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .sidebar {
        position: fixed;
        height: 100vh;
    }
    
    .sidebar-sticky {
        height: calc(100vh - 56px);
    }
    
    .navbar-brand {
        padding: 0.5rem 1rem;
    }
}