/* ==========================================================================
   SISTEMA DE DISEÑO PREMIUM - TOTALIZADOR SAINT ENTERPRISE ERP
   Aesthetically crafted with Glassmorphism, Dark Neon Cyber-ERP & Responsive UI
   ========================================================================== */

:root {
    /* Paleta Base Oscura & Profundidad */
    --bg-main: #06090e;
    --bg-secondary: #0c121e;
    --bg-card: rgba(16, 24, 40, 0.75);
    --bg-card-hover: rgba(22, 34, 56, 0.85);
    --bg-input: rgba(9, 14, 24, 0.8);
    --border-card: rgba(0, 242, 254, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.08);

    /* Acentos & Gradientes Neón */
    --cyan-glow: #00f2fe;
    --blue-glow: #4facfe;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent-emerald: #00f0a8;
    --accent-emerald-glow: rgba(0, 240, 168, 0.3);
    --accent-amber: #ffb300;
    --accent-rose: #ff4757;
    --combo-purple: #a855f7;
    --combo-gradient: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);

    /* Tipografía */
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-pure: #ffffff;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Sombras & Efectos */
    --shadow-card: 0 16px 36px -8px rgba(0, 0, 0, 0.6), 0 0 20px -5px rgba(0, 242, 254, 0.08);
    --shadow-button: 0 8px 24px -4px rgba(0, 242, 254, 0.35);
    --shadow-emerald: 0 8px 24px -4px rgba(0, 240, 168, 0.4);
    --glass-blur: blur(16px);
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 15% 10%, rgba(0, 242, 254, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(79, 172, 254, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(12, 18, 30, 0.6) 0%, transparent 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(6, 9, 14, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 254, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 242, 254, 0.4);
}

/* --------------------------------------------------------------------------
   HEADER PRINCIPAL
   -------------------------------------------------------------------------- */
.app-header {
    background: rgba(12, 18, 30, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: #050811;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 30%, var(--cyan-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-status-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.status-badge.status-online {
    background: rgba(0, 240, 168, 0.1);
    color: var(--accent-emerald);
    border-color: rgba(0, 240, 168, 0.25);
}

.status-badge.status-offline {
    background: rgba(255, 71, 87, 0.1);
    color: var(--accent-rose);
    border-color: rgba(255, 71, 87, 0.25);
}

.status-badge.status-checking {
    background: rgba(255, 179, 0, 0.1);
    color: var(--accent-amber);
    border-color: rgba(255, 179, 0, 0.25);
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.rate-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.rate-badge strong {
    color: var(--text-pure);
}

.header-user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: rgba(0, 242, 254, 0.2);
    color: var(--cyan-glow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(0, 242, 254, 0.1);
    color: var(--cyan-glow);
    border-color: rgba(0, 242, 254, 0.3);
}

.btn-logout {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.2);
    color: var(--accent-rose);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: var(--accent-rose);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   LAYOUT PRINCIPAL
   -------------------------------------------------------------------------- */
.app-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 20px;
    flex: 1;
}

/* Columna Izquierda: Operaciones y Catálogo */
.left-workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Barra de Escáner Láser */
.scanner-bar {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 14px;
}

.scanner-icon-pulse {
    width: 44px;
    height: 44px;
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--cyan-glow);
    animation: scannerPulse 3s infinite;
}

@keyframes scannerPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 242, 254, 0.15); }
    50% { box-shadow: 0 0 25px rgba(0, 242, 254, 0.45); }
}

.scanner-input-wrap {
    flex: 1;
    position: relative;
}

.scanner-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(0, 242, 254, 0.25);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text-pure);
    transition: var(--transition-fast);
}

.scanner-input:focus {
    outline: none;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 16px rgba(0, 242, 254, 0.25);
}

.scanner-input::placeholder {
    color: var(--text-muted);
}

.scanner-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scanner-hint-tag {
    background: rgba(0, 242, 254, 0.1);
    color: var(--cyan-glow);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Tarjeta de Cliente Activo */
.client-strip {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.client-strip-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.client-avatar {
    width: 42px;
    height: 42px;
    background: rgba(79, 172, 254, 0.15);
    border: 1px solid rgba(79, 172, 254, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-glow);
    font-size: 1.2rem;
}

.client-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-pure);
}

