/* =========================================================================
   🧾 CONTENEDOR PRINCIPAL FACTURACIÓN
   ========================================================================= */

.factura-main-container {
    width: 100%;
    padding: 20px;
}

/* =========================================================================
   📦 CARD PRINCIPAL FACTURACIÓN
   ========================================================================= */

.factura-card-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* =========================================================================
   📋 HEADER FACTURACIÓN
   ========================================================================= */

.factura-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f1f1;
}

.factura-header-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1A1A1A;
}

/* =========================================================================
   📝 FORMULARIO FACTURACIÓN
   ========================================================================= */

.factura-form-container {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 20px;
    align-items: end;
}

/* =========================================================================
   📐 POSICIONAMIENTO CAMPOS
   ========================================================================= */

.factura-producto-rgb-container {
    grid-column: 1;
    grid-row: 1;
}

.factura-cliente-group {
    grid-column: 2;
    grid-row: 1;
}

.factura-id-group {
    grid-column: 3;
    grid-row: 1;
}

.factura-descripcion-group {
    grid-column: 1;
    grid-row: 2;
}

.factura-cantidad-group {
    grid-column: 2;
    grid-row: 2;
}

.factura-precio-group {
    grid-column: 3;
    grid-row: 2;
}

/* =========================================================================
   🔢 INPUTS GENERALES
   ========================================================================= */

.factura-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.factura-label {
    font-size: 0.92rem;
    font-weight: 500;
    color: #444;
}

.factura-input {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #dcdcdc;
    padding: 0 14px;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.factura-input:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.10);
}

/* =========================================================================
   🔢 CONTROL PERSONALIZADO CANTIDAD
   ========================================================================= */

.factura-number-control {
    display: flex;
    align-items: center;
    height: 44px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #dcdcdc;
    background: white;
    transition: all 0.2s ease;
}

.factura-number-control:focus-within {
    border-color: #2ecc71;
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.10);
}

/* =========================================================================
   ➖ ➕ BOTONES
   ========================================================================= */

.factura-number-btn {
    width: 46px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1A1A1A;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.factura-number-btn:hover {
    background: #2ecc71;
}

/* =========================================================================
   🔢 INPUT CANTIDAD
   ========================================================================= */

.factura-number-input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #1A1A1A;
    background: white;
    -moz-appearance: textfield;
}

.factura-number-input::-webkit-outer-spin-button,
.factura-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================================================
   🌈 INPUT PRODUCTO RGB
   ========================================================================= */

.factura-producto-rgb-container {
    position: relative;
    padding: 3px;
    border-radius: 14px;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00ab, #ff0000);
    background-size: 300%;
    animation: facturaRgbMove 6s linear infinite;
}

.factura-producto-input {
    width: 100%;
    height: 44px;
    border: none;
    outline: none;
    border-radius: 13px;
    background: #0d0d0d;
    color: white;
    padding: 0 16px;
    font-size: 0.95rem;
}

.factura-producto-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* =========================================================================
   ✨ ANIMACIÓN RGB
   ========================================================================= */

@keyframes facturaRgbMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* =========================================================================
   🔘 BOTONES PREMIUM 3D FACTURACIÓN
   ========================================================================= */

.factura-actions-container {
    display: flex;
    gap: 18px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.factura-btn-3d-container {
    position: relative;
    background: transparent;
    padding: 0;
    border: none;
    cursor: pointer;
    outline-offset: 4px;
    outline-color: #2ecc71;
    transition: filter 250ms;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.factura-btn-3d-shadow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 204, 113, 0.65);
    border-radius: 12px;
    filter: blur(2px);
    will-change: transform;
    transform: translateY(2px);
    transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
}

.factura-btn-3d-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(to right, #2ecc71 0%, #1f8d4d 8%, #2ecc71 92%, #2ecc71 100%);
}

.factura-btn-3d-front {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    background: #1A1A1A;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Ubuntu', sans-serif;
    transform: translateY(-4px);
    transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1), background 250ms ease;
}

.factura-btn-3d-container:hover {
    filter: brightness(110%);
}

.factura-btn-3d-container:hover .factura-btn-3d-front {
    background: #2ecc71;
    transform: translateY(-6px);
    transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5);
}

.factura-btn-3d-container:hover .factura-btn-3d-shadow {
    transform: translateY(4px);
    transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5);
}

.factura-btn-3d-container:active .factura-btn-3d-front {
    transform: translateY(-2px);
    transition: transform 34ms;
}

.factura-btn-3d-container:active .factura-btn-3d-shadow {
    transform: translateY(1px);
    transition: transform 34ms;
}

.factura-btn-3d-container:focus:not(:focus-visible) {
    outline: none;
}

/* =========================================================================
   📊 TABLA FACTURACIÓN
   ========================================================================= */

.factura-table-scroll-container {
    overflow-y: auto;
    border-radius: 18px;
    border: 1px solid #f1f1f1;
}

.factura-table-container {
    width: 100%;
    border-collapse: collapse;
}

.factura-table-head {
    position: sticky;
    top: 0;
    z-index: 10;
}

.factura-table-row-header {
    background: #111;
}

