/* ============================================================
   FRESH FOOD MARKET — Mobile App Shell
   375px viewport frame with status bar & bottom navigation
   Used by Consumer and Operations wireframes
   ============================================================ */

/* ── Mobile Viewport Container ── */
.mobile-frame {
  width: var(--mobile-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--color-background);
  position: relative;
  overflow-x: hidden;
}

/* For desktop preview: center the mobile frame */
@media (min-width: 600px) {
  body {
    background: #F3F4F6;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
  }

  .mobile-frame {
    min-height: 812px;
    max-height: 100vh;
    border-radius: 40px;
    box-shadow: 0 0 0 12px #1F2937, 0 25px 80px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .state-toggle-bar {
    width: var(--mobile-width);
    border-radius: 0 0 40px 40px;
    position: sticky;
  }

  /* Annotations below the mobile frame, full readable width */
  .wireframe-annotations {
    width: 100%;
    max-width: 800px;
    margin-top: 32px;
    border-radius: 12px;
    overflow: hidden;
  }
}

/* ── Status Bar (iOS-style) ── */
.status-bar {
  position: sticky;
  top: 0;
  height: var(--status-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  z-index: var(--z-status-bar);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.status-bar--light {
  background: var(--color-white);
  color: var(--color-text-primary);
}

.status-bar--transparent {
  background: transparent;
  color: var(--color-text-inverse);
  position: absolute;
  width: 100%;
}

.status-bar__time {
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.status-bar__icons {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ── App Header ── */
.app-header {
  position: sticky;
  top: var(--status-bar-height);
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  z-index: var(--z-sticky);
}

.app-header--white {
  background: var(--color-white);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-divider);
}

.app-header--transparent {
  background: transparent;
  color: var(--color-text-inverse);
}

.app-header__back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -8px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.app-header__title {
  flex: 1;
  font-family: var(--font-heading);
  font-size: var(--text-h4);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__title--center {
  text-align: center;
}

.app-header__action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.app-header__logo {
  height: 28px;
}

/* Header with address selector */
.app-header--home {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.app-header__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.app-header__address {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  cursor: pointer;
}

.app-header__address-label {
  font-size: var(--text-xs);
  opacity: 0.7;
}

.app-header__address-value {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
}

/* ── Search Bar (in header) ── */
.header-search {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-3);
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  gap: var(--space-2);
  cursor: pointer;
}

.header-search__placeholder {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
}

.header-search--white {
  background: var(--color-background);
}

.header-search--white .header-search__placeholder {
  color: var(--color-text-muted);
}

/* ── Page Content Area ── */
.page-content {
  min-height: calc(100vh - var(--status-bar-height) - var(--header-height) - var(--bottom-nav-height) - var(--bottom-safe));
  padding-bottom: calc(var(--bottom-nav-height) + var(--bottom-safe));
}

.page-content--no-header {
  min-height: calc(100vh - var(--status-bar-height) - var(--bottom-nav-height) - var(--bottom-safe));
}

.page-content--no-nav {
  padding-bottom: 0;
  min-height: calc(100vh - var(--status-bar-height) - var(--header-height));
}

.page-content--full {
  padding-bottom: 0;
  min-height: calc(100vh - var(--status-bar-height));
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--mobile-width);
  background: var(--color-white);
  border-top: 1px solid var(--color-border-light);
  z-index: var(--z-sticky);
  padding-bottom: var(--bottom-safe);
  box-shadow: var(--shadow-bottom-nav);
}

.bottom-nav__items {
  display: flex;
  align-items: center;
  height: var(--bottom-nav-height);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.bottom-nav__item--active {
  color: var(--color-primary);
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.bottom-nav__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

/* Center elevated button (for Ops apps) */
.bottom-nav__item--center {
  position: relative;
}

.bottom-nav__item--center .bottom-nav__icon {
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-full);
  margin-top: -16px;
  font-size: 24px;
  box-shadow: var(--shadow-md);
}

/* ── Floating Cart Button ── */
.floating-cart {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--bottom-safe) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  cursor: pointer;
  z-index: var(--z-dropdown);
  max-width: calc(var(--mobile-width) - var(--space-8));
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--mobile-width) - var(--space-8));
}

.floating-cart__count {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
}

.floating-cart__count-badge {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.floating-cart__text {
  font-size: var(--text-base);
}

.floating-cart__total {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

/* ── Sticky Bottom CTA ── */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--mobile-width);
  background: var(--color-white);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + var(--bottom-safe));
  border-top: 1px solid var(--color-border-light);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-top);
}

.sticky-cta .btn { width: 100%; }

/* Sticky CTA with summary row */
.sticky-cta--summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sticky-cta__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sticky-cta__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.sticky-cta__value {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

/* ── Full-Screen Overlay (splash, loading) ── */
.fullscreen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  z-index: var(--z-modal);
}

.fullscreen__logo {
  width: 200px;
  margin-bottom: var(--space-6);
}

.fullscreen__tagline {
  font-family: var(--font-body);
  font-size: var(--text-base);
  opacity: 0.7;
  text-align: center;
  max-width: 280px;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner--dark {
  border-color: rgba(4, 63, 45, 0.1);
  border-top-color: var(--color-primary);
}

/* ── Cart Item Row ── */
.cart-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-divider);
}

.cart-item__image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--color-background);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item__details {
  flex: 1;
  min-width: 0;
}

.cart-item__name {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.cart-item__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.cart-item__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.cart-item__price {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

/* ── Order Card ── */
.order-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-2) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.order-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.order-card__id {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.order-card__date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.order-card__items {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.order-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.order-card__total {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
}

/* ── Map Placeholder ── */
.map-placeholder {
  width: 100%;
  height: 200px;
  background: #E8F0E5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  position: relative;
}

.map-placeholder--tall { height: 300px; }
.map-placeholder--full { height: 100%; min-height: 300px; }

.map-pin {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-accent);
  border-radius: var(--radius-full) var(--radius-full) var(--radius-full) 0;
  transform: rotate(-45deg);
  font-size: 18px;
}

.map-pin > span {
  transform: rotate(45deg);
}

/* ── Notification Item ── */
.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-divider);
}

.notification-item--unread {
  background: rgba(4, 63, 45, 0.03);
  border-left: 3px solid var(--color-primary);
}

.notification-item__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-background);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.notification-item__content { flex: 1; }
.notification-item__title { font-weight: var(--weight-medium); margin-bottom: 2px; }
.notification-item__text { font-size: var(--text-sm); color: var(--color-text-secondary); }
.notification-item__time { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
