/* Modern Mobile App Design */
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, #faf5ff 0%, #f3f4f6 100%);
    color: var(--dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }
  
  .app-wrapper {
    min-height: 100vh;
    padding-bottom: 2rem;
  }
  
  /* Status Bar */
  .status-bar {
    height: env(safe-area-inset-top);
    background: var(--primary);
  }
  
  /* App Header */
  .app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
  }
  
  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 640px;
    margin: 0 auto;
  }
  
  .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  
  .app-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--white);
  }
  
  .app-info {
    color: var(--white);
  }
  
  .app-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
  }
  
  .app-subtitle {
    font-size: 0.8125rem;
    opacity: 0.85;
    font-weight: 500;
    letter-spacing: 0.3px;
  }
  
  .cart-button {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 14px;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cart-button:active {
    transform: scale(0.92);
  }
  
  .cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: var(--white);
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  
  /* Main Content */
  .main-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  /* Card Component */
  .card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
  }
  
  .card-header i {
    font-size: 1.5rem;
    color: var(--primary);
  }
  
  .card-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
  }
  
  .card-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
  }
  
  .card-body {
    padding: 1.5rem;
  }
  
  /* Custom Select */
  .custom-select {
    position: relative;
  }
  
  .custom-select select {
    width: 100%;
    padding: 1rem 3rem 1rem 1.25rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .custom-select select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
  }
  
  .custom-select i {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--gray-400);
    pointer-events: none;
    transition: transform 0.3s ease;
  }
  
  .custom-select select:focus + i {
    transform: translateY(-50%) rotate(180deg);
  }
  
  /* Scanner */
  .scanner-container {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    display: none;
    box-shadow: var(--shadow);
  }
  
  .scanner-container.active {
    display: block;
    animation: fadeIn 0.3s ease;
  }
  
  /* Estilos para mostrar código escaneado */
  .scan-result {
    display: none;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .scan-result.active {
    display: flex;
  }
  
  .scan-result.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
  }
  
  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .scan-result-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--white);
    flex-shrink: 0;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  
  @keyframes scaleIn {
    0% {
      transform: scale(0);
      opacity: 0;
    }
    50% {
      transform: scale(1.1);
    }
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }
  
  .scan-result-content {
    flex: 1;
    min-width: 0;
  }
  
  .scan-result-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .scan-result-code {
    font-size: 1.375rem;
    font-weight: 900;
    color: var(--white);
    font-family: "Courier New", monospace;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  .scanner-actions {
    display: flex;
    gap: 0.75rem;
  }
  
  /* Manual Input */
  .manual-input {
    display: none;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
  }
  
  .manual-input.active {
    display: flex;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .input-wrapper {
    position: relative;
    flex: 1;
  }
  
  .input-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--gray-400);
  }
  
  .input-wrapper input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3.5rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-900);
    transition: all 0.3s ease;
  }
  
  .input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
  }
  
  /* Buttons */
  .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
  }
  
  .btn:active {
    transform: scale(0.96);
  }
  
  .btn-large {
    padding: 1.125rem 1.75rem;
    font-size: 1.0625rem;
  }
  
  .btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
    flex: 1;
  }
  
  .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
  }
  
  .btn-primary.scanning {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  }
  
  .btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
  }
  
  .btn-secondary.active {
    background: var(--primary-light);
    color: var(--white);
  }
  
  .btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  }
  
  .btn-dark {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  }
  
  .btn-icon {
    width: 56px;
    padding: 0;
    font-size: 1.5rem;
  }
  
  /* Product Card */
  .product-card {
    display: none;
  }
  
  .product-card.active {
    display: block;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  
  @keyframes popIn {
    0% {
      opacity: 0;
      transform: scale(0.9) translateY(20px);
    }
    100% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }
  
  .product-image {
    height: 240px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.3);
  }
  
  .product-info {
    margin-bottom: 1.25rem;
  }
  
  .product-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
  }
  
  .product-description {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.6;
  }
  
  .product-price {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 0.875rem 1.75rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
  }
  
  .currency {
    font-size: 1.5rem;
    font-weight: 700;
  }
  
  .amount {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1px;
  }
  
  .product-specs {
    background: var(--gray-50);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }
  
  .spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
  }
  
  .spec-item:last-child {
    border-bottom: none;
  }
  
  .spec-label {
    font-size: 0.9375rem;
    color: var(--gray-600);
    font-weight: 500;
  }
  
  .spec-value {
    font-size: 0.9375rem;
    color: var(--gray-900);
    font-weight: 700;
  }
  
  /* Cart */
  .items-count {
    background: var(--primary-light);
    color: var(--white);
    padding: 0.375rem 0.875rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 700;
  }
  
  .cart-items {
    min-height: 200px;
  }
  
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
  }
  
  .empty-state i {
    font-size: 5rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
  }
  
  .empty-state p {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
  }
  
  .empty-state span {
    font-size: 0.9375rem;
    color: var(--gray-400);
  }
  
  .cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
  }
  
  .cart-item:active {
    transform: scale(0.98);
  }
  
  .cart-item-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--white);
    flex-shrink: 0;
  }
  
  .cart-item-details {
    flex: 1;
    min-width: 0;
  }
  
  .cart-item-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .cart-item-price {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--primary);
  }
  
  .cart-item-remove {
    width: 40px;
    height: 40px;
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
  }
  
  .cart-item-remove:active {
    transform: scale(0.9);
  }
  
  .cart-footer {
    display: none;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 2px solid var(--gray-200);
  }
  
  .cart-footer.active {
    display: block;
  }
  
  .total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
  }
  
  .total-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-700);
  }
  
  .total-price {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -1px;
  }
  
  /* Toast */
  .toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(10px);
    color: var(--white);
    padding: 1rem 1.75rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100% - 2rem);
  }
  
  .toast.show {
    bottom: 2rem;
  }
  
  .toast-icon {
    font-size: 1.5rem;
  }
  
  /* Responsive */
  @media (max-width: 380px) {
    .app-title {
      font-size: 1.25rem;
    }
  
    .app-subtitle {
      font-size: 0.75rem;
    }
  
    .product-price {
      padding: 0.75rem 1.5rem;
    }
  
    .amount {
      font-size: 2rem;
    }
  }
