/* ============================================
   BAGECHA BY ADI'S — Screen Layouts
   ============================================ */

/* ─── Base Screen ─── */
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen > * {
  flex-shrink: 0;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}

.screen.exiting {
  z-index: 1;
}

/* Transition classes */
.screen.slide-in-right {
  animation: slideInRight 280ms var(--ease-smooth) forwards;
}

.screen.slide-out-left {
  animation: slideOutLeft 280ms var(--ease-smooth) forwards;
}

.screen.slide-in-left {
  animation: slideInLeft 280ms var(--ease-smooth) forwards;
}

.screen.slide-out-right {
  animation: slideOutRight 280ms var(--ease-smooth) forwards;
}

.screen.fade-in {
  animation: slideUpFadeIn var(--duration-slow) var(--ease-smooth) forwards;
}

.screen.fade-out {
  animation: slideUpFadeOut var(--duration-slow) var(--ease-smooth) forwards;
}


/* ═══════════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════════ */
.screen--splash {
  background: var(--gradient-primary);
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.splash__logo {
  width: 220px;
  height: auto;
  opacity: 0;
  filter: brightness(0) invert(1); /* Force white */
}

.splash__logo.animate {
  animation: fadeScaleIn var(--duration-splash) ease-out forwards;
}

.splash__tagline {
  margin-top: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0;
}

.splash__tagline.animate {
  animation: fadeInUp 500ms ease-out forwards;
  animation-delay: 500ms;
}


/* ═══════════════════════════════════════════
   WELCOME SCREEN
   ═══════════════════════════════════════════ */
.screen--welcome {
  background: var(--gradient-primary);
  padding: var(--screen-padding);
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Add a glowing orb effect behind the logo */
.welcome__bg-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.28) 0%, transparent 70%);
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
  animation: orbPulse 8s ease-in-out infinite;
}

.welcome__illustration {
  width: 220px;
  height: auto;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.welcome__title {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: var(--weight-bold);
  color: #FFFFFF;
  margin-bottom: var(--space-2);
  line-height: var(--leading-tight);
  position: relative;
  z-index: 1;
  letter-spacing: -0.5px;
}

.welcome__title span {
  background: var(--gradient-gold-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--accent-gold); /* Fallback */
}

.welcome__subtitle {
  font-size: var(--text-body);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
  max-width: 320px;
  position: relative;
  z-index: 1;
  font-weight: var(--weight-medium);
}

.welcome__cta {
  width: 100%;
  max-width: 320px;
  position: relative;
}

/* Gold sweep border animation on first render */
.welcome__cta-glow {
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-btn) + 2px);
  background: linear-gradient(90deg, transparent 0%, var(--accent-gold) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: goldSweep 1.5s ease-out 0.5s;
  opacity: 0.6;
  z-index: -1;
}


/* ═══════════════════════════════════════════
   REGISTRATION SCREEN
   ═══════════════════════════════════════════ */
.screen--registration {
  background: var(--bg);
  padding: var(--screen-padding);
  padding-top: var(--space-8);
}

.registration__header {
  margin-bottom: var(--space-5);
}

.registration__back {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  cursor: pointer;
  padding: var(--space-1);
  margin-left: -8px;
  transition: color var(--duration-fast) ease;
}

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

.registration__title {
  font-family: var(--font-serif);
  font-size: var(--text-title);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.registration__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.registration__form {
  flex: 1;
}

.registration__footer {
  padding-bottom: var(--space-4);
}

.registration__terms {
  text-align: center;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  line-height: var(--leading-relaxed);
}

.registration__terms a {
  color: var(--primary);
  font-weight: var(--weight-medium);
}


/* ═══════════════════════════════════════════
   OTP SCREEN
   ═══════════════════════════════════════════ */
.screen--otp {
  background: var(--bg);
  padding: var(--screen-padding);
  padding-top: var(--space-8);
}

.otp__header {
  margin-bottom: var(--space-5);
}

.otp__back {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  cursor: pointer;
  padding: var(--space-1);
  margin-left: -8px;
  transition: color var(--duration-fast) ease;
}

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

.otp__title {
  font-family: var(--font-serif);
  font-size: var(--text-title);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.otp__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.otp__phone {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.otp__boxes {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: var(--space-5) 0;
}

.otp__box {
  width: 48px;
  height: 56px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  text-align: center;
  font-size: 22px;
  font-weight: var(--weight-bold);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease;
  caret-color: var(--primary);
  -webkit-appearance: none;
  appearance: none;
}

.otp__box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 76, 17, 0.12);
}

.otp__box.error {
  border-color: var(--error);
  animation: shake 200ms ease-in-out;
}

.otp__box.success {
  border-color: var(--success);
}

.otp__resend {
  text-align: center;
  margin-top: var(--space-3);
}

.otp__resend-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.otp__resend-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent-gold);
  cursor: pointer;
  display: none;
}

.otp__resend-link.visible {
  display: inline;
}

.otp__resend-link:active {
  opacity: 0.7;
}

.otp__footer {
  margin-top: auto;
  padding-bottom: var(--space-4);
}

.otp__error-message {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--error);
  margin-top: var(--space-2);
  min-height: 20px;
}


/* ═══════════════════════════════════════════
   DASHBOARD SCREEN
   ═══════════════════════════════════════════ */
