@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #10b981;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 10px 30px -5px rgba(31, 38, 135, 0.08);
  --glass-inner-bevel: inset 0 1px 1px 0 rgba(255, 255, 255, 0.95);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f8fafc;
  overflow-x: clip;
  color: #1e293b;
}

/* Explicit Modal, Overlay & Pure State Hidden Visibility */
[id^="modal-"].hidden,
#cart-drawer-overlay.hidden,
.hidden:not([class*="sm:"]):not([class*="md:"]):not([class*="lg:"]):not([class*="xl:"]) {
  display: none !important;
}

/* ==========================================
   SMOOTH MODAL TRANSITIONS & NATIVE IOS BOTTOM SHEET ENGINE
   ========================================== */
.modal-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-dialog {
  transform: scale(0.95) translateY(12px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Native Mobile iOS Bottom Sheet (< 640px) */
@media (max-width: 639px) {
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 28px 28px 0 0 !important;
    max-height: 88vh !important;
    transform: translateY(100%) !important;
  }
  .modal-overlay.active .modal-dialog {
    transform: translateY(0) !important;
  }
  .sheet-drag-pill {
    width: 36px;
    height: 4px;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.4);
    margin: 8px auto 6px auto;
    flex-shrink: 0;
  }
}

/* Cart Drawer Seamless Fade Overlay */
#cart-drawer-overlay {
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#cart-drawer-overlay.active {
  opacity: 1;
}

/* Skeleton Shimmer Engine */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 25%, rgba(241, 245, 249, 0.95) 50%, rgba(226, 232, 240, 0.6) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
}

/* Responsive display utility guarantees (prevent conflicting fallback overrides) */
@media (min-width: 640px) {
  .sm\:flex { display: flex !important; }
  .sm\:block { display: block !important; }
  .sm\:inline { display: inline !important; }
}

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:grid { display: grid !important; }
  .md\:hidden { display: none !important; }
}

@media (max-width: 767px) {
  .md\:hidden { display: block !important; }
}

/* ==========================================
   AMBIENT BACKGROUND & GLASSMORPHISM ENGINE
   ========================================== */

/* Ambient Floating Glow Blobs in Background */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(85px);
  opacity: 0.6;
  animation: floatOrb 20s infinite alternate ease-in-out;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

@media (max-width: 768px) {
  .ambient-blob {
    filter: blur(45px);
  }
}

.ambient-blob-1 {
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.38) 0%, rgba(139, 92, 246, 0.18) 55%, transparent 80%);
  top: -160px;
  left: 8%;
  animation-duration: 22s;
}

.ambient-blob-2 {
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.32) 0%, rgba(56, 189, 248, 0.18) 60%, transparent 80%);
  top: 32%;
  right: -120px;
  animation-duration: 26s;
  animation-delay: -5s;
}

.ambient-blob-3 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.28) 0%, rgba(168, 85, 247, 0.15) 60%, transparent 80%);
  bottom: 8%;
  left: -80px;
  animation-duration: 20s;
  animation-delay: -10s;
}

.ambient-blob-4 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.24) 0%, rgba(239, 68, 68, 0.12) 60%, transparent 80%);
  bottom: 22%;
  right: 22%;
  animation-duration: 24s;
  animation-delay: -7s;
}

@keyframes floatOrb {
  0% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(45px, 35px) scale(1.08); }
  100% { transform: translate(-35px, 55px) scale(0.96); }
}

/* ==========================================
   GLASSMORPHISM PRISMATIC SYSTEM (Apple/VisionOS Inspired)
   ========================================== */

/* 1. Base Glass Surface */
.glass-surface {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 32px 0 rgba(31, 38, 135, 0.06), inset 0 1px 1px 0 rgba(255, 255, 255, 0.95);
}

/* 2. Glassmorphic Product & Panel Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 34px -5px rgba(31, 38, 135, 0.07), inset 0 1px 1px 0 rgba(255, 255, 255, 0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  contain: content;
  content-visibility: auto;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.2) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.glass-card:not(.no-lift):hover {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 24px 48px -10px rgba(99, 102, 241, 0.2), inset 0 1px 1px 0 rgba(255, 255, 255, 1);
}

.glass-card.no-lift:hover {
  background: rgba(255, 255, 255, 0.88);
}

/* 3. Floating Glass Navigation Header */
.glass-header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 28px 0 rgba(0, 0, 0, 0.04);
}

/* 4. Glass Pills & Buttons */
.glass-pill {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-pill:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12), inset 0 1px 1px rgba(255, 255, 255, 1);
}

/* 5. Glass Input Fields */
.glass-input {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(203, 213, 225, 0.8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  color: #0f172a;
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.18), inset 0 1px 1px rgba(255, 255, 255, 1);
}

/* 6. Deep Frosted Glass Modals */
.glass-modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 70px -15px rgba(15, 23, 42, 0.25), inset 0 1px 2px 0 rgba(255, 255, 255, 1);
}

/* 7. Dark Glass Surface (Vision Pro Dark) */
.glass-dark {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 50px 0 rgba(0, 0, 0, 0.45), inset 0 1px 1px 0 rgba(255, 255, 255, 0.15);
}

/* 8. Glowing Glass Buttons */
.gradient-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.gradient-glass-btn {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.95) 0%, rgba(124, 58, 237, 0.95) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gradient-glass-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.gradient-glass-btn:active {
  transform: translateY(1px);
}

.gradient-profit-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gradient-profit-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* Shake Animation for Wrong Password */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-8px); }
  30%, 60%, 90% { transform: translateX(8px); }
}

.animate-shake {
  animation: shake 0.45s ease-in-out;
}

/* QR Code Scanning Bar */
.qr-frame {
  position: relative;
  overflow: hidden;
  border: 2px dashed rgba(99, 102, 241, 0.7);
}

.qr-frame::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #4f46e5, transparent);
  animation: qrScan 2.5s infinite linear;
}

@keyframes qrScan {
  0% { top: 0%; }
  100% { top: 100%; }
}

/* Glassmorphic Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

@media (max-width: 768px) {
  #toast-container {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    left: 16px;
    right: 16px;
  }
}

.toast-item {
  pointer-events: auto;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  border-radius: 18px;
}

/* Custom Glass Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.8);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.95);
}

/* ==========================================
   MOBILE UI/UX & PWA ENHANCEMENTS
   ========================================== */

/* Mobile Bottom Navigation Bar (Glassmorphic) */
.mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-top: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 -6px 25px 0 rgba(15, 23, 42, 0.08);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
}

.mobile-nav-btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}
.mobile-nav-btn:active {
  transform: scale(0.92);
}

.mobile-nav-btn.active {
  color: #4f46e5;
}
.mobile-nav-btn.active .nav-icon-wrap {
  background: #eef2ff;
  color: #4f46e5;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
}

/* Touch feedback for buttons & cards */
.touch-press {
  touch-action: manipulation;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.touch-press:active {
  transform: scale(0.97);
  filter: brightness(0.96);
}

/* iOS-style Modern Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
  background-color: #10b981;
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* PWA Install Banner */
.pwa-banner {
  animation: slideUpBanner 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpBanner {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* No tap highlight on mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent auto-zoom on mobile inputs */
@media screen and (max-width: 767px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
