/* ==========================================================================
   premium-optical-pos.css
   Estilos Ultra-Premium para el Punto de Venta Óptico (Glassmorphism / Neumorphism)
   ========================================================================== */

:root {
    --primary-color: #2563eb;
    --primary-light: #eff6ff;
    --primary-dark: #1e40af;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    --card-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
}

/* --- Tarjeta Principal de Venta --- */
.sales-card-premium {
    background: var(--glass-bg);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    border: var(--glass-border);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 24px;
}

.sales-card-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.12);
}

/* Header con Gradiente Sutil */
.sales-header-premium {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sales-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Badge de Factura Premium --- */
.invoice-badge-container {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 16px;
    padding: 16px;
    margin: 20px 24px;
    border: 1px solid rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.invoice-icon-box {
    background: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.invoice-number-display {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-dark);
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- Inputs Premium --- */
.customer-info-premium {
    padding: 0 24px 24px;
}

.label-premium {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 10px;
    display: block;
}

.input-premium {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.95rem;
    color: #1e293b;
    transition: all 0.2s ease;
    outline: none;
}

.input-premium:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-premium::placeholder {
    color: #94a3b8;
}

/* --- Botones Mini Premium --- */
.btn-mini-premium {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-mini-premium:hover {
    background: rgba(14, 165, 233, 0.2);
    transform: translateY(-1px);
}

/* --- Switch de Abono --- */
.abono-section-premium {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-radius: 16px;
    padding: 16px;
    margin-top: 16px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.abono-label {
    font-weight: 700;
    color: #9a3412;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle Switch Custom */
.toggle-switch {
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-switch {
    background: var(--accent-orange);
}

input:checked+.toggle-switch::after {
    transform: translateX(20px);
}

/* --- Panel de Deuda --- */
.debt-panel-premium {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.92) 100%);
    border-radius: 16px;
    padding: 0;
    margin-top: 0;
    border: 1px solid rgba(254, 202, 202, 0.9);
    box-shadow:
        0 14px 30px -22px rgba(2, 6, 23, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    position: relative;
    overflow: hidden;
    transform: translateY(-10px) scale(0.985);
    opacity: 0;
    max-height: 0;
    pointer-events: none;
    transition: max-height 0.32s cubic-bezier(0.22, 1, 0.36, 1), padding 0.32s cubic-bezier(0.22, 1, 0.36, 1), margin-top 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, opacity;
}

.debt-panel-premium::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: radial-gradient(900px 220px at 12% -20%, rgba(59, 130, 246, 0.14) 0%, rgba(59, 130, 246, 0) 60%),
        radial-gradient(900px 220px at 88% 120%, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0) 62%);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.debt-panel-premium.is-open {
    max-height: 320px;
    padding: 16px;
    margin-top: 12px;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: debtPanelPulse 1.2s ease-out 1;
}

.debt-panel-premium.is-open::before {
    opacity: 1;
    transform: translateY(0);
}

.debt-prev-paid {
    font-size: 0.75rem;
    font-weight: 700;
    color: #059669;
    text-align: right;
    margin-bottom: 8px;
}

.progress-bar-container {
    height: 8px;
    background: #fee2e2;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
}

.progress-bar-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.65) 50%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

.debt-panel-premium.is-open .progress-bar-container::after {
    opacity: 1;
    animation: debtBarShine 1.25s linear infinite;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f87171);
    width: 0%;
    transition: width 0.5s ease;
}

.debt-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 8px;
}

.debt-total {
    font-weight: 800;
    color: #dc2626;
    font-size: 1.1rem;
    transition: transform 0.25s ease, color 0.25s ease;
}

.debt-panel-premium.is-open .debt-total {
    transform: translateY(-1px);
}

@keyframes debtPanelPulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(239, 68, 68, 0.0),
            0 14px 30px -22px rgba(2, 6, 23, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.65);
    }

    55% {
        box-shadow:
            0 0 0 6px rgba(59, 130, 246, 0.12),
            0 18px 38px -26px rgba(2, 6, 23, 0.45),
            inset 0 1px 0 rgba(255, 255, 255, 0.65);
    }

    100% {
        box-shadow:
            0 0 0 0 rgba(59, 130, 246, 0.0),
            0 14px 30px -22px rgba(2, 6, 23, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.65);
    }
}