.screen--dashboard {
  background: var(--bg);
  padding: var(--screen-padding);
  padding-top: var(--space-5);
  padding-bottom: 110px; /* Space for floating bottom nav */
}

.dashboard__greeting {
  margin-bottom: var(--space-4);
  padding: 4px 0;
}

.dashboard__wave {
  display: inline-block;
  transform-origin: 70% 70%;
}

.dashboard__wave.animate {
  animation: wave 600ms ease-in-out;
}

.dashboard__greeting-title {
  font-size: 24px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: -0.5px;
}

#dashboard-name {
  font-family: var(--font-serif);
  color: var(--primary);
}

/* Reward Card */
.dashboard__reward-card {
  margin-bottom: var(--space-4);
}

/* Loyalty Progress */
.dashboard__loyalty {
  margin-bottom: var(--space-4);
}

.dashboard__loyalty-header {
  margin-bottom: var(--space-1);
}

.dashboard__loyalty-title {
  font-size: 18px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dashboard__loyalty-subtitle {
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

/* Profile Card */
.dashboard__profile {
  margin-bottom: var(--space-3);
  padding: 24px;
}

.dashboard__profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dashboard__profile-avatar-container {
  position: relative;
  width: 52px;
  height: 52px;
}

.dashboard__profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  position: relative;
  z-index: 2;
  border: 2px solid #FFFFFF;
  box-shadow: 0 4px 12px rgba(54, 76, 17, 0.15);
}

.dashboard__profile-avatar-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-gold);
  opacity: 0.8;
  z-index: 1;
}

.dashboard__profile-info {
  flex: 1;
}

.dashboard__profile-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dashboard__profile-id {
  font-size: 12px;
  font-weight: var(--weight-bold);
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}

.dashboard__profile-phone {
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

/* Callout Styling */
.dashboard__callout {
  background: #FFFFFF;
  border: 1px solid rgba(201, 162, 39, 0.15);
  border-left: 4px solid var(--accent-gold);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: var(--space-4);
}

.dashboard__callout-icon {
  font-size: 24px;
}

.dashboard__callout-content {
  flex: 1;
}

.dashboard__callout-title {
  font-size: var(--text-body);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dashboard__callout-text {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.dashboard__profile-since-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(54, 76, 17, 0.1);
}

.calendar-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  opacity: 0.6;
}

.dashboard__profile-since {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  border: none;
  padding: 0;
  margin: 0;
}

/* Quick Stats Row */
.dashboard__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.dashboard__stat {
  text-align: center;
  padding: var(--space-2);
}

.dashboard__stat-value {
  font-family: var(--font-serif);
  font-size: var(--text-title);
  font-weight: var(--weight-bold);
  color: var(--primary);
}

.dashboard__stat-label {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   TAB VIEW TRANSITIONS & LAYOUTS (PHASE 2)
   ═══════════════════════════════════════════ */

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-smooth);
  width: 100%;
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Staggered entrance animation for active tabs */
@keyframes tabItemEnter {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tab-content.active > * {
  animation: tabItemEnter 0.5s var(--ease-smooth) both;
}

.tab-content.active > *:nth-child(1) { animation-delay: 50ms; }
.tab-content.active > *:nth-child(2) { animation-delay: 150ms; }
.tab-content.active > *:nth-child(3) { animation-delay: 250ms; }
.tab-content.active > *:nth-child(4) { animation-delay: 350ms; }
.tab-content.active > *:nth-child(5) { animation-delay: 450ms; }

/* Cascade load for reward items */
.tab-content.active .reward-box {
  animation: tabItemEnter 0.5s var(--ease-smooth) both;
}
.tab-content.active .reward-box:nth-child(1) { animation-delay: 100ms; }
.tab-content.active .reward-box:nth-child(2) { animation-delay: 200ms; }
.tab-content.active .reward-box:nth-child(3) { animation-delay: 300ms; }
.tab-content.active .reward-box:nth-child(4) { animation-delay: 400ms; }
.tab-content.active .reward-box:nth-child(5) { animation-delay: 500ms; }

/* Premium Profile Card & Layout */
.profile-card--premium {
  background: #FFFFFF;
  border-radius: var(--radius-card);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(54, 76, 17, 0.05);
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

.profile-card--premium::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.08) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.profile-card__avatar-container {
  display: flex;
  justify-content: center;
  position: relative;
  margin-bottom: var(--space-1);
}

.profile-card__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: var(--weight-bold);
  z-index: 2;
  border: 3px solid #FFFFFF;
  box-shadow: 0 8px 20px rgba(54, 76, 17, 0.15);
}

.profile-card__avatar-ring {
  position: absolute;
  width: 88px;
  height: 88px;
  top: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  opacity: 0.8;
  z-index: 1;
}

.profile-card__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 2;
}

.profile-card__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px dashed rgba(54, 76, 17, 0.1);
  padding-bottom: var(--space-1);
}

.profile-card__field:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-card__label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

.profile-card__value {
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.profile-card__since-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-card__since-row .calendar-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  opacity: 0.8;
}

/* Greeting and personalized message on profile tab */
.profile-greeting-wrapper {
  margin-bottom: var(--space-4);
  padding: 4px 0;
}

.profile-greeting {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: var(--weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.profile-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* Rewards Screen Header */
.rewards-header {
  margin-bottom: var(--space-3);
  padding: 4px 0;
}

.rewards-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: var(--weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.rewards-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}
