/* ============================================================================ */
/* GOODFOOD NC — Main Stylesheet                                                */
/* No-Tilda site. Mobile-first. iOS safe areas. Vanilla CSS.                   */
/*                                                                              */
/* Sections:                                                                    */
/*   1.  Reset & CSS Variables                                                  */
/*   2.  Base Layout (phone shell + mobile breakpoint)                          */
/*   3.  Topbar                                                                 */
/*   4.  Status Banner + Search                                                 */
/*   5.  Views (grid ↔ cards transition)                                        */
/*   6.  Category Grid                                                           */
/*   7.  Product Cards                                                           */
/*   8.  Drawer (popup)                                                          */
/*   9.  Animations                                                              */
/* ============================================================================ */


/* ── 1. Reset & Variables ─────────────────────────────────────────────────── */

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

:root {
  --red:        #E8372A;
  --red-dark:   #C0281D;
  --red-light:  #FFF0EF;
  --ink:        #1A1A1A;
  --ink2:       #555;
  --ink3:       #999;
  --surface:    #F7F5F2;
  --white:      #FFFFFF;
  --border:     rgba(0,0,0,0.08);
  --green:      #16A34A;
  --chip-border:rgba(0,0,0,0.12);
}


/* ── 2. Base Layout ──────────────────────────────────────────────────────── */

html, body {
  height: 100%;
  background: #ECEAE7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  overscroll-behavior-y: none; /* убираем iOS rubber-band scroll */
}

/* Десктоп: показываем как "телефон в рамке" */
.gf-phone {
  width: 375px;
  height: 812px;
  background: var(--surface);
  border-radius: 44px;
  border: 10px solid #111;
  overflow: hidden;
  position: relative;
  box-shadow: 0 40px 80px rgba(0,0,0,0.3);
}

