/* ==========================================================================
   Taco Bell Moments — MomentScience Demo
   Native Taco Bell styling with offers carousel
   ========================================================================== */

:root {
  --tb-purple: #6C0F7C;
  --tb-purple-hover: #5A0B68;
  --tb-purple-light: #8B2B9E;
  --tb-gray-100: #f7f7f7;
  --tb-gray-200: #e5e5e5;
  --tb-gray-400: #9ca3af;
  --tb-gray-600: #6b7280;
  --tb-gray-900: #1a1a1a;
  --tb-radius-btn: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body, .demo-body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
  overflow: hidden;
}

@media (min-width: 768px) {
  .demo-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #f093b0 50%, #f5af7a 100%);
    overflow: auto;
  }
}

/* --------------------------------------------------------------------------
   iPhone frame
   -------------------------------------------------------------------------- */
.iphone-frame {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

@media (min-width: 768px) {
  .iphone-frame {
    width: calc(375px + 28px);
    height: calc(812px + 28px);
    max-height: min(90vh, 840px);
    padding: 14px;
    background: #1c1c1e;
    border-radius: 50px;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
    position: relative;
    align-items: center;
  }

  .screen-content {
    width: 375px;
    height: 812px;
    border-radius: 38px;
    overflow: hidden;
  }

  .dynamic-island { display: block; }
}

@media (max-width: 767px) {
  .iphone-frame { 
    border-radius: 0;
    background: #fff;
  }
  .dynamic-island { display: none; }
}

.screen-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

/* Dynamic Island — positioned inside iphone-frame, above screen-content */
.dynamic-island {
  display: none;
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 36px;
  background: #000;
  border-radius: 20px;
  z-index: 200;
  pointer-events: none;
}

@media (min-width: 768px) {
  .dynamic-island {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   Screens
   -------------------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
}

.screen.hidden { display: none !important; }
.screen.active { display: block; }

.screen-img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.screen-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* On mobile, ensure image shows full content and scrolls if needed */
@media (max-width: 767px) {
  .screen-img {
    width: 100%;
    height: auto;
    min-height: 100%;
    object-fit: contain;
  }
  
  .screen-img-wrap {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

/* Hotspots */
.place-order-hotspot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(90px + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  cursor: pointer;
  background: transparent;
  border: none;
  z-index: 10;
}

@media (min-width: 768px) {
  .place-order-hotspot {
    position: absolute;
    height: 16%;
    min-height: 70px;
    padding-bottom: 0;
  }
}

.receipt-close-hotspot {
  position: fixed;
  top: 0; left: 0;
  width: 80px;
  height: 80px;
  cursor: pointer;
  background: transparent;
  border: none;
  z-index: 15;
}

@media (min-width: 768px) {
  .receipt-close-hotspot {
    position: absolute;
    width: 18%;
    height: 11%;
    min-height: 50px;
  }
}

.rewards-back-hotspot {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: transparent;
  border: none;
}

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */
.offers-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 20;
}

@media (max-width: 767px) {
  .offers-overlay {
    position: fixed;
  }
}

.offers-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Bottom sheet (Taco Bell native style)
   -------------------------------------------------------------------------- */
.offers-drawer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0));
  height: 510px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 767px) {
  .offers-drawer {
    position: fixed;
    max-height: 72vh;
  }
}

.offers-drawer.open {
  transform: translateY(0);
}

.offers-drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--tb-gray-200);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.offers-drawer-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tb-gray-100);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--tb-gray-600);
}

.offers-drawer-close-btn:hover {
  background: var(--tb-gray-200);
}

.offers-drawer-close-btn svg {
  width: 16px;
  height: 16px;
}

.offers-drawer-title {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--tb-gray-900);
  padding: 0 50px 0 20px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.offers-drawer-title .order-number {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--tb-gray-600);
  margin-top: 4px;
  margin-bottom: 14px;
  letter-spacing: 0;
}

/* --------------------------------------------------------------------------
   Offers carousel
   -------------------------------------------------------------------------- */
.offers-carousel-wrapper {
  flex: 1;
  min-height: 360px;
  overflow: visible;
  position: relative;
  touch-action: pan-x;
  -webkit-user-select: none;
  user-select: none;
}

.offers-carousel {
  display: block;
  height: 360px;
  position: relative;
  touch-action: pan-x;
  cursor: grab;
}

.offers-carousel:active {
  cursor: grabbing;
}

.offers-loading,
.offers-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 14px;
  color: var(--tb-gray-400);
}

/* Offer card — Taco Bell native, compact and balanced */
.offer-card {
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  width: calc(100% - 32px);
  height: 350px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
}

.offer-card:not(.active) {
  opacity: 0.3;
  pointer-events: none;
}

.offer-card.active {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Logo area — prominent logo display */
.offer-card-hero {
  width: 100%;
  height: 110px;
  flex-shrink: 0;
  background: var(--tb-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
}

.offer-card-hero img {
  max-width: 90%;
  max-height: 85px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.offer-card-hero.no-image {
  background: linear-gradient(135deg, var(--tb-purple) 0%, var(--tb-purple-light) 100%);
}

.offer-card-hero.no-image img {
  display: none;
}

/* Card body — efficient vertical distribution */
.offer-card-body {
  flex: 1;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
}

/* Text content wrapper — takes available space */
.offer-card-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Headline — bold, readable */
.offer-card-headline {
  font-size: 16px;
  font-weight: 700;
  color: var(--tb-gray-900);
  line-height: 1.3;
  margin-bottom: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Description — compact */
.offer-card-desc {
  font-size: 14px;
  color: var(--tb-gray-600);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* CTAs — stacked vertically */
.offer-card-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  flex-shrink: 0;
}

/* Primary CTA — pill, Taco Bell purple */
.offer-cta-primary {
  flex: 1;
  padding: 12px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--tb-purple);
  border: none;
  border-radius: var(--tb-radius-btn);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.offer-cta-primary:hover {
  background: var(--tb-purple-hover);
}

.offer-cta-primary:active {
  transform: scale(0.98);
}

/* Secondary CTA — outline pill */
.offer-cta-secondary {
  flex: 1;
  padding: 12px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--tb-purple);
  background: #fff;
  border: 2px solid var(--tb-purple);
  border-radius: var(--tb-radius-btn);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  text-align: center;
}

.offer-cta-secondary:hover {
  background: #f9f5fa;
}

.offer-cta-secondary:active {
  transform: scale(0.98);
}

.offer-cta-secondary.saved {
  background: #ede9fe;
  border-color: var(--tb-purple-light);
  color: var(--tb-purple-light);
  cursor: default;
}

/* Single CTA layout (when Save for Later is not available) */
.offer-card-ctas.single-cta {
  align-items: center;
}

.offer-card-ctas.single-cta .offer-cta-primary {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Carousel dots
   -------------------------------------------------------------------------- */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 2px;
  flex-shrink: 0;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--tb-gray-200);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}

.dot.active {
  background: var(--tb-purple);
  transform: scale(1.15);
}

/* Privacy link */
.offers-privacy-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--tb-gray-400);
  padding-top: 2px;
  text-decoration: underline;
}

.offers-privacy-link:hover {
  color: var(--tb-gray-600);
}