.client-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

.btn-change-client {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-change-client:hover {
    background: rgba(0, 242, 254, 0.1);
    color: var(--cyan-glow);
    border-color: rgba(0, 242, 254, 0.3);
}

/* Catálogo y Búsqueda */
.catalog-section {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.catalog-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-pure);
}

.search-product-input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 260px;
    transition: var(--transition-fast);
}

.search-product-input:focus {
    outline: none;
    border-color: var(--cyan-glow);
    width: 320px;
}

/* Grid de Productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    overflow-y: auto;
    max-height: 520px;
    padding-right: 4px;
}

.product-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    transition: var(--transition-fast);
    position: relative;
}

.product-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.product-card.card-combo {
    border-left: 3px solid var(--combo-purple);
}

.card-badges {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.badge-combo {
    background: var(--combo-gradient);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.badge-stock {
    font-size: 0.72rem;
    color: var(--accent-emerald);
    background: rgba(0, 240, 168, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.badge-stock.out-of-stock {
    color: var(--accent-rose);
    background: rgba(255, 71, 87, 0.1);
}

.product-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.product-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-pure);
    line-height: 1.35;
    height: 38px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

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

.product-pricing {
    margin-top: 4px;
}

.price-bs {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cyan-glow);
}

.price-usd {
    font-size: 0.8rem;
    color: var(--accent-emerald);
    font-weight: 600;
}

.btn-add-product {
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--cyan-glow);
    padding: 7px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-add-product:hover {
    background: var(--primary-gradient);
    color: #050811;
    border-color: transparent;
    box-shadow: var(--shadow-button);
}

/* --------------------------------------------------------------------------
   COLUMNA DERECHA: CARRITO DE COMPRAS & TOTALIZADOR
   -------------------------------------------------------------------------- */
.cart-panel {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: calc(100vh - 110px);
    position: sticky;
    top: 86px;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}

.cart-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-pure);
}

.cart-badge {
    background: var(--primary-gradient);
    color: #050811;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.btn-clear-cart {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-clear-cart:hover {
    color: var(--accent-rose);
}

/* Lista de Renglones en Carrito */
.cart-items-list {
    flex: 1;
    overflow-y: auto;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.cart-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
}

.cart-empty-icon {
    font-size: 3rem;
    opacity: 0.4;
}

.cart-item-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-fast);
}

.cart-item-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 242, 254, 0.2);
}

.cart-item-row.cart-item-combo {
    border-left: 3px solid var(--combo-purple);
}

.cart-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-pure);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-combo-mini {
    background: var(--combo-gradient);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

.badge-scale-mini {
    background: rgba(0, 240, 168, 0.15);
    color: var(--accent-emerald);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 168, 0.3);
}

.cart-item-sub {
    display: flex;
    gap: 10px;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.qty-control {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.btn-qty {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.btn-qty:hover {
    background: rgba(0, 242, 254, 0.2);
    color: var(--cyan-glow);
}

.input-qty {
    width: 48px;
    background: transparent;
    border: none;
    color: var(--text-pure);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.input-qty:focus {
    outline: none;
}

.cart-item-total {
    text-align: right;
}

.item-total-bs {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-pure);
}

.item-total-usd {
    font-size: 0.75rem;
    color: var(--accent-emerald);
    font-weight: 600;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: var(--transition-fast);
}

.btn-remove-item:hover {
    color: var(--accent-rose);
}

/* Tarjeta de Resumen Financiero */
.cart-summary-card {
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-subtle);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.summary-row.total-bs-row {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-pure);
}

.total-bs-val {
    color: var(--cyan-glow);
    font-size: 1.35rem;
}

.summary-row.total-usd-row {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-emerald);
}

.btn-totalizar {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    color: #050811;
    padding: 14px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-button);
    transition: var(--transition-fast);
    margin-top: 10px;
}

.btn-totalizar:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 242, 254, 0.5);
}

