/* ===================================================================
   Customer Mobile Digital Loyalty Card & Wallet CSS
   =================================================================== */

.customer-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  background: #f8fafc;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 15px)); /* Space for mobile fixed bottom nav */
}

/* Header */
.customer-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.shop-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shop-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--royal-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.shop-info h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.shop-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Customer Greeting Header */
.greeting-box {
  padding: 1.25rem 1.25rem 0.5rem;
}

.greeting-box h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.greeting-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================
   DIGITAL LOYALTY CARD (Apple Wallet / VIP Black-Gold Card)
   ========================================================== */
.card-wrapper {
  padding: 0 1.25rem;
  margin: 0.75rem 0 1.25rem;
  perspective: 1000px;
}

.loyalty-card {
  background: linear-gradient(145deg, #111827 0%, #1f2937 60%, #0f172a 100%);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.25rem 1.4rem;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Company / Brand Banner on Top of Card */
.card-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.65rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.company-brand-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 72%;
}

.company-brand-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.5));
}

.company-brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hologram / Shimmer sweep */
.loyalty-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 35%,
    rgba(245, 158, 11, 0.08) 45%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 55%
  );
  transform: rotate(30deg);
  pointer-events: none;
  animation: shine 8s infinite linear;
}

@keyframes shine {
  0% { transform: translate(-30%, -30%) rotate(30deg); }
  100% { transform: translate(30%, 30%) rotate(30deg); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title-tag {
  display: flex;
  flex-direction: column;
}

.card-vip-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-number {
  font-family: 'Outfit', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.card-sequence-chip {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* Stamp Matrix / Grid - High Density Mobile Responsive */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.stamp-slot {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
}

.stamp-slot.stamped {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 1.5px solid #fbbf24;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.45);
  transform: scale(1.02);
  animation: stampPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stamp-slot.stamped .stamp-star {
  font-size: 1.35rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.stamp-slot.blank .slot-num {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.stamp-slot.goal-slot {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.stamp-slot.goal-slot .slot-gift-icon {
  font-size: 1.15rem;
}

@keyframes stampPop {
  0% { transform: scale(0.6) rotate(-10deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(4deg); }
  100% { transform: scale(1.02) rotate(0deg); opacity: 1; }
}

/* Card Bottom Info */
.card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.holder-info .label {
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.holder-info .name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.progress-info {
  text-align: right;
}

.progress-count {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fbbf24;
}

.progress-remaining {
  font-size: 0.72rem;
  color: #cbd5e1;
}

/* Progress bar strip */
.card-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-top: 0.75rem;
  overflow: hidden;
}

.card-progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Completion Gift Banner */
.gift-claim-banner {
  margin: 0 1.25rem 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-lg);
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15); }
  50% { box-shadow: 0 6px 22px rgba(245, 158, 11, 0.35); }
}

.gift-banner-icon {
  font-size: 2rem;
}

.gift-banner-text h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 0.15rem;
}

.gift-banner-text p {
  font-size: 0.8rem;
  color: #b45309;
}

/* Quick Action / Stats cards */
.quick-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0 1.25rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: #ffffff;
  padding: 0.85rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-box .val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.stat-box .lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* History Card & Timeline */
.history-section {
  padding: 0 1.25rem 1rem;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-history-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card-history-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.history-card-seq {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

.history-stamps-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* Stamp Log Table / List */
.stamp-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stamp-tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #f1f5f9;
}

.stamp-tx-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.stamp-tx-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stamp-tx-details h5 {
  font-size: 0.85rem;
  color: #0f172a;
}

.stamp-tx-details p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stamp-tx-right {
  text-align: right;
}

.stamp-tx-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--success);
}

.stamp-tx-amount {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Bottom Navigation Bar - Fixed App Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
  padding: 0.4rem 0.8rem;
}

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

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

/* OTP 6-box Input */
.otp-boxes {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.otp-digit {
  width: 46px;
  height: 54px;
  text-align: center;
  font-size: 1.4rem;
  font-family: 'Outfit', monospace;
  font-weight: 700;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #ffffff;
  transition: all 0.2s;
}

.otp-digit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
  transform: translateY(-2px);
}

/* Mobile Topbar Quick Action Buttons */
.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mobile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
  font-size: 1.05rem;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.mobile-action-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.mobile-action-btn.logout {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.mobile-action-btn.logout:hover {
  background: #fecaca;
  color: #b91c1c;
}

/* ========================================================
   Desktop View Enhancements (>= 768px)
   ======================================================== */
.desktop-nav {
  display: none;
}

.customer-content-container {
  width: 100%;
  padding: 1.25rem;
}

@media (min-width: 768px) {
  /* Desktop Top Navigation Bar */
  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .desktop-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    background: #f1f5f9;
  }

  .desktop-nav-link:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
  }

  .desktop-nav-link.active {
    background: var(--royal-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  }

  .desktop-nav-link.desktop-logout {
    background: #fee2e2;
    color: #dc2626;
  }

  .desktop-nav-link.desktop-logout:hover {
    background: #fecaca;
    color: #b91c1c;
  }

  /* Hide Mobile Bottom Nav on Desktop */
  .bottom-nav {
    display: none !important;
  }

  .customer-screen {
    padding-bottom: 3.5rem !important;
    background: transparent !important;
    overflow: visible !important;
  }

  .customer-content-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
  }

  /* Desktop 2-Column Grid on Card Page */
  .card-desktop-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2.25rem;
    align-items: start;
  }

  .card-desktop-left {
    position: sticky;
    top: 90px;
  }

  .card-wrapper {
    padding: 0 !important;
    margin: 0 0 1rem !important;
  }

  .quick-stats-row {
    margin-bottom: 1.5rem;
  }

  .history-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
  }

  /* Desktop 2-Column Grid on Profile Page */
  .profile-desktop-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    align-items: start;
  }

  /* Desktop Grid on History Page */
  .history-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
  }

  /* Desktop Centered Auth Card on Login Page */
  .auth-desktop-card {
    max-width: 480px;
    margin: 3.5rem auto;
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid #e2e8f0;
    padding: 2.75rem 2.25rem;
  }
}