@keyframes debtBarShine {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(120%);
    }
}

/* ==========================================================================
   ADVANCED PREMIUM COMPONENTS (Added for Sales Interface Improvement)
   ========================================================================== */

/* --- Venta Mostrador Premium --- */
.pos-card-mostrador-premium {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    padding: 16px;
    min-height: 120px;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.pos-card-mostrador-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    border-color: #bfdbfe;
}

.pos-header-label-premium {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

/* --- Sales Mode Selector --- */
.sales-mode-card-premium {
    background: white;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--card-shadow);
    margin-top: auto;
}

.sales-mode-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--primary-light);
    border-radius: 10px;
    border: 1px solid #bfdbfe;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Product List Premium --- */
.product-list-container-premium {
    margin: 0 0 24px 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
}

.product-list-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(14, 165, 233, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-list-title {
    margin: 0;
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-count-badge {
    background: #0ea5e9;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
}

.product-list-column-headers {
    display: grid;
    grid-template-columns: 2fr 0.8fr 1fr 40px;
    gap: 8px;
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.product-list-scroll-area {
    max-height: 280px;
    overflow-y: auto;
    background: white;
}

/* Custom Scrollbar */
.product-list-scroll-area::-webkit-scrollbar {
    width: 8px;
}

.product-list-scroll-area::-webkit-scrollbar-track {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
}

.product-list-scroll-area::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    border-radius: 10px;
    border: 2px solid #f8fafc;
}

.product-list-scroll-area::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
}

.product-list-footer {
    background: #f0f9ff;
    padding: 16px;
    border-top: 1px solid #e0f2fe;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-list-total-label {
    font-weight: 700;
    color: #0369a1;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.product-list-total-amount {
    text-align: right;
    font-size: 1.6rem;
    font-weight: 900;
    color: #0284c7;
}

/* --- Payment Selector Premium --- */
.payment-selector-btn-premium {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.payment-selector-btn-premium:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.payment-selector-btn-premium.is-open {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.payment-dropdown-premium {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px) scale(0.98);
    transform-origin: top center;
    opacity: 0;
    width: min(440px, calc(100vw - 24px));
    max-height: 380px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.92);
    /* removed backdrop-filter */
    -webkit-/* removed backdrop-filter */
    border: 2px solid var(--primary-color);
    border-radius: 14px;
    box-shadow: 0 22px 60px rgba(2, 6, 23, 0.16);
    z-index: 1000;
    padding: 12px;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.payment-dropdown-premium.is-open {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.payment-dropdown-title {
    text-align: center;
    margin-bottom: 12px;
}

.payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

/* --- Search Dropdown Premium --- */
.search-results-dropdown-premium {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    margin-top: 8px;
}

.search-results-dropdown-premium::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown-premium::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
/* --- Product List Item Premium --- */
.product-list-item {
    display: grid;
    grid-template-columns: 2fr 0.8fr 1fr 40px;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    transition: background 0.2s;
}

.product-list-item:hover {
    background-color: #f8fafc;
}

.product-list-item.is-service {
    background-color: #f0f9ff;
}

.product-item-desc {
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
    font-size: 0.85rem;
}

.product-item-qty {
    text-align: center;
}

.product-item-qty span {
    font-weight: bold;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.product-item-total {
    text-align: right;
}

.product-item-total-amount {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.product-item-delete {
    text-align: right;
}

.btn-delete-item {
    width: 26px;
    height: 26px;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-item:hover {
    background: #fecaca;
    transform: scale(1.05);
}

.discount-input {
    width: 40px;
    padding: 2px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
}

/* --- Payment Option Selected State --- */
.pago-option.pago-selected {
    border-color: var(--primary-color) !important;
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.12), inset 0 0 0 2px rgba(2, 132, 199, 0.08) !important;
    transform: translateY(-2px);
}

.pago-option[data-value="Mixto"].pago-selected {
    border-color: #f59e0b !important;
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.25), inset 0 0 0 2px rgba(251, 191, 36, 0.15) !important;
}
