:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --bg-overlay: rgba(15, 23, 42, 0.75);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --danger-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #0f172a;
    color: var(--text-primary);
    overflow: hidden;
}

.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('../Imagenes/Fondo1.jpg');
    background-size: cover;
    background-position: center;
    z-index: -2;
}

.bg-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: -1;
}

/* Glassmorphism utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.icon-btn:active {
    transform: scale(0.9);
}

.badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Main Content */
.app-content {
    position: fixed;
    top: 60px;
    bottom: 60px;
    left: 0;
    width: 100%;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: none; /* Firefox */
}
.app-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: block;
}

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

/* Dashboard */
.welcome-card {
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
}

.welcome-card h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    background: -webkit-linear-gradient(#fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.dashboard-grid .dash-item:first-child {
    grid-column: span 2;
}

.dash-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dash-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.dash-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.dash-item:hover img {
    transform: scale(1.1);
}

.dash-item span {
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    margin-bottom: 20px;
}

.search-bar i {
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

/* Product List */
.product-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.product-card:active {
    transform: scale(0.98);
}

.product-info {
    flex: 1;
}

.product-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-price {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 700;
}

.product-stock {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-add {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
    transition: background 0.3s;
}

.btn-add:hover {
    background: var(--primary-hover);
}

/* Cart - flex column layout with pinned footer */
#view-carrito {
    display: none;
    flex-direction: column;
    height: calc(100vh - 80px);
    overflow: hidden;
    padding: 0;
}
#view-carrito.active {
    display: flex !important;
}

.cart-header-fixed {
    flex-shrink: 0;
    border-radius: 16px 16px 0 0 !important;
}

.cart-footer-fixed {
    flex-shrink: 0;
    border-radius: 0 0 16px 16px !important;
}

#cart-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cart-container {
    padding: 20px;
}

.cart-container h3 {
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 4px;
    border-bottom: 1px solid var(--glass-border);
    gap: 8px;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 0.78rem;
    color: var(--secondary-color);
    margin-top: 2px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-item-qty span {
    font-weight: bold;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    flex-shrink: 0;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 20px 0;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}

/* Loading state for action buttons */
.btn-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}
.btn-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn {
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid var(--glass-border);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    border-bottom: none;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.3s;
    padding: 8px;
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 320px;
    padding: 24px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.qty-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

.qty-selector button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.qty-selector input {
    width: 60px;
    height: 40px;
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    color: white;
    font-size: 1.2rem;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 13px 24px;
    z-index: 9999;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 30px;
    max-width: 90vw;
    text-align: center;
    white-space: nowrap;
    transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.show {
    bottom: 90px;
}

/* Price Checker UI */
/* Price Checker UI - Modernized */
.pc-header {
    text-align: center;
    margin-bottom: 25px;
    color: white;
}
.pc-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}
.pc-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pc-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Wrapper & Modern Input */
.pc-search-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    width: 100%;
    align-items: stretch;
}
.pc-search-bar {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    flex: 1;
    min-height: 52px;
    transition: all 0.3s ease;
}
.pc-search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.pc-search-bar i {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-right: 12px;
    flex-shrink: 0;
}
.pc-search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    background: transparent;
    color: white;
}
.pc-search-bar input::placeholder {
    color: #64748b;
}

.pc-clear-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    flex-shrink: 0;
}
.pc-clear-btn:hover {
    color: var(--danger-color);
}

/* Scan button - premium pill with icon + text */
.pc-scan-btn {
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 0 18px;
    min-height: 52px;
    min-width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    letter-spacing: 0.3px;
}
.pc-scan-btn i {
    font-size: 1.15rem;
    flex-shrink: 0;
}
.pc-scan-btn .scan-label {
    display: inline;
}
.pc-scan-btn:active {
    transform: scale(0.93);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
@media (max-width: 400px) {
    .pc-scan-btn .scan-label {
        display: none;
    }
    .pc-scan-btn {
        padding: 0;
        width: 52px;
        border-radius: 50%;
    }
}

/* Modern Glass Card */
.pc-product-card {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px 20px 25px;
    position: relative;
    color: white;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: cardAppear 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardAppear {
    from { opacity: 0; transform: translateY(15px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.pc-code-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    padding: 5px 22px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    letter-spacing: 0.5px;
}
.pc-product-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    line-height: 1.25;
}
.pc-product-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Prices Grid */
.pc-prices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 24px;
}
.pc-price-box {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    padding: 30px 10px 15px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.pc-price-divisas {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.05);
}
.pc-price-normal {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.05);
}
.pc-price-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 4px 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
}
.pc-price-divisas .pc-price-header {
    background: rgba(16, 185, 129, 0.2);
    color: #4ade80;
}
.pc-price-normal .pc-price-header {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}
.pc-price-currency {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.pc-price-amount {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.pc-price-divisas .pc-price-amount {
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.pc-price-normal .pc-price-amount {
    color: #3b82f6;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.pc-extra-info {
    text-align: center;
    width: 100%;
}
.pc-footer-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 12px;
}


/* Scanner Animation CSS */
.scanner-laser {
    position: absolute;
    top: 0;
    left: 10%;
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    box-shadow: 0 0 16px #10b981, 0 0 6px #10b981;
    animation: scanAnimation 1.8s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
    border-radius: 2px;
}
@keyframes scanAnimation {
    0%   { top: 8%; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 92%; opacity: 0; }
}

/* Scanner modal: full screen on mobile */
#scanner-modal .modal-content {
    max-width: 500px;
    width: 96%;
    padding: 18px;
    position: relative;
}
@media (max-width: 480px) {
    #scanner-modal {
        padding: 0;
        align-items: flex-start;
    }
    #scanner-modal .modal-content {
        width: 100%;
        max-width: 100%;
        min-height: 100dvh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        padding: 20px 16px;
    }
    #scanner-reader-container {
        flex: 1;
        aspect-ratio: unset !important;
        min-height: 260px;
    }
}

/* Hide default html5-qrcode UI chrome (file input, selectors) */
#scanner-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 10px;
}
#scanner-reader img {
    display: none !important;
}
#scanner-reader select,
#scanner-reader__dashboard_section_swaplink,
#scanner-reader__dashboard,
#scanner-reader__filescan_input,
#scanner-reader__camera_permission_button {
    display: none !important;
}
#scanner-reader-container {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    border: 1px solid var(--glass-border);
}

/* Scanner corner overlay guide */
#scanner-reader-container::before,
#scanner-reader-container::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: #10b981;
    border-style: solid;
    z-index: 11;
    pointer-events: none;
}
#scanner-reader-container::before {
    top: 12px;
    left: 12px;
    border-width: 3px 0 0 3px;
    border-radius: 4px 0 0 0;
}
#scanner-reader-container::after {
    bottom: 12px;
    right: 12px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 4px 0;
}

/* Cuentas por Cobrar Styles */
.cxc-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
    cursor: pointer;
}

.cxc-card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.15);
}

.cxc-card-info {
    text-align: left;
    max-width: 70%;
}

.cxc-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cxc-card-rif {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cxc-card-balance {
    text-align: right;
}

.cxc-balance-amount {
    font-size: 1.1rem;
    font-weight: 700;
    display: block;
}

.cxc-balance-amount.debt {
    color: var(--danger-color);
}

.cxc-balance-amount.credit {
    color: var(--secondary-color);
}

.cxc-payment-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.cxc-payment-item-details {
    text-align: left;
}

.cxc-payment-item-amount {
    text-align: right;
    font-weight: bold;
    color: var(--secondary-color);
}


/ *   P r i c e   C h e c k e r   U I   * /  
 