.product-image {
    width: 100%;
    height: 260px;
    background: linear-gradient(135deg,#b388ff,#7c4dff);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}

    .product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* ← clave */
        background: linear-gradient(135deg,#b388ff,#7c4dff);
        padding: 10px; /* opcional: separa un poquito */
    }


    .product-image .bi {
        font-size: 90px;
        color: white;
        opacity: .7;
    }

#installBtn {
    width: 90%;
    border-radius: 16px;
}


.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    width: min(92vw, 360px);
    background: white;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 12px 35px rgba(0,0,0,.25);
}

    .login-card h3 {
        margin: 0 0 6px 0;
    }

.login-sub {
    margin: 0 0 12px 0;
    opacity: .7;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
}

.login-error {
    margin-top: 10px;
    color: #b91c1c;
    font-size: 14px;
    min-height: 18px;
}


.store-name {
    font-size: 18px;
    font-weight: 700;
    padding: 12px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.qty-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #ede9fe;
    color: #4c1d95;
    font-size: 18px;
    font-weight: 700;
}

.qty-value {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
}

.payment-method {
    margin-top: 12px;
    margin-bottom: 12px;
}

.payment-title {
    font-size: 13px;
    opacity: .85;
    margin-bottom: 8px;
}

.payment-switch {
    display: flex;
    gap: 10px;
}

.pay-btn {
    flex: 1;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    border-radius: 12px;
    padding: 12px 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

    .pay-btn.active {
        background: #7c3aed;
        color: #fff;
        border-color: #7c3aed;
    }


/* ===========================
   Cobro overlay
=========================== */
.pay-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 9999;
}

.pay-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

.pay-title {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 12px;
}

.pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.pay-label {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    opacity: .85;
}

.pay-input {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    font-size: 18px;
    outline: none;
}

.pay-error {
    margin-top: 10px;
    color: #dc2626;
    font-size: 14px;
    min-height: 18px;
}

.pay-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.pay-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 16px;
}

    .pay-btn.primary {
        background: #7c3aed;
        color: #fff;
    }

    .pay-btn.secondary {
        background: #f3f4f6;
        color: #111827;
    }

/* oculto por defecto */
.scanner-flash {
    display: none;
    margin-top: 10px;
    justify-content: flex-end;
}

    /* cuando el scanner está activo se muestra */
    .scanner-flash.active {
        display: flex;
    }

#flashToggleBtn.active {
    background: #fde047;
    border-color: #fde047;
    color: #111827;
}
