/* ========================================
   Match - Conciliación de Documentos
   ======================================== */

.match-container {
    padding: 24px;
    margin: 0 auto;
}

/* Tabs superiores */
.match-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid #e5e7eb;
}

.match-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-bottom: -2px;
}

.match-tab:hover {
    color: #111827;
    background: #f9fafb;
}

.match-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.match-tab svg {
    flex-shrink: 0;
}

.match-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
}

.match-tab.active .match-tab-badge {
    background: #2563eb;
}

/* Contenido de tabs */
.match-content {
    min-height: 400px;
}

.match-tab-content {
    display: none;
}

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

/* Cards de conciliación */
#conciliaciones-pendientes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

.match-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.match-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.match-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.match-card-date {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.match-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.match-badge-high {
    background: #dcfce7;
    color: #166534;
}

.match-badge-medium {
    background: #fef3c7;
    color: #92400e;
}

.match-badge-low {
    background: #fee2e2;
    color: #991b1b;
}

.match-card-proveedor {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 20px;
}

.match-card-proveedor svg {
    color: #6b7280;
}

.match-card-totales {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.match-card-total {
    text-align: center;
}

.match-card-total-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.match-card-total-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.match-card-total-label svg {
    width: 16px;
    height: 16px;
}

.match-card-diferencia {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.match-card-diferencia svg {
    width: 16px;
    height: 16px;
}

.match-diferencia-ok {
    background: #dcfce7;
    color: #166534;
}

.match-diferencia-warning {
    background: #fef3c7;
    color: #92400e;
}

.match-diferencia-danger {
    background: #fee2e2;
    color: #991b1b;
}

.match-card-actions {
    display: flex;
    gap: 12px;
}

.match-card-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
}

.match-card-details {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.match-card-details-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 12px;
}

.match-card-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #374151;
}

.match-badge-probability {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
}

.match-card-more {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    margin-top: 8px;
}

/* Estado vacío */
.match-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6b7280;

    text-align: center;
    width: 100%;
    grid-column: 1 / -1;
    padding: 40px 0 !important;
}

.match-empty svg {
    margin-bottom: 24px;
    color: #d1d5db;
}

.match-empty h3 {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.match-empty p {
    font-size: 14px;
    color: #9ca3af;
    max-width: 400px;
}

/* Histórico de conciliados */
.match-conciliados-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-conciliado-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.match-conciliado-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #2563eb;
}

.match-conciliado-info {
    flex: 1;
}

.match-conciliado-proveedor {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.match-conciliado-meta {
    font-size: 13px;
    color: #6b7280;
}

.match-conciliado-importe {
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
}

/* Modales */
.match-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.match-modal.active {
    display: flex;
}

.match-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.match-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
}

.match-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.match-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.match-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.match-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.match-modal-section {
    margin-bottom: 28px;
}

.match-modal-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.match-doc-info {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px;
}

.match-doc-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.match-doc-info-label {
    font-weight: 500;
    color: #6b7280;
}

.match-albaranes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.match-albaran-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.match-albaran-item:hover {
    background: #f3f4f6;
}

.match-albaran-item:has(.albaran-checkbox:checked) {
    background: #eff6ff;
    border-color: #2563eb;
}

.albaran-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.match-albaran-item-info {
    flex: 1;
}

.match-albaran-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.match-albaran-item-meta {
    font-size: 12px;
    color: #6b7280;
}

.match-modal-totales {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px;
}

.match-modal-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.match-modal-total-row:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
}

.match-modal-diferencia {
    font-weight: 600;
    font-size: 15px;
}

.match-modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
}

.match-modal-actions .btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    #conciliaciones-pendientes {
        grid-template-columns: 1fr;
    }
    
    .match-card-totales {
        grid-template-columns: 1fr;
    }
    
    .match-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