.btn-totalizar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --------------------------------------------------------------------------
   SISTEMA DE MODALES
   -------------------------------------------------------------------------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 7, 12, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: #0f172a;
    border: 1px solid var(--border-card);
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    z-index: 2;
    overflow: hidden;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { transform: scale(0.92) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-pure);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-rose);
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Formularios dentro de Modales */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text-pure);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #050811;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Lista de Búsqueda de Clientes Modal */
.client-search-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.client-search-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 242, 254, 0.3);
}

.client-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-pure);
}

.client-item-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.btn-select-client {
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--cyan-glow);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-select-client:hover {
    background: var(--primary-gradient);
    color: #050811;
}

/* --------------------------------------------------------------------------
   SISTEMA DE NOTIFICACIONES TOAST
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 280px;
    max-width: 420px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 0.88rem;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-success {
    border-color: rgba(0, 240, 168, 0.3);
    border-left: 4px solid var(--accent-emerald);
}

.toast-success .toast-icon { color: var(--accent-emerald); }

.toast-error {
    border-color: rgba(255, 71, 87, 0.3);
    border-left: 4px solid var(--accent-rose);
}

.toast-error .toast-icon { color: var(--accent-rose); }

.toast-warning {
    border-color: rgba(255, 179, 0, 0.3);
    border-left: 4px solid var(--accent-amber);
}

.toast-warning .toast-icon { color: var(--accent-amber); }

.toast-info {
    border-color: rgba(0, 242, 254, 0.3);
    border-left: 4px solid var(--cyan-glow);
}

.toast-info .toast-icon { color: var(--cyan-glow); }

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    margin-left: auto;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   ESTILOS DE TICKET IMPRIMIBLE (80mm Térmico y Carta)
   -------------------------------------------------------------------------- */
.receipt-paper {
    background: #ffffff;
    color: #111827;
    padding: 24px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.35;
    max-width: 380px;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.receipt-header {
    text-align: center;
    margin-bottom: 12px;
}

.receipt-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.receipt-doc-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: #000;
    margin: 4px 0;
}

.receipt-divider {
    border-top: 1px dashed #4b5563;
    margin: 10px 0;
}

.receipt-info-grid {
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin: 8px 0;
}

.receipt-table th {
    text-align: left;
    border-bottom: 1px solid #111827;
    padding-bottom: 4px;
}

.receipt-table td {
    padding: 4px 0;
    vertical-align: top;
}

.receipt-table .col-desc { width: 50%; }
.receipt-table .col-qty { width: 15%; text-align: center; }
.receipt-table .col-price { width: 15%; text-align: right; }
.receipt-table .col-total { width: 20%; text-align: right; font-weight: 700; }

.receipt-table .item-part td {
    font-size: 0.72rem;
    color: #4b5563;
}

.receipt-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
}

.receipt-totals .total-row {
    display: flex;
    justify-content: space-between;
}

.receipt-totals .grand-total {
    font-size: 1rem;
    font-weight: 700;
    border-top: 1px solid #111827;
    padding-top: 6px;
}

.receipt-totals .usd-total {
    font-size: 0.9rem;
    font-weight: 700;
    color: #059669;
}

.receipt-footer {
    text-align: center;
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Estilos de Impresión Nativa */
@media print {
    body * {
        visibility: hidden;
    }
    #printable-receipt, #printable-receipt * {
        visibility: visible;
    }
    #printable-receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 80mm; /* Ancho térmico estándar */
        margin: 0;
        padding: 4mm;
        box-shadow: none;
        color: #000000;
    }
    @page {
        margin: 0;
        size: 80mm auto;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVIDAD (TABLETS Y MÓVILES)
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .cart-panel {
        height: auto;
        position: static;
        order: 2;
    }
    .left-workspace {
        order: 1;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .app-container {
        padding: 12px;
        gap: 14px;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .scanner-bar {
        padding: 12px 14px;
    }
    .client-strip {
        flex-direction: column;
        align-items: flex-start;
    }
    .btn-change-client {
        width: 100%;
        text-align: center;
    }
}
