* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 95%;
    margin: 0 auto;
}

header {
    color: white;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.btn-logout {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.ventas-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    max-width: 400px;
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.date-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.date-filters label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #495057;
}

.date-filters input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9rem;
}

.date-filters input[type="date"]:focus {
    outline: none;
    border-color: #3498db;
}

.btn-buscar {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-buscar:hover {
    background: #2980b9;
}

.results-count {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #495057;
    font-weight: 500;
}

.courier-logo {
    height: 24px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    vertical-align: middle;
}

.btn-refresh {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-refresh:hover {
    background: #2980b9;
}

.btn-excel {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-excel:hover {
    background: #219a52;
}

.btn-excel:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.report-progress {
    display: none;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 300px;
}

.report-progress.visible {
    display: flex;
}

.report-progress-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.report-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 10px;
    animation: report-progress-pulse 1.2s ease-in-out infinite;
}

@keyframes report-progress-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.report-progress-text {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
}

.btn-detalle {
    padding: 6px 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-detalle:hover {
    background: #2980b9;
}

.btn-detalle:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.modal-open {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #495057;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
}

.modal-close:hover {
    color: #212529;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow: auto;
}

.modal-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

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

.modal-table tbody tr:hover {
    background: #f8f9fa;
}

.table-wrapper {
    overflow: auto;
    max-height: 60vh;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.ventas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

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

.ventas-table tbody tr:hover {
    background: #f8f9fa;
}

.estado-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.estado-default {
    background: #e9ecef;
    color: #495057;
}

.estado-entregado {
    background: #d4edda;
    color: #155724;
}

.estado-reparto {
    background: #cce5ff;
    color: #004085;
}

.estado-transito {
    background: #d1ecf1;
    color: #0c5460;
}

.estado-sucursal {
    background: #e2e3f3;
    color: #383d8b;
}

.estado-retiro {
    background: #d4edda;
    color: #155724;
}

.estado-cancelado {
    background: #f8d7da;
    color: #721c24;
}

.estado-incidencia {
    background: #fff3cd;
    color: #856404;
}

.estado-listo {
    background: #c8e6c9;
    color: #2e7d32;
}

.estado-preparacion {
    background: #ffe0b2;
    color: #e65100;
}

.estado-solicitado {
    background: #e2d5f1;
    color: #5a3d8a;
}

.tipo-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tipo-venta {
    background: #e8f4fd;
    color: #1565c0;
}

.tipo-envio {
    background: #e8f5e9;
    color: #2e7d32;
}

.loading-row td,
.empty-row,
.error-row {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.error-row {
    color: #dc3545;
}

.report-section {
    margin-bottom: 30px;
}

.report-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    border: 2px solid #dee2e6;
    max-width: 500px;
}

.report-card h2 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.report-hint {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 20px;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-row input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
}

.form-row input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.btn-generate {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    margin-top: 10px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-generate:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.file-upload-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.file-upload-card:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.file-upload-card h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.upload-area {
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area.dragover {
    opacity: 0.7;
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
    padding: 30px;
}

.upload-icon {
    width: 60px;
    height: 60px;
    color: #3498db;
    margin-bottom: 15px;
    stroke-width: 2;
}

.upload-text {
    font-size: 1rem;
    color: #495057;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.85rem;
    color: #6c757d;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.file-name {
    font-weight: 600;
    color: #212529;
    font-size: 0.95rem;
}

.file-stats {
    font-size: 0.85rem;
    color: #6c757d;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn-download {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: #218838;
    transform: scale(1.1);
}

.progress-container {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: #495057;
    font-weight: 600;
    min-width: 200px;
    white-space: nowrap;
    text-align: right;
}

.message-container {
    margin-top: 20px;
}

.message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.merge-section {
    margin-top: 30px;
    text-align: center;
}

.btn-merge {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-merge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9 0%, #1f6391 100%);
}

.btn-merge:active {
    transform: translateY(0);
}

.btn-merge:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .upload-section {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }
}

/* Login Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-title {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-subtitle {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 32px;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-group input::placeholder {
    color: #adb5bd;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.btn-login {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-archivos {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-archivos:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Modal Archivos */
.modal-archivos {
    max-width: 500px;
}

.archivos-content {
    min-height: 100px;
}

.archivos-empty {
    text-align: center;
    color: #6c757d;
    padding: 30px;
}

.archivos-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archivos-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.archivos-list li:last-child {
    border-bottom: none;
}

.archivos-list li:hover {
    background: #f8f9fa;
}

.archivo-info {
    flex: 1;
}

.archivo-nombre {
    font-weight: 600;
    color: #212529;
    font-size: 0.9rem;
    display: block;
}

.archivo-fecha {
    font-size: 0.8rem;
    color: #6c757d;
}

.archivo-params {
    font-size: 0.75rem;
    color: #868e96;
    margin-top: 2px;
}

.btn-download-archivo {
    padding: 6px 14px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.btn-download-archivo:hover {
    background: #219a52;
}

/* Job Notification */
.job-notification {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
}

.job-notification.visible {
    display: block;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.job-notification-content {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid #27ae60;
}

.job-notification-icon {
    font-size: 1.5rem;
}

.job-notification-text {
    font-weight: 500;
    color: #212529;
}

.job-notification-btn {
    padding: 8px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.job-notification-btn:hover {
    background: #219a52;
}

.job-notification-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    line-height: 1;
    margin-left: 8px;
}

.job-notification-close:hover {
    color: #212529;
}

/* Progress bar con porcentaje */
.report-progress.visible .report-progress-bar {
    position: relative;
}

.report-progress.visible .report-progress-bar::after {
    animation: none;
    width: var(--progress, 0%);
    transition: width 0.3s ease;
}

.report-progress.visible.indeterminate .report-progress-bar::after {
    animation: report-progress-pulse 1.2s ease-in-out infinite;
    width: 30%;
}

/* Load More */
.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-top: 10px;
}

.btn-load-more {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-load-more:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-info {
    font-size: 0.9rem;
    color: #6c757d;
}

