/* orders.css - Estilos completos para el módulo de pedidos BARF */

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.6;
}

/* Layout Principal */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

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

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: rgba(255,255,255,0.3);
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.15);
    border-left-color: white;
}

.sidebar-menu i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219653;
    transform: translateY(-2px);
}

/* Secciones */
.section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 20px;
}

/* Filtros y Búsqueda */
.filters-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.filters-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 150px;
}

.actions-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* Estadísticas Rápidas */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabla de Pedidos */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

#ordersTable {
    width: 100%;
    border-collapse: collapse;
}

#ordersTable th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

#ordersTable td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

#ordersTable tr:hover {
    background: #f8f9fa;
}

/* Información de Pedido */
.order-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.order-icon.pendiente { background: #ffc107; }
.order-icon.confirmado { background: #17a2b8; }
.order-icon.en_ruta { background: #007bff; }
.order-icon.entregado { background: #28a745; }
.order-icon.cancelado { background: #dc3545; }

.order-details {
    flex: 1;
}

.order-code {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.order-client {
    font-size: 12px;
    color: #6c757d;
}

/* Información de Cliente */
.client-info, .route-info, .date-info, .amount-info {
    font-size: 14px;
}

.client-name, .route-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.client-contact, .route-seller, .delivery-status {
    font-size: 12px;
    color: #6c757d;
}

/* Lista de Productos */
.products-list {
    max-width: 200px;
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f8f9fa;
}

.product-item:last-child {
    border-bottom: none;
}

.product-name {
    font-size: 12px;
    color: #495057;
    flex: 1;
}

.product-quantity {
    font-size: 11px;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Badges de Estado */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status-confirmed {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-inroute {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-delivered {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Botones de Acción */
.actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s;
    color: #555;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.action-btn.view { color: #17a2b8; }
.action-btn.edit { color: #ffc107; }
.action-btn.delivery { color: #28a745; }
.action-btn.cancel { color: #dc3545; }
.action-btn.toggle { color: #6c757d; }

/* MODALES - Estilos completos */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tamaños de modales */
.modal-content.small {
    width: 400px;
    max-width: 90%;
}

.modal-content.medium {
    width: 600px;
    max-width: 90%;
}

.modal-content.large {
    width: 800px;
    max-width: 95%;
}

.modal-content.xlarge {
    width: 1000px;
    max-width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 25px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* Formularios */
.form-section {
    margin-bottom: 25px;
}

.form-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Pestañas en Modal */
.tab-buttons {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 500;
}

.tab-btn:hover:not(.active) {
    color: #495057;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tabla de Productos en Modal */
.products-table {
    margin: 15px 0;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.product-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.product-row:last-child {
    border-bottom: none;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 2px;
}

.product-details {
    font-size: 12px;
    color: #6c757d;
}

.product-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    color: #6c757d;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #f8f9fa;
    color: #495057;
}

.btn-icon.edit:hover { color: #ffc107; }
.btn-icon.remove:hover { color: #dc3545; }

/* Resumen de Pedido */
.order-summary {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-item.total {
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.summary-item label {
    font-weight: 500;
    color: #495057;
}

.summary-item input {
    width: 100px;
    padding: 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: right;
}

/* Información de Ruta */
.route-details {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.route-details p {
    margin: 5px 0;
    font-size: 14px;
}

.route-details strong {
    color: #495057;
}

/* Detalles del Pedido */
.details-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.details-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.details-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
}

.details-section p {
    margin: 8px 0;
    font-size: 14px;
}

.details-section strong {
    color: #495057;
    min-width: 120px;
    display: inline-block;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.details-table th,
.details-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.details-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

/* Resumen de Pago */
.payment-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.payment-summary .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
}

.payment-summary .summary-item:last-child {
    margin-bottom: 0;
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

/* Estados de carga */
.loading-state {
    text-align: center;
    padding: 50px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #27ae60;
}

.notification.error {
    background: #e74c3c;
}

.notification.warning {
    background: #f39c12;
}

.notification.info {
    background: #3498db;
}

.hidden {
    display: none;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.page-btn:hover:not(.disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Estados vacíos */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
}

.products-table .empty {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    
    .sidebar-menu li {
        margin: 0 5px;
    }
    
    .sidebar-menu a {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }
    
    .sidebar-menu a.active {
        border-left: none;
        border-bottom-color: white;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-select {
        min-width: auto;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .actions-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    #ordersTable {
        display: block;
        overflow-x: auto;
    }
    
    .order-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .actions {
        justify-content: flex-start;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal-content.small,
    .modal-content.medium,
    .modal-content.large,
    .modal-content.xlarge {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }
    
    .tab-btn.active {
        border-left-color: #007bff;
        border-bottom: none;
    }
}

/* Scroll personalizado */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Columnas específicas de la tabla */
#ordersTable th:nth-child(1),
#ordersTable td:nth-child(1) { 
    min-width: 180px; 
}

#ordersTable th:nth-child(4),
#ordersTable td:nth-child(4) { 
    min-width: 120px; 
}

#ordersTable th:nth-child(5),
#ordersTable td:nth-child(5) { 
    min-width: 150px; 
}

#ordersTable th:nth-child(6),
#ordersTable td:nth-child(6) { 
    min-width: 100px; 
    text-align: right;
}

#ordersTable th:nth-child(7),
#ordersTable td:nth-child(7) { 
    min-width: 120px; 
    text-align: center;
}

#ordersTable th:nth-child(8),
#ordersTable td:nth-child(8) { 
    min-width: 140px; 
    text-align: center;
}