/* Reset y configuración básica */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    min-height: 100vh;
    color: #2c3e50;
}

/* Header */
.header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    height: 50px;
    width: auto;
}

.logo h1 {
    color: #5d6d7e;
    font-size: 1.8rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: #5499c7;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn {
    background: #6c757d;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #5a6268;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Sección de filtros */
.filters-section {
    background: #ffffff;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    overflow: hidden;
}

.filters-container {
    padding: 1.5rem 2rem;
}

.filters-container h3 {
    color: #5d6d7e;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-weight: 500;
    color: #566573;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.6rem;
    border: 2px solid #d5dbdb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f8f9fa;
    color: #2c3e50;
    transition: border-color 0.3s;
}

.filter-group select:focus {
    outline: none;
    border-color: #5499c7;
}

.btn-filter, .btn-clear {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.btn-filter {
    background: #5499c7;
    color: white;
}

.btn-filter:hover {
    background: #3e7fa5;
    transform: translateY(-1px);
}

.btn-clear {
    background: #6c757d;
    color: white;
}

.btn-clear:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Campo de búsqueda */
.search-group {
    flex: 1 1 300px;
    min-width: 250px;
}

.search-input {
    padding: 0.6rem 1rem;
    border: 2px solid #d5dbdb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f8f9fa;
    color: #2c3e50;
    transition: border-color 0.3s;
    width: 100%;
}

.search-input:focus {
    outline: none;
    border-color: #5499c7;
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

/* Secciones colapsables */
.collapsible-header {
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem;
    margin: -0.5rem;
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: visible;
}

.collapsible-content.collapsed {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
}

.toggle-icon {
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
    font-size: 0.8em;
}

.toggle-icon.rotated {
    transform: rotate(90deg);
}

/* Filtros activos */
.active-filters {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filter-label {
    font-weight: 500;
    color: #555;
    margin-right: 0.5rem;
}

.filter-tag {
    background: #5499c7;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-remove {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.3s;
    margin-left: 0.3rem;
}

.filter-remove:hover {
    color: white;
    opacity: 1;
    text-decoration: none;
}

.clear-filters-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.clear-filters-link:hover {
    color: #5499c7;
    background: #f8f9fa;
    text-decoration: none;
}

/* Responsive para filtros */
@media (max-width: 768px) {
    .filters-form {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group {
        min-width: auto;
        width: 100%;
    }

    .filters-container {
        padding: 1rem;
    }

    .active-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
}

/* Colores para iconos de archivos */
.text-danger {
    color: #dc3545 !important;
}

.text-primary {
    color: #0d6efd !important;
}

.text-success {
    color: #198754 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

.text-secondary {
    color: #6c757d !important;
}

/* Espaciado para iconos en nombres de archivo */
.file-name i {
    margin-right: 0.5rem;
}

/* Espaciado para iconos en badges */
.user-badge i,
.new-files-badge i,
.logout-btn i,
.status-badge i {
    margin-right: 0.3rem;
}

/* Espaciado para iconos en botones */
.btn i,
.btn-sm i,
.btn-filter i,
.btn-clear i,
.preview-btn i {
    margin-right: 0.3rem;
}

/* Información extraída automáticamente */
.ai-extracted-info {
    background: linear-gradient(135deg, #f0f8f4 0%, #e8f5e8 100%);
    border: 3px solid #28a745;
    border-radius: 15px;
    padding: 2.5rem 3rem;
    margin: 0 auto 2rem auto;
    font-size: 1.2rem;
    color: #155724;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.2);
    line-height: 1.8;
    position: relative;
    overflow: visible;
    width: 100%;
    text-align: center;
}

.ai-extracted-info i {
    margin-right: 0.5rem;
}

.ai-extracted-info strong {
    color: #0f5132;
}


.ai-extracted-info i.fa-robot {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: #28a745;
    animation: pulse-ai 2s infinite;
}

@keyframes pulse-ai {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ai-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(40, 167, 69, 0.2);
}

.ai-title {
    font-weight: 600;
    color: #0f5132;
    font-size: 0.9rem;
}

.ai-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 3rem;
}

.ai-data-item {
    padding: 1rem 0;
    line-height: 1.8;
    font-size: 1.1rem;
}

.ai-data-item strong {
    color: #0f5132;
    font-weight: 600;
    margin-right: 0.5rem;
    display: inline-block;
    min-width: 85px;
}

.upload-info {
    font-size: 1.1rem;
    color: #666;
    margin-top: 1rem;
    line-height: 1.8;
    padding: 1rem 0;
}

/* Responsive para grid AI */
@media (max-width: 768px) {
    .ai-data-grid {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .ai-data-item strong {
        min-width: auto;
        display: block;
        margin-bottom: 0.2rem;
    }
}

/* Animación para spinner de procesamiento */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Responsive para información AI */
@media (max-width: 768px) {
    .ai-extracted-info {
        font-size: 0.8rem;
        padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    }

    .file-item .ai-extracted-info {
        padding-left: 2.5rem;
    }

    .ai-extracted-info strong {
        display: block;
        margin-top: 0.25rem;
    }
}

/* Página de login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    background: #ffffff;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    margin-bottom: 2rem;
}

.login-logo img {
    height: 80px;
    width: auto;
}

.login-box h1 {
    color: #5d6d7e;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #566573;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d5dbdb;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8f9fa;
    color: #2c3e50;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #5499c7;
}

.btn {
    background: #5499c7;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    width: 100%;
}

.btn:hover {
    background: #3e7fa5;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Dashboard */
.dashboard {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr 1fr;
    }

    /* Para asesoría y empresa usar solo 1 columna */
    body[data-user-role="asesoria"] .dashboard,
    body[data-user-role="empresa"] .dashboard {
        grid-template-columns: 1fr !important;
        max-width: 1200px;
        margin: 0 auto;
    }

    /* Vista ULTRA compacta para asesoría y empresa */
    body[data-user-role="asesoria"] .file-item,
    body[data-user-role="empresa"] .file-item {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        gap: 0.6rem;
        min-height: auto;
    }

    body[data-user-role="asesoria"] .ai-extracted-info,
    body[data-user-role="empresa"] .ai-extracted-info {
        padding: 0.8rem 1rem 0.8rem 3rem;
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        border-width: 1px;
    }

    body[data-user-role="asesoria"] .ai-header,
    body[data-user-role="empresa"] .ai-header {
        margin-bottom: 0.4rem;
        padding-bottom: 0.2rem;
    }

    body[data-user-role="asesoria"] .ai-title,
    body[data-user-role="empresa"] .ai-title {
        font-size: 0.75rem;
    }

    body[data-user-role="asesoria"] .ai-data-grid,
    body[data-user-role="empresa"] .ai-data-grid {
        gap: 0.3rem 1rem;
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    body[data-user-role="asesoria"] .ai-data-item,
    body[data-user-role="empresa"] .ai-data-item {
        padding: 0.2rem 0;
        font-size: 0.75rem;
        line-height: 1.2;
    }

    body[data-user-role="asesoria"] .ai-data-item strong,
    body[data-user-role="empresa"] .ai-data-item strong {
        font-size: 0.75rem;
        min-width: auto;
        margin-right: 0.3rem;
    }

    body[data-user-role="asesoria"] .file-info,
    body[data-user-role="empresa"] .file-info {
        padding: 0.2rem 0;
    }

    body[data-user-role="asesoria"] .file-name,
    body[data-user-role="empresa"] .file-name {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;
    }

    body[data-user-role="asesoria"] .upload-info,
    body[data-user-role="empresa"] .upload-info {
        font-size: 0.75rem;
        padding: 0.1rem 0;
        line-height: 1.2;
        margin-top: 0.1rem;
    }

    body[data-user-role="asesoria"] .file-actions,
    body[data-user-role="empresa"] .file-actions {
        gap: 0.6rem;
        padding-top: 0.2rem;
        margin-top: 0;
    }

    body[data-user-role="asesoria"] .btn-sm,
    body[data-user-role="empresa"] .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    body[data-user-role="asesoria"] .status-badge,
    body[data-user-role="empresa"] .status-badge {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
        margin-left: 0.3rem;
    }
}

/* Botón de descarga múltiple */
.btn-download-all {
    background: linear-gradient(135deg, #5499c7, #3e7fa5);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 3px 10px rgba(84, 153, 199, 0.25);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-download-all:hover {
    background: linear-gradient(135deg, #3e7fa5, #2e6b8c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(84, 153, 199, 0.35);
}

.btn-download-all i {
    font-size: 1rem;
}

.card {
    background: #ffffff;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: visible;
    height: auto;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
}

.card h2 {
    color: #5d6d7e;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Zona de subida de archivos */
.upload-area {
    border: 3px dashed #5499c7;
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    background: #ebedef;
    border-color: #3e7fa5;
}

.upload-area.dragover {
    background: #e8f4f8;
    border-color: #5499c7;
    transform: scale(1.02);
}

/* Estilos para upload widget con dragover */
.upload-widget.dragover {
    background: #e8f4f8;
    border-color: #5499c7;
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(84, 153, 199, 0.2);
}

.upload-widget:hover {
    border-color: #3e7fa5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.upload-icon {
    font-size: 3rem;
    color: #5499c7;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    font-size: 0.9rem;
    color: #999;
}

#fileInput {
    display: none;
}

/* Lista de archivos */
.file-list {
    /* Eliminado scroll interno, se usa el scroll principal */
    overflow: visible;
    height: auto;
    max-height: none;
}

.file-item {
    display: flex;
    flex-direction: column;
    padding: 3rem 2rem;
    border: 2px solid #d5dbdb;
    border-radius: 15px;
    margin-bottom: 3rem;
    transition: all 0.3s;
    background: #ffffff;
    text-align: center;
    gap: 2rem;
    min-height: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.file-item:hover {
    border-color: #5499c7;
    box-shadow: 0 2px 8px rgba(84, 153, 199, 0.3);
}

.file-item.new-file {
    border-left: 4px solid #5499c7;
    background: #f0f8ff;
}

.file-info {
    flex: 1;
    padding: 1rem 0;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.file-meta {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.file-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: auto;
    padding-top: 1rem;
}

.btn-sm {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

/* Estados de archivos */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-viewed {
    background: #d4edda;
    color: #155724;
}

.status-new {
    background: #fff3cd;
    color: #856404;
}

/* Contador de archivos nuevos */
.new-files-badge {
    background: linear-gradient(135deg, #5499c7, #3e7fa5);
    color: white;
    border-radius: 15px;
    min-width: 30px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
    padding: 0 0.5rem;
    box-shadow: 0 2px 6px rgba(84, 153, 199, 0.35);
    animation: pulse-notification 2s infinite;
    position: relative;
    white-space: nowrap;
}

/* Animación para la campanita */
@keyframes pulse-notification {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(84, 153, 199, 0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 3px 10px rgba(84, 153, 199, 0.5);
    }
}

/* Progress bar para subidas */
.upload-progress {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
    display: none;
}

.upload-progress-bar {
    height: 100%;
    background: #5499c7;
    width: 0%;
    transition: width 0.3s;
}

/* Estilos para edición de fecha manual */
.manual-date-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.manual-date-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.5rem;
}

.btn-edit-date,
.btn-assign-date {
    background: none;
    border: none;
    color: #0c5460;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.btn-edit-date:hover,
.btn-assign-date:hover {
    background: rgba(12, 84, 96, 0.1);
    color: #084249;
}

.btn-assign-date {
    background: #5499c7;
    color: white;
    padding: 0.5rem 1rem;
}

.btn-assign-date:hover {
    background: #c41e3a;
    color: white;
}

/* Estilos específicos para el modal de editar fecha */
#editDateModal .modal-content {
    margin: 5% auto !important;
    padding: 0 !important;
    box-sizing: border-box;
}

#editDateModal .modal-body {
    padding: 1.5rem;
}

#editDateModal .modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Estilos específicos para el modal de vista previa */
#previewModal {
    overflow: hidden;
}

#previewModal .modal-content {
    width: 95vw;
    height: 95vh;
    max-width: none;
    max-height: none;
    margin: 2.5vh auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#previewModal .modal-header {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

#previewModal .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#previewModal .modal-body iframe {
    flex: 1;
    border: none;
    background: #f8f9fa;
}

#previewModal .preview-actions {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* Estilos para filtros de periodo (trimestres/meses) */
.period-filter-group {
    position: relative;
}

.period-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.period-tabs {
    display: flex;
    gap: 0.25rem;
}

.period-tab {
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #666;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.period-tab:hover {
    background: #e9ecef;
    color: #0c5460;
}

.period-tab.active {
    background: #5499c7;
    color: white;
    border-color: #5499c7;
}

.period-filter-content {
    display: none;
}

.period-filter-content.active {
    display: block;
}

.period-filter-content select {
    width: 100%;
}

/* Botón para procesar con IA */
.btn-process-ai {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-process-ai:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-process-ai:active {
    transform: translateY(0);
}

.btn-process-ai i {
    font-size: 1rem;
}

.btn-process-ai:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Botón para cancelar procesamiento IA */
.btn-cancel-ai {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-cancel-ai:hover {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-cancel-ai:active {
    transform: translateY(0);
}

.btn-cancel-ai i {
    font-size: 1rem;
}

.btn-cancel-ai:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Botón para detectar duplicados */
.btn-detect-duplicates {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-detect-duplicates:hover {
    background: linear-gradient(135deg, #f57c00, #e65100);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-detect-duplicates:active {
    transform: translateY(0);
}

.btn-detect-duplicates i {
    font-size: 1rem;
}

/* Botón para gestionar proveedores */
.btn-manage-suppliers {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-manage-suppliers:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-manage-suppliers:active {
    transform: translateY(0);
}

.btn-manage-suppliers:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-manage-suppliers i {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .file-actions {
        justify-content: center;
    }

    .login-box {
        padding: 2rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.6s ease-out;
}

.file-item {
    animation: fadeIn 0.4s ease-out;
}

/* Modal de Vista Previa */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease-out;
}

/* Modal de selección de tipo de factura - debe estar por encima de todo */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 9999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #ffffff;
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 95%;
    max-width: 1200px;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    background: #5499c7;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
    line-height: 1;
}

.close:hover,
.close:focus {
    opacity: 0.7;
}

.modal-body {
    padding: 0;
    max-height: calc(95vh - 80px);
    overflow: auto;
    background: #ffffff;
    border-radius: 0 0 15px 15px;
}

/* Específico para contenido de archivos - sin scroll interno */
.file-list .modal-body,
.collapsible-content .modal-body {
    overflow: visible;
    max-height: none;
}

.modal-body iframe {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
    background: #ffffff;
    transition: opacity 0.3s ease-in-out;
}

.modal-body img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: #ffffff;
}

.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #7f8c8d;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid #e8ecf1;
    border-top: 3px solid #5499c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preview-error {
    text-align: center;
    padding: 3rem;
    color: #dc3545;
}

.preview-info {
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    margin: 2rem;
    border-radius: 10px;
    border: 1px solid #d5dbdb;
}

.preview-info h4 {
    color: #5d6d7e;
    margin-bottom: 1rem;
}

.preview-actions {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-top: 1px solid #d5dbdb;
    text-align: center;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.preview-btn-primary {
    background: #5499c7;
    color: white;
}

.preview-btn-primary:hover {
    background: #3e7fa5;
    transform: translateY(-1px);
}

.preview-btn-secondary {
    background: #6c757d;
    color: white;
}

.preview-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 98%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body iframe,
    .modal-body img {
        height: 60vh;
    }

    .preview-actions {
        padding: 1rem;
        flex-direction: column;
    }

    .preview-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 150%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Sección de subida compacta */
.upload-section-compact {
    margin-bottom: 2rem;
}

.compact-upload {
    padding: 1rem 2rem;
}

.compact-upload h3 {
    color: #5499c7;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-area-compact {
    border: 2px dashed #5499c7;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-area-compact:hover {
    background: #f0f0f0;
    border-color: #3e7fa5;
}

.upload-area-compact.dragover {
    background: #fff0f0;
    border-color: #5499c7;
    transform: scale(1.01);
}

.upload-content-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #666;
}

.upload-content-compact i {
    color: #5499c7;
}

.upload-content-compact small {
    color: #999;
}

/* Resumen de totales fiscales */
.totals-summary {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    border-left: 4px solid #5499c7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.totals-summary h4 {
    color: #5d6d7e;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.total-item {
    background: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e8ecf1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.total-item:hover {
    transform: translateY(-2px);
}

.total-item.highlight {
    background: linear-gradient(135deg, #5499c7, #3e7fa5);
    color: white;
    border: none;
}

.total-item.warning {
    background: linear-gradient(135deg, #f9ca24, #f0b400);
    color: #2c3e50;
    border: none;
}

.total-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.total-item.highlight .total-label,
.total-item.warning .total-label {
    color: rgba(255,255,255,0.9);
}

.total-item.warning .total-label {
    color: #2c3e50;
}

.total-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
}

.total-item.highlight .total-value {
    color: white;
    font-size: 1.4rem;
}

.total-item.warning .total-value {
    color: #2c3e50;
}

.total-base {
    color: #28a745;
}

.total-tax {
    color: #dc3545;
}

.total-amount {
    color: #5499c7;
    font-weight: 700;
}

.totals-note {
    color: #7f8c8d;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Responsive para totales */
@media (max-width: 768px) {
    .totals-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .total-item {
        padding: 0.75rem;
    }

    .total-value {
        font-size: 1.1rem;
    }

    .total-item.highlight .total-value {
        font-size: 1.2rem;
    }
}

/* Modal de Confirmación de Eliminación */
.modal-delete .modal-content-delete {
    max-width: 500px;
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    animation: slideInDelete 0.3s ease-out;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

@keyframes slideInDelete {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header-delete {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    border-radius: 15px 15px 0 0;
}

.delete-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.modal-header-delete h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-body-delete {
    padding: 2rem;
    text-align: center;
}

.modal-body-delete p {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.delete-warning {
    color: #856404;
    background: #fff9e6;
    border: 1px solid #ffe5b4;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.file-to-delete {
    background: #f8f9fa;
    border: 2px solid #d5dbdb;
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 500;
    color: #566573;
}

.file-to-delete i {
    font-size: 1.2rem;
    color: #7f8c8d;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    display: flex;
    gap: 1rem;
    justify-content: center;
    border-radius: 0 0 15px 15px;
}

.btn-modal {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-confirm {
    background: #dc3545;
    color: white;
}

.btn-confirm:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-modal:active {
    transform: translateY(0);
}

/* Responsive para modal de eliminación */
@media (max-width: 768px) {
    .modal-content-delete {
        margin: 10% auto;
        width: 95%;
        max-width: 400px;
    }

    .modal-header-delete {
        padding: 1rem 1.5rem;
    }

    .delete-icon {
        font-size: 2.5rem;
    }

    .modal-body-delete {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .btn-modal {
        width: 100%;
    }
}

/* Selección múltiple */
.file-select-checkbox {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

/* Checkbox centrado dentro de la sección AI */
.ai-extracted-info .file-select-checkbox {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    z-index: 10;
}

/* Añadir más espacio izquierdo para el checkbox */
.file-item .ai-extracted-info {
    padding-left: 5rem;
}

.file-select-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.file-select-checkbox label {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid #d5dbdb;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.file-select-checkbox label:before {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.file-select-checkbox input[type="checkbox"]:checked + label {
    background: #5499c7;
    border-color: #5499c7;
    box-shadow: 0 2px 6px rgba(84, 153, 199, 0.3);
}

.file-select-checkbox input[type="checkbox"]:checked + label:before {
    opacity: 1;
}

.file-item {
    position: relative;
}

.file-item.selected {
    border-color: #5499c7 !important;
    background: #f0f8ff !important;
    box-shadow: 0 0 10px rgba(84, 153, 199, 0.3) !important;
    transition: all 0.2s ease;
}

/* Feedback visual cuando se usa Shift para selección de rango */
body.shift-selecting .file-item:hover {
    cursor: pointer;
    background-color: #e8f4f8;
    border-color: #85c1e9;
}

/* Evitar selección de texto en file-items cuando se usa Shift */
body.shift-selecting .file-item {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Indicador visual de modo de selección múltiple */
body.shift-selecting {
    cursor: crosshair !important;
    /* Evitar selección de texto cuando se usa Shift */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Animación para checkbox cuando se selecciona */
.file-select-checkbox input[type="checkbox"]:checked + label {
    animation: checkPulse 0.3s ease;
}

@keyframes checkPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Barra de acciones masivas */
.bulk-actions-bar {
    background: linear-gradient(135deg, #5499c7, #3e7fa5);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(84, 153, 199, 0.25);
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-actions-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.selected-count {
    font-weight: 600;
    font-size: 1.1rem;
}

.bulk-actions-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-bulk {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-bulk-download {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-bulk-download:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-bulk-delete {
    background: #dc3545;
    color: white;
}

.btn-bulk-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-bulk-cancel {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-bulk-cancel:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

/* Responsive para selección múltiple */
@media (max-width: 768px) {
    .bulk-actions-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .bulk-actions-buttons {
        justify-content: center;
    }

    .btn-bulk {
        flex: 1;
        min-width: 120px;
    }

    .file-select-checkbox {
        top: 50%;
        left: 0.5rem;
        transform: translateY(-50%);
    }
}