/* Estilos base */
:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-hover: #27ae60;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --warning-color: #f39c12;
    --warning-hover: #e67e22;
    --text-color: #333;
    --light-text: #777;
    --background-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 6px;
    --transition: all 0.3s ease;
    --credit-note-bg: #fffbeb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Styles */
.login-body {
    background-color: #f5f8fc;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.login-header {
    padding: 20px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
}

.login-header h2 {
    font-weight: 500;
    font-size: 1.5rem;
}

.login-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text);
}

.form-control {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--secondary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: var(--warning-hover);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: rgba(0,0,0,0.05);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Alertas */
.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    font-size: 14px;
}

.alert-danger {
    background-color: #fdecea;
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background-color: #e8f5e9;
    color: var(--secondary-color);
    border-left: 4px solid var(--secondary-color);
}

/* Navbar */
.navbar {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 10px 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background-color: var(--primary-color);
    color: white;
}

.badge-operator {
    background-color: var(--secondary-color);
    color: white;
}

.badge-success {
    background-color: var(--secondary-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Estilos del Dashboard principal */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.dashboard-item {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-color);
    gap: 20px;
}

.dashboard-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 24px;
}

.dashboard-text h3 {
    margin-bottom: 5px;
    font-weight: 500;
}

.dashboard-text p {
    color: var(--light-text);
    font-size: 14px;
}