.factura-table-row-header td {
    padding: 16px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.factura-table-body tr {
    border-bottom: 1px solid #f1f1f1;
    transition: all 0.2s ease;
}

.factura-table-body tr:hover {
    background: rgba(46, 204, 113, 0.10);
}

.factura-table-body td {
    padding: 15px;
    font-size: 0.95rem;
    color: #2C3E50;
}

.factura-btn-delete {
    background: #ffeded;
    color: #d63031;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.factura-btn-delete:hover {
    background: #d63031;
    color: white;
    transform: translateY(-2px);
}

/* =========================================================================
   📄 PAGINACIÓN PREMIUM FACTURACIÓN
   ========================================================================= */

.factura-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f1f1f1;
    margin-top: 10px;
}

.factura-info-pagination {
    font-size: 0.92rem;
    color: #777;
    font-weight: 500;
}

.factura-pagination-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.factura-page-number {
    background: #f5f5f5;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1A1A1A;
}

.factura-btn-pagination {
    border: none;
    background: #1A1A1A;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.factura-btn-pagination:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

.factura-btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================================
   💰 CONTENEDOR TOTALES FACTURACIÓN (COMPACTADO Y OPTIMIZADO)
   ========================================================================= */

.factura-totals-container {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* 🌈 TARJETAS RGB TOTALES (ALTURA REDUCIDA) */
.factura-total-card {
    position: relative;
    padding: 3px;
    border-radius: 14px;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00ab, #ff0000);
    background-size: 400%;
    animation: facturaRgbMove 9s linear infinite;
    min-width: 145px;
    max-width: 145px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 14px; /* Reducido padding para hacerlas menos altas */
}

/* FONDO INTERNO */
.factura-total-card::before {
    content: "";
    position: absolute;
    inset: 2px; /* Ajustado borde fino */
    background: #0d0d0d;
    border-radius: 12px;
    z-index: 1;
}

/* CONTENIDO ENCIMA */
.factura-total-card > * {
    position: relative;
    z-index: 2;
}

/* 📝 TEXTO TÍTULO */
.factura-total-title {
    display: block;
    color: rgba(255, 255, 255, 0.70);
    font-size: 0.80rem; /* Ligeramente más pequeño */
    margin-bottom: 3px; /* Menor separación */
    font-weight: 500;
}

/* 💲 MONTO TOTAL */
.factura-total-amount {
    color: white;
    font-size: 1.10rem; /* Más compacto y legible */
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ✨ TARJETA TOTAL FINAL */
.factura-total-final-card {
    background: linear-gradient(45deg, #2ecc71, #00ff95, #2ecc71);
    background-size: 300%;
}

/* =========================================================================
   💱 ESTILOS EXTRA PARA TASA DE CONVERSIÓN (COMPACTA)
   ========================================================================= */

.factura-conversion-card {
    min-height: auto; /* Quitada la restricción de altura anterior */
}

/* Estilo para el texto interactivo de "Actualizar" */
.factura-conversion-link {
    display: inline-block;
    color: #2ecc71;
    font-size: 0.70rem; /* Más pequeño para no empujar la tarjeta */
    margin-top: 4px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
    font-weight: 500;
}

.factura-conversion-link:hover {
    color: #00ff95;
}

/* =========================================================================
   📦 DROPDOWN PRODUCTOS FACTURACIÓN
   ========================================================================= */

.factura-dropdown-productos {
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    background: #111;
    border-radius: 14px;
    overflow: hidden;
    z-index: 1000;
    display: none;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 30px rgba(0,0,0,0.30);
    max-height: 260px;
    overflow-y: auto;
}

.factura-dropdown-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.factura-dropdown-item strong {
    display: block;
    color: white;
    font-size: 0.95rem;
}

.factura-dropdown-item span {
    color: rgba(255,255,255,0.60);
    font-size: 0.82rem;
}

.factura-dropdown-item:hover {
    background: rgba(46, 204, 113, 0.18);
}

/* =========================================================================
   👤 DROPDOWN CLIENTES FACTURACIÓN
   ========================================================================= */

.factura-combobox-container {
    position: relative;
}

.factura-dropdown-clientes {
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    background: #111;
    border-radius: 14px;
    overflow: hidden;
    z-index: 1000;
    display: none;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 30px rgba(0,0,0,0.30);
    max-height: 260px;
    overflow-y: auto;
}

.factura-dropdown-cliente-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.factura-dropdown-cliente-item strong {
    display: block;
    color: white;
    font-size: 0.95rem;
}

.factura-dropdown-cliente-item span {
    color: rgba(255,255,255,0.60);
    font-size: 0.82rem;
}

.factura-dropdown-cliente-item:hover {
    background: rgba(46, 204, 113, 0.18);
}

/* =========================================================================
   📱 RESPONSIVE
   ========================================================================= */

@media (max-width: 991px) {
    .factura-form-container {
        grid-template-columns: 1fr;
    }
    .factura-producto-rgb-container,
    .factura-cliente-group,
    .factura-id-group,
    .factura-descripcion-group,
    .factura-cantidad-group,
    .factura-precio-group {
        grid-column: auto;
        grid-row: auto;
    }
    .factura-actions-container {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .factura-pagination-container {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    .factura-totals-container {
        justify-content: center;
    }
    .factura-total-card {
        width: 100%;
        max-width: none;
    }
}