/* GESTICLOUD - Estilos Principales */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --border-radius: 8px;
}

/* ===================================== */
/* GENERALES */
/* ===================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 30px 0;
}

/* ===================================== */
/* CARDS Y CONTENEDORES */
/* ===================================== */

.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.card-header {
    background-color: white;
    border-bottom: 2px solid var(--light-color);
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 25px;
}

/* ===================================== */
/* PÁGINA DE LOGIN */
/* ===================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.login-header h2 {
    margin: 0;
    font-weight: 700;
}

.login-body {
    padding: 40px 30px;
}

.login-body .form-check-label {
    font-size: 0.95rem;
    color: #6c757d;
}

.login-body .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* ===================================== */
/* NAVBAR */
/* ===================================== */

.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s;
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* ===================================== */
/* FORMULARIOS */
/* ===================================== */

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ===================================== */
/* DRAG & DROP AREA */
/* ===================================== */

.drop-area {
    border: 3px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
}

.drop-area:hover {
    border-color: var(--primary-color);
    background-color: #e7f1ff;
}

.drop-area.drag-over {
    border-color: var(--success-color);
    background-color: #d1e7dd;
}

.drop-area i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.drop-area p {
    margin: 0;
    color: #6c757d;
    font-size: 1.1rem;
}

.file-info {
    background-color: #e7f1ff;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    display: none;
    align-items: center;
}

.file-info.show {
    display: flex;
}

/* ===================================== */
/* TABLAS */
/* ===================================== */

.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
    padding: 15px;
}

.table tbody tr {
    transition: all 0.2s;
    cursor: pointer;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
}

.table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* ===================================== */
/* BADGES Y ESTADOS */
/* ===================================== */

.badge {
    padding: 6px 12px;
    font-weight: 600;
    border-radius: 20px;
}

.badge-pendiente {
    background-color: #ffc107;
    color: #000;
}

.badge-verificada {
    background-color: #198754;
    color: white;
}

.badge-sin-codigo {
    background-color: #dc3545;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===================================== */
/* LAYOUT DE BÚSQUEDA/VERIFICACIÓN */
/* ===================================== */

.search-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    min-height: calc(100vh - 200px);
}

.search-sidebar {
    overflow-y: auto;
}

.search-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100%;
}

.factura-item {
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: white;
}

.factura-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.15);
}

.factura-item.selected {
    border-color: var(--primary-color);
    background-color: #e7f1ff;
}

.factura-item.pendiente {
    border-left: 5px solid var(--warning-color);
}

.factura-item.incidencia {
    border-left: 5px solid var(--danger-color);
    background-color: #fff5f5;
}

.factura-details {
    background-color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.pdf-viewer {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    min-height: 600px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: var(--border-radius);
}

/* Cuando hay iframe, el pdf-viewer debe estirarse */
.pdf-viewer:has(iframe) {
    align-items: stretch;
    height: auto;
    min-height: 700px;
}

.empty-state {
    text-align: center;
    color: #6c757d;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* ===================================== */
/* FILTROS */
/* ===================================== */

.filters-section {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* ===================================== */
/* BOTONES */
/* ===================================== */

.btn {
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ===================================== */
/* AUTOCOMPLETE */
/* ===================================== */

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f8f9fa;
}

.autocomplete-item:hover {
    background-color: #e7f1ff;
}

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

.autocomplete-item small {
    color: #6c757d;
}

/* ===================================== */
/* FOOTER */
/* ===================================== */

.footer {
    border-top: 1px solid #dee2e6;
    margin-top: auto;
}

/* ===================================== */
/* RESPONSIVE */
/* ===================================== */

@media (max-width: 992px) {
    .search-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
}

/* ===================================== */
/* LOADING SPINNER */
/* ===================================== */

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

.spinner-overlay.show {
    display: flex;
}

/* ===================================== */
/* ALERTAS PERSONALIZADAS */
/* ===================================== */

.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 15px 20px;
}

.alert i {
    margin-right: 10px;
}

#extraction-message {
    margin-top: 15px;
    animation: slideDown 0.3s ease-out;
}

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

/* ===================================== */
/* CHECKBOX PERSONALIZADO */
/* ===================================== */

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===================================== */
/* ESTADOS DE CARGA DEL PDF */
/* ===================================== */

.loading-pdf,
.error-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

.loading-pdf i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.error-pdf i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--danger-color);
}

.error-pdf p {
    margin-bottom: 15px;
    font-size: 1rem;
}

.error-pdf .btn {
    margin-top: 10px;
}

/* ===================================== */
/* NAVBAR - MEJORAS MENÚ */
/* ===================================== */

/* Separadores visuales entre grupos del menú */
.nav-separator {
    width: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 0.5rem 1rem;
    align-self: stretch;
}

/* Estilo especial para el menú Herramientas */
.nav-herramientas {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    transition: all 0.3s ease;
}

.nav-herramientas:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Dropdown de herramientas */
.navbar-dark .dropdown-menu {
    background-color: #f8f9fa;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
}

.navbar-dark .dropdown-item {
    color: #212529;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
}

.navbar-dark .dropdown-item:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
    padding-left: 1.75rem;
}

.navbar-dark .dropdown-item i {
    width: 20px;
    text-align: center;
}

.navbar-dark .dropdown-divider {
    margin: 0.5rem 0;
    border-top-color: #dee2e6;
}

/* Ajuste para móviles */
@media (max-width: 991px) {
    .nav-separator {
        width: 100%;
        height: 1px;
        margin: 0.5rem 0;
    }
    
    .nav-herramientas {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* ================================================= */
/* INCIDENCIAS - Animación de parpadeo */
/* ================================================= */

.incidencia-pulse {
    animation: incidencia-pulse-animation 2s infinite;
}

@keyframes incidencia-pulse-animation {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Badge de incidencia */
.badge.bg-danger.incidencia {
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
}
