/* public/css/dashboard.css */
:root {
    --sidebar-width: 250px;
    --header-height: 60px;
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* Layout Principal */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--secondary-color), #1a252f);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

/* Logo Styles */
.logo-container {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.logo {
    max-width: 180px;
    height: auto;
    filter: brightness(0) invert(1);
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background-color: #34495e;
    color: white;
    border-left-color: var(--primary-color);
}

.menu-item.active {
    background-color: #2c3e50;
    color: white;
    border-left-color: var(--primary-color);
}

.menu-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Contenido Principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
}

/* Header */
.dashboard-header {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    flex-grow: 1;
}

.header-title h1 {
    color: var(--secondary-color);
    margin: 0;
    font-weight: 600;
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-welcome {
    text-align: right;
}

/* Ocultar el texto "Bienvenido" */
.welcome-text {
    display: none;
}

.user-welcome .user-name {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Botón salir */
.logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Títulos de sección */
.section-title {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid #3498db;
    font-size: 1.5rem;
    text-transform: none;
}

/* Tarjetas de métricas */
.metric-card {
    transition: transform 0.3s, box-shadow 0.3s;
    border-radius: 15px;
    border: none;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.metric-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Actividad reciente */
/* LISTA DE ACTIVIDAD COMPACTA - 2 LÍNEAS */
.activity-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.activity-list::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track {
    background: transparent;
}

.activity-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

.activity-list::-webkit-scrollbar-thumb:hover {
    background-color: #a0aec0;
}

.activity-item {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: #f8fafc;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

/* LÍNEA 1: Número de factura y tipo */
.activity-line-1 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.activity-number {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-type {
    color: #64748b;
    font-size: 0.8rem;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
}

/* LÍNEA 2: Fecha e importe */
.activity-line-2 {
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-date {
    color: #64748b;
    font-size: 0.85rem;
    white-space: nowrap;
}

.activity-amount {
    font-weight: 600;
    color: #059669;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Status en el lado derecho */
.activity-status {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

/* Estados específicos para los badges */
.activity-status.completed {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.activity-status.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.activity-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.activity-status.delivered {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Badge del contador en el header */
.card-header .badge {
    font-size: 0.8rem;
    padding: 6px 10px;
}

/* Spinner de carga */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    color: #475569;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .activity-item {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .activity-status {
        align-self: flex-end;
    }
    
    .activity-line-1,
    .activity-line-2 {
        width: 100%;
        justify-content: space-between;
    }
}

/* Cards generales */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 5px 25px rgba(0,0,0,0.12);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 20px;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h3 {
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.2rem;
}

.card-body {
    padding: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .dashboard-header {
        padding: 15px 20px;
    }
    
    .user-info {
        gap: 10px;
    }
}

/* ESTILOS PARA LA SECCIÓN ENVIADOS */

/* Filtros */
.filters-section .card {
    border: 1px solid #e2e8f0;
}

.filters-section .form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Tarjetas de estadísticas */
.stat-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

/* Tabla de facturas */
.transactions-section .table {
    margin: 0;
}

.transactions-section .table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}

.transactions-section .table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: #f1f5f9;
    font-size: 0.9rem;
}

.transactions-section .table tbody tr {
    transition: all 0.2s ease;
}

.transactions-section .table tbody tr:hover {
    background-color: #f8fafc;
}

/* Estados de la tabla */
.status-badge {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Acciones */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.btn-action:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
}

.btn-action.view {
    color: #3b82f6;
}

.btn-action.download {
    color: #059669;
}

.btn-action.reprocess {
    color: #f59e0b;
}

/* Paginación */
.pagination-section .pagination {
    margin: 0;
}

.pagination .page-link {
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.pagination .page-item.active .page-link {
    background: #3b82f6;
    border-color: #3b82f6;
}

.pagination .page-link:hover {
    color: #1e40af;
    background: #f8fafc;
}

/* Estados de carga y vacío */
#loading-state,
#empty-state {
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
    .filters-section .row {
        gap: 15px;
    }
    
    .filters-section .col-md-3,
    .filters-section .col-md-2 {
        width: 100%;
    }
    
    .transactions-section .table-responsive {
        font-size: 0.8rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-action {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .stats-section .col-md-3 {
        margin-bottom: 15px;
    }
}

/* ============================================
   MEJORAS PARA LA VERSIÓN COMPACTA DE ENVIADOS
============================================= */

/* Header más compacto */
.dashboard-header {
    padding: 12px 25px;
    margin-bottom: 20px;
}

/* Filtros más compactos */
.filters-section .card-body.py-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.filters-section .input-group-sm {
    height: 38px;
}

.filters-section .form-select-sm,
.filters-section .form-control-sm {
    height: 38px;
    font-size: 0.875rem;
}

.filters-section .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Card header más compacto */
.card-header.py-3 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.card-header h5 {
    font-weight: 600;
    color: #374151;
}

/* Separador en el menú sidebar */
.menu-separator {
    height: 1px;
    background: #374151;
    margin: 10px 20px;
    opacity: 0.3;
}

/* Estilo especial para el item de logout */
.logout-menu-item {
    color: #ef4444 !important;
    margin-top: 10px;
}

.logout-menu-item:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #dc2626 !important;
    border-left-color: #ef4444 !important;
}

/* Tabla más compacta */
.transactions-section .table td,
.transactions-section .table th {
    padding: 10px 12px;
    font-size: 0.875rem;
}

/* Acciones más compactas */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-action {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: #f8fafc;
    border-color: #d1d5db;
}

/* Badge más compacto */
.card-header .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* Paginación más compacta */
.pagination-section .pagination {
    margin: 0;
}

.pagination .page-link {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Responsive para versión compacta */
@media (max-width: 768px) {
    .filters-section .row {
        gap: 10px;
    }
    
    .filters-section .col-md-4,
    .filters-section .col-md-3,
    .filters-section .col-md-2 {
        width: 100%;
    }
    
    .transactions-section .table-responsive {
        font-size: 0.8rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 3px;
    }
    
    .btn-action {
        width: 28px;
        height: 28px;
        padding: 3px 6px;
    }
}

/* Estado DELIVERED */
.activity-status.delivered,
.status-badge.status-delivered {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============================================
   MEJORAS COMPACTAS PARA TABLA DE ENVIADOS
   (Modo Tutor-Alumno: Estos estilos optimizan el espacio eliminando elementos innecesarios)
============================================= */

/* HEADER ULTRA COMPACTO - Eliminamos el espacio del "Bienvenido" */
.dashboard-header .header-title {
    display: none; /* Elimina completamente el título de bienvenida */
}

.dashboard-header {
    padding: 8px 20px; /* Reduce el padding vertical */
    margin-bottom: 15px; /* Menor espacio debajo del header */
    min-height: auto; /* Elimina altura mínima forzada */
}

/* REDUCCIÓN DE ESPACIOS ENTRE SECCIONES */
.filters-section {
    margin-bottom: 15px !important; /* Compacta espacio entre filtros y tabla */
}

.filters-section .card {
    margin-bottom: 0; /* Elimina margen extra */
}

/* TABLA ULTRA COMPACTA - Reducimos alturas y paddings */
.transactions-section .table thead th {
    padding: 8px 10px; /* Padding más compacto en cabeceras */
    font-size: 0.75rem; /* Texto más pequeño pero legible */
    background: #f8fafc;
}

.transactions-section .table tbody td {
    padding: 6px 10px; /* Padding mínimo en celdas */
    font-size: 0.8rem; /* Texto compacto pero legible */
    height: 36px; /* Altura fija compacta para filas */
}

/* FILAS ALTERNAS - Mejoramos legibilidad sin ocupar espacio extra */
.transactions-section .table tbody tr:nth-child(even) {
    background-color: #fafbfc; /* Gris muy suave para filas pares */
}

.transactions-section .table tbody tr:nth-child(odd) {
    background-color: #ffffff; /* Blanco para filas impares */
}

.transactions-section .table tbody tr:hover {
    background-color: #f0f7ff !important; /* Azul suave al hover */
}

/* ESTADOS MÁS COMPACTOS */
.status-badge {
    font-size: 0.7rem; /* Texto más pequeño en badges */
    padding: 3px 8px; /* Padding reducido */
    border-radius: 8px; /* Bordes ligeramente más suaves */
}

/* ACCIONES ULTRA COMPACTAS */
.action-buttons {
    display: flex;
    gap: 4px; /* Espacio mínimo entre botones */
}

.btn-action {
    width: 28px; /* Tamaño fijo compacto */
    height: 28px; /* Tamaño fijo compacto */
    padding: 0; /* Sin padding interno */
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 4px; /* Bordes más cuadrados para ahorrar espacio */
    font-size: 0.7rem; /* Iconos más pequeños */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FILTROS COMPACTOS - Reducimos altura de inputs */
.filters-section .input-group-sm {
    height: 34px; /* Altura reducida */
}

.filters-section .form-select-sm,
.filters-section .form-control-sm {
    height: 34px; /* Inputs más compactos */
    font-size: 0.8rem; /* Texto más pequeño */
}

/* CARD HEADER COMPACTO */
.card-header.py-3 {
    padding-top: 0.5rem !important; /* Padding superior reducido */
    padding-bottom: 0.5rem !important; /* Padding inferior reducido */
}

.card-header h5 {
    font-size: 1rem; /* Título más compacto */
    margin: 0; /* Elimina márgenes extra */
}

/* BADGE CONTADOR MÁS PEQUEÑO */
.card-header .badge {
    font-size: 0.7rem; /* Texto más pequeño */
    padding: 3px 8px; /* Padding reducido */
}

/* PAGINACIÓN COMPACTA */
.pagination-section {
    margin-top: 15px !important; /* Menor espacio arriba */
}

.pagination .page-link {
    padding: 4px 10px; /* Botones de paginación más pequeños */
    font-size: 0.8rem; /* Texto más compacto */
}

/* RESPONSIVE PARA TABLA COMPACTA */
@media (max-width: 768px) {
    .transactions-section .table-responsive {
        font-size: 0.75rem; /* Texto aún más compacto en móviles */
    }
    
    .transactions-section .table td,
    .transactions-section .table th {
        padding: 4px 6px; /* Padding mínimo en móviles */
    }
    
    .btn-action {
        width: 24px; /* Botones más pequeños en móviles */
        height: 24px;
        font-size: 0.65rem; /* Iconos más pequeños */
    }
    
    .action-buttons {
        flex-direction: row; /* Mantiene botones en fila */
        gap: 2px; /* Espacio mínimo */
    }
}
/* ============================================
   CENTRAR IMPORTES EN TABLAS
   ============================================ */

/* Centrar la columna de Importe en todas las tablas */
.table td:nth-child(5) {
    text-align: center !important;
}

/* Centrar específicamente en la tabla de documentos enviados */
#transactions-table td:nth-child(5) {
    text-align: center !important;
    font-weight: 600;
    color: #2c3e50;
}

/* Opcional: Para mantener el formato monetario pero centrado */
.importe-centrado {
    text-align: center;
    font-family: 'Courier New', monospace; /* Mantiene alineación numérica */
    font-weight: 600;
}

/* ============================================
   LOGOUT EN SIDEBAR
   ============================================ */

.menu-separator {
    height: 1px;
    background: #e9ecef;
    margin: 1rem 0;
    opacity: 0.6;
}

.logout-menu-item {
    margin-top: auto;
    color: #dc3545 !important;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.logout-menu-item:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
    transform: translateX(5px);
}

/* Estilos para el modal de factura */
.invoice-modal .modal-xl {
    max-width: 1200px;
}

.status-badge-modal {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

/* Efectos hover para las cards */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

/* Estilos para la tabla de líneas */
.table-responsive {
    overflow-x: auto; /* Solo scroll horizontal si es necesario */
}

/* Badges personalizados */
.badge {
    font-size: 0.75em;
}

/* Acordeón del JSON */
#jsonCollapse pre {
    background: #1a1a1a;
    border: 1px solid #333;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-xl {
        margin: 0.5rem;
    }
    
    .card-body .row > div {
        margin-bottom: 1rem;
    }
}

/* Estilos para modal compacto */
.modal-header .badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.modal-body .card-header {
    padding: 0.5rem 1rem;
}

.modal-body .card-body {
    padding: 0.75rem;
}

.modal-footer {
    padding: 0.75rem 1rem;
}

/* Tabla más compacta */
.table-responsive table {
    margin-bottom: 0;
}

.table-responsive table th,
.table-responsive table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
}

/* Estilos para filas clickeables */
.clickable-row {
    transition: all 0.2s ease;
}

.clickable-row:hover {
    background-color: #f8f9fa !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Efecto al hacer click */
.clickable-row:active {
    background-color: #e9ecef !important;
    transform: translateY(0);
}

/* Los botones de acción deben tener su propio hover */
.action-buttons .btn-action:hover {
    background-color: rgba(0,0,0,0.1);
    transform: scale(1.1);
}