/* Мобильный: полный экран */
@media (max-width: 600px) {
  html, body {
    background: var(--surface);
    align-items: flex-start;
  }
  .gf-phone {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

.gf-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}


/* ── 3. Topbar ───────────────────────────────────────────────────────────── */

.gf-topbar {
  background: var(--white);
  padding: 11px 14px 10px;
  /* Safe area: Dynamic Island / статус-бар */
  padding-top: max(11px, calc(env(safe-area-inset-top) + 6px));
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gf-logo {
  font-family: 'Noto Serif JP', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.gf-logo span { color: var(--red); }

.gf-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gf-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 0.5px solid var(--chip-border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.gf-icon-btn i { font-size: 17px; color: var(--ink2); }

.gf-cart-btn {
  width: 34px;
  height: 34px;
  background: var(--red);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  position: relative;
}
.gf-cart-btn i { color: white; font-size: 16px; }

.gf-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--ink);
  color: white;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ── 4. Status Banner + Search ───────────────────────────────────────────── */

.gf-banner-wrap {
  background: var(--white);
  padding: 8px 14px 10px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

.gf-banner {
  background: #DCFCE7;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  transition: background 0.3s ease;
}
.gf-banner.search-open { background: #F0FDF4; }

/* Пульсирующая точка статуса */
.gf-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

.gf-status-text {
  font-size: 12px;
  font-weight: 500;
  color: #15803D;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s ease, max-width 0.3s ease;
  max-width: 200px;
}

/* Поле поиска (скрыто по умолчанию, раскрывается анимацией) */
.gf-search-wrap {
  flex: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
  display: flex;
  align-items: center;
}

.gf-search-input {
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  width: 180px;
  padding: 0;
}
.gf-search-input::placeholder { color: rgba(21,128,61,0.55); }

.gf-search-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: rgba(22,163,74,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.15s;
}
.gf-search-btn i { font-size: 15px; color: #15803D; }

.gf-close-search {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(22,163,74,0.2);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.gf-close-search i { font-size: 12px; color: #15803D; }

/* Состояние: поиск открыт */
.gf-banner.search-open .gf-status-text  { opacity: 0; max-width: 0; }
.gf-banner.search-open .gf-search-wrap  { max-width: 200px; opacity: 1; flex: 1; }
.gf-banner.search-open .gf-close-search { display: flex; }
.gf-banner.search-open .gf-search-btn   { background: rgba(22,163,74,0.28); }


/* ── 5. Views ────────────────────────────────────────────────────────────── */

.gf-view {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Сетка категорий */
.gf-grid-view {
  position: absolute;
  inset: 0;
  padding: 18px 14px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4,0,0.2,1);
  opacity: 1;
  transform: translateX(0);
}
.gf-grid-view.hidden {
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
}

/* Список карточек */
.gf-cards-view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4,0,0.2,1);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}
.gf-cards-view.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}


/* ── 6. Category Grid ────────────────────────────────────────────────────── */

.gf-grid-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.gf-categories-full {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gf-cat-big {
  background: var(--white);
  border-radius: 14px;
  border: 0.5px solid var(--border);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.gf-cat-big:active {
  transform: scale(0.96);
  background: var(--red-light);
  border-color: var(--red);
}

.gf-cat-emoji-big { font-size: 32px; }
.gf-cat-name      { font-size: 13px; font-weight: 500; color: var(--ink); text-align: center; }
.gf-cat-count     { font-size: 11px; color: var(--ink3); }


/* ── 7. Product Cards ────────────────────────────────────────────────────── */

.gf-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gf-card {
  background: var(--white);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  overflow: hidden;
}

.gf-card-img-placeholder {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: #F0EDE8;
  position: relative;
}

.gf-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.gf-card-body  { padding: 9px 10px 8px; }
.gf-card-name  { font-size: 11px; font-weight: 500; color: var(--ink); line-height: 1.3; margin-bottom: 4px; }
.gf-card-price { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.gf-card-btns  { display: flex; gap: 5px; }

.gf-btn-detail {
  flex: 1;
  padding: 6px 0;
  border: 0.5px solid var(--chip-border);
  background: transparent;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink2);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.gf-btn-cart {
  flex: 1;
  padding: 6px 0;
  border: none;
  background: var(--red);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}

.gf-btn-build {
  width: 100%;
  padding: 6px 0;
  border: none;
  background: var(--ink);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.gf-empty {
  font-size: 13px;
  color: var(--ink3);
  grid-column: span 2;
  text-align: center;
  padding: 32px 0;
}


/* ── 8. Drawer ───────────────────────────────────────────────────────────── */

.gf-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: flex-end;
  z-index: 10;
}
.gf-drawer-overlay.open { display: flex; }

.gf-drawer {
  width: 100%;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  animation: slideUpDrawer 0.3s cubic-bezier(0.4,0,0.2,1);
}

.gf-drawer-handle {
  width: 36px;
  height: 4px;
  background: var(--chip-border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.gf-drawer-scroll { overflow-y: auto; flex: 1; }

.gf-drawer-header {
  padding: 12px 16px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gf-drawer-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: #F0EDE8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  margin: 10px 0 0;
}

.gf-drawer-content { padding: 12px 16px 0; }
.gf-drawer-title   { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 3px; }
.gf-drawer-sku     { font-size: 11px; color: var(--ink3); margin: 0 0 5px; }
.gf-drawer-price   { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 14px; }

.gf-option-group { margin-bottom: 14px; }
.gf-option-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gf-option-required {
  font-size: 9px;
  color: var(--red);
  font-weight: 500;
  background: var(--red-light);
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.2s;
}
.gf-option-required.done { color: var(--green); background: #DCFCE7; }

.gf-chips { display: flex; flex-direction: column; gap: 5px; }

.gf-chip {
  padding: 10px 13px;
  border: 0.5px solid var(--chip-border);
  border-radius: 9px;
  font-size: 12px;
  color: var(--ink2);
  cursor: pointer;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.gf-chip.selected {
  border-color: var(--red);
  background: var(--red);
  color: white;
  font-weight: 500;
}

.gf-drawer-footer {
  padding: 12px 16px;
  /* Safe area: Home Bar на iPhone */
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
  background: var(--white);
}

.gf-add-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.gf-add-btn.ready    { background: var(--red); color: white; }
.gf-add-btn.disabled { background: #EBEBEB; color: var(--ink3); cursor: default; }

.gf-close-x {
  width: 28px;
  height: 28px;
  background: var(--surface);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.gf-close-x i { font-size: 14px; color: var(--ink2); }


/* ── 9. Animations ───────────────────────────────────────────────────────── */

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(22,163,74,0.4);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.85);
    box-shadow: 0 0 0 4px rgba(22,163,74,0);
  }
}

@keyframes slideUpDrawer {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ============================================================================ */
/* END                                                                          */
/* ============================================================================ */