/* Estilos para Cards */
.card {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.card-body {
    padding: 20px;
}

/* Control Panel */
.control-panel {
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filters {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: var(--radius);
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-filter label {
    font-weight: 500;
}

input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f4f4f4;
    font-weight: 500;
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Estilo específico para filas de notas de crédito */
tbody tr.credit-note {
    background-color: var(--credit-note-bg) !important;
}

tbody tr.credit-note:hover {
    background-color: #fef7cd !important;
}

.text-center {
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

/* Estilos mejorados para la sección de resumen */

/* Contenedor principal */
.summary {
    background-color: #f9f9f9;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.summary h3 {
    margin-bottom: 20px;
    font-weight: 500;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 12px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary h3 i {
    font-size: 1.2em;
}

/* Contenedor de resumen con grid */
.summary-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Grupos de elementos relacionados */
.summary-group {
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 15px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Pares de ítems relacionados (gravado + impuesto) */
.tax-pair {
    background-color: white;
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tax-pair-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

/* Ítems individuales del resumen */
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    background-color: #f8f9fa;
}

/* Estilos específicos para distintos tipos */
.summary-item.gravado {
    background-color: #e8f4fc;
    border-left: 3px solid #3498db;
}

.summary-item.impuesto {
    background-color: #eafaf1;
    border-left: 3px solid #2ecc71;
    margin-bottom: 10px;
}

.summary-item.exento {
    background-color: #f5f5f5;
    border-left: 3px solid #95a5a6;
}

.summary-item.subtotal {
    background-color: #eef2f7;
    border-left: 3px solid #34495e;
    font-weight: 500;
}

.summary-item.total {
    background-color: #edf7ff;
    border-left: 3px solid #3498db;
    padding: 12px;
    margin-top: 15px;
    font-weight: 600;
}

/* Etiquetas y valores */
.summary-label {
    color: var(--light-text);
    font-size: 13px;
    flex: 1;
}

.summary-value {
    font-size: 15px;
    font-weight: 600;
    text-align: right;
}

.summary-item.total .summary-label {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.summary-item.total .summary-value {
    color: var(--primary-color);
    font-size: 18px;
}

/* Responsive para pantallas pequeñas */
@media (max-width: 768px) {
    .summary-container {
        grid-template-columns: 1fr;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .summary-value {
        width: 100%;
        text-align: left;
        margin-top: 5px;
    }
}

/* Modal Styles MEJORADO - Modal más grande para ver facturas */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    overflow: auto;
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 30px auto;
    width: 90%;
    max-width: 700px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: modalFade 0.3s;
}

/* Modal extra grande para detalles de factura */
.modal-lg {
    max-width: 95%;
    max-height: 90vh;
    width: 95%;
    margin: 2vh auto;
}

.modal-sm {
    max-width: 400px;
}

@keyframes modalFade {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8f9fa;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.modal-header h2 {
    font-weight: 500;
    font-size: 20px;
    color: var(--primary-color);
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: var(--light-text);
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-color);
    background-color: rgba(0,0,0,0.1);
}

.modal-body {
    padding: 25px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Scrollbar personalizado para el modal */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* File Upload Styles */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    background-color: #f9f9f9;
    transition: var(--transition);
}

.upload-area.dragover {
    background-color: rgba(52, 152, 219, 0.1);
    border-color: var(--primary-color);
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-prompt i {
    color: var(--primary-color);
}

.upload-prompt h3 {
    font-weight: 500;
    font-size: 18px;
}

.upload-prompt p {
    color: var(--light-text);
    margin-bottom: 10px;
}

/* Progress Styles */
#upload-progress-container {
    margin-top: 20px;
}

#progress-files {
    margin-bottom: 20px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.progress-info {
    flex: 1;
}

.progress-file-name {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.progress-status {
    font-size: 12px;
    color: var(--light-text);
}

.progress-bar-container {
    flex: 1;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 10px;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0;
    transition: width 0.3s ease;
}

.progress-percentage {
    min-width: 45px;
    text-align: right;
    font-weight: 500;
}

.progress-total {
    display: flex;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.progress-label {
    font-weight: 500;
    min-width: 120px;
}

/* Factura Modal Styles MEJORADO */
.factura-section {
    margin-bottom: 25px;
    background-color: #fafafa;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid #eee;
}

.factura-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.data-group {
    margin-bottom: 10px;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

.data-label {
    font-weight: 600;
    color: var(--light-text);
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.data-value {
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 21px;
}

/* Estilo para valores largos */
.data-value.long-value {
    font-size: 13px;
    font-family: monospace;
    background-color: #f8f9fa;
    padding: 5px;
    border-radius: 3px;
    word-break: break-all;
}

/* Tabla de detalles mejorada */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
    background-color: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 12px 15px;
    text-align: left;
}

.detail-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.detail-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.detail-table tr:hover {
    background-color: #e8f4fd;
}

/* Descripción en la tabla de detalles */
.detail-table td:nth-child(2) {
    word-wrap: break-word;
    max-width: 400px;
    white-space: normal;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .dashboard-menu {
        grid-template-columns: 1fr;
    }
    
    .date-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .date-filter label {
        margin-top: 10px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px auto;
    }
    
    .modal-lg {
        width: 98%;
        max-width: 98%;
        margin: 1vh auto;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }
    
    .navbar-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .modal-body {
        max-height: calc(90vh - 100px);
        padding: 15px;
    }
}

/* Estilo para notas de crédito */
.nota-credito {
    color: #e74c3c !important;
    font-weight: 500;
}

/* Estilo para la columna de tipo de documento */
th:nth-child(2), td:nth-child(2) {
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Resaltar nombre de archivo */
.data-group:first-child .data-value {
    font-weight: 500;
    color: var(--primary-color);
}

/* Estilos adicionales para mejorar la legibilidad */
.factura-section:last-child {
    margin-bottom: 0;
}

.data-value {
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* Estilo para el botón de imprimir (opcional) */
.btn-print {
    background-color: #34495e;
    color: white;
}

.btn-print:hover {
    background-color: #2c3e50;
}

/* Animación suave para el modal */
.modal.show {
    display: block;
}

@media print {
    .modal {
        position: static;
        background-color: white;
        width: 100%;
        height: auto;
    }
    
    .modal-content {
        box-shadow: none;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .modal-header {
        border-bottom: 2px solid #000;
        background-color: white;
    }
    
    .close {
        display: none;
    }
    
    .modal-body {
        max-height: none;
        overflow: visible;
        padding: 20px 0;
    }
}

/* Estilos para las pestañas de moneda */
.currency-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.currency-tab {
    padding: 10px 20px;
    background-color: #f9f9f9;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-weight: 500;
    margin-right: 5px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.currency-tab:hover {
    background-color: #f1f1f1;
}

.currency-tab.active {
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}

/* Estilos para los símbolos de moneda */
.usd-symbol {
    color: #2980b9;
}

.crc-symbol {
    color: #27ae60;
}

/* Responsive */
@media (max-width: 768px) {
    .currency-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .currency-tab {
        padding: 8px 15px;
        font-size: 14px;
    }
}


