/* ===========================================================
   UGOO · Shared stylesheet
   Design tokens match the Pizza Rock / focaccia aesthetic
   =========================================================== */

:root {
  --gold: #FFD952;
  --gold-dim: #E6941A;
  --black: #0A0A0A;
  --card: #1C1C1E;
  --card2: #242426;
  --border: rgba(255,255,255,0.08);
  --text: #F0EEE8;
  --muted: #888880;
  --danger: #E66A6A;
  --r: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--black) !important;
  margin: 0;
  padding: 0;
}

body {
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: 100px; /* room for the tab bar */
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

/* ================= APP HEADER ================= */
.app-header {
  padding: 28px 22px 18px;
  background: linear-gradient(155deg, #1d1500 0%, var(--black) 55%);
  position: relative;
  overflow: hidden;
  border-bottom: 0.5px solid var(--border);
}

.app-header::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,217,82,.12) 0%, transparent 70%);
  pointer-events: none;
}

.app-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.app-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  letter-spacing: .02em;
  color: var(--gold);
  line-height: 1;
}

.app-header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 18px;
  transition: background .15s, color .15s;
}
.icon-btn:active { background: var(--card2); }

/* ================= SEARCH + FILTERS ================= */
.search-bar {
  padding: 14px 22px 12px;
  border-bottom: 0.5px solid var(--border);
  background: rgba(10,10,10,0.92);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 22px;
  padding: 11px 16px 11px 42px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: rgba(255,217,82,.35); }

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

.filter-pills {
  display: flex;
  gap: 8px;
  padding: 10px 22px 14px;
  overflow-x: auto;
  border-bottom: 0.5px solid var(--border);
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 0.5px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background .15s, color .15s, border-color .15s;
}
.filter-pill.active {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
}

/* ================= RECIPE GRID ================= */
.grid {
  padding: 16px 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: var(--card);
  border-radius: var(--r);
  border: 0.5px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s;
}
.card:active { transform: scale(0.98); }

.card-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: var(--card2);
  position: relative;
  overflow: hidden;
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  color: var(--border);
  letter-spacing: .02em;
}
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255,217,82,0.92);
  color: var(--black);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 10px;
}

.card-body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 70px;
}
.card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: .02em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}
.card-tags {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ================= EMPTY STATE ================= */
.empty {
  padding: 60px 40px;
  text-align: center;
}
.empty-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: .02em;
}
.empty-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: opacity .15s, transform .15s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gold);
  color: var(--black);
}
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 0.5px solid var(--border);
}
.btn-danger {
  background: var(--card);
  color: var(--danger);
  border: 0.5px solid var(--border);
}
.btn-full {
  width: 100%;
}

/* ================= FLOATING ADD BUTTON ================= */
.fab {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 300;
  box-shadow: 0 6px 20px rgba(255,217,82,0.3), 0 2px 8px rgba(0,0,0,0.4);
  z-index: 50;
  line-height: 1;
  transition: transform .15s;
}
.fab:active { transform: scale(0.92); }

/* Respect bottom safe area on iPhones with home indicator */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .fab { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ================= TAB BAR ================= */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  color: var(--muted);
  transition: color .15s;
}
.tab.active { color: var(--gold); }

.tab-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 3px;
}
.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ================= PAGE HEADER (non-home pages) ================= */
.page-header {
  padding: 24px 22px 18px;
  background: linear-gradient(155deg, #1d1500 0%, var(--black) 55%);
  position: relative;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 18px;
  flex-shrink: 0;
}
.page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: .02em;
  color: var(--gold);
  line-height: 1;
}

/* ================= FORMS ================= */
.form-section {
  padding: 20px 22px;
}
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.form-input,
.form-textarea {
  width: 100%;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.form-input:focus,
.form-textarea:focus { border-color: rgba(255,217,82,.35); }
.form-textarea { min-height: 110px; line-height: 1.5; }
.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}
.photo-preview {
  margin-top: 10px;
  width: 100%;
  aspect-ratio: 3/2;
  border-radius: 12px;
  background: var(--card);
  border: 0.5px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================= SETTINGS LIST ================= */
.settings-list {
  padding: 20px 22px;
}
.settings-item {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.settings-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.settings-item-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ================= RECIPE DETAIL (quick recipes) ================= */
.recipe-detail-header {
  position: relative;
}
.recipe-detail-header .back-btn-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(10,10,10,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.recipe-hero {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
  border-bottom: 0.5px solid var(--border);
}
.recipe-hero-placeholder {
  width: 100%;
  aspect-ratio: 3/2;
  background: linear-gradient(155deg, #1d1500 0%, var(--black) 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 0.5px solid var(--border);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 72px;
  color: rgba(255,217,82,.12);
}
.recipe-detail-body {
  padding: 24px 22px;
}
.recipe-detail-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 40px;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--gold);
  margin-bottom: 12px;
}
.recipe-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}
.recipe-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--card);
  border: 0.5px solid var(--border);
  padding: 5px 10px;
  border-radius: 10px;
}
.recipe-section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}
.recipe-prose {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.recipe-prose.muted {
  color: var(--muted);
}
.recipe-actions {
  margin-top: 32px;
  display: flex;
  gap: 10px;
}

/* ================= FOOTER ================= */
.app-footer {
  margin-top: auto;
  text-align: center;
  padding: 30px 20px 40px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ================= UTILITY ================= */
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--gold);
  padding: 12px 18px;
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===========================================================
   DESKTOP & TABLET BREAKPOINTS
   Mobile-first overrides for wider screens
   =========================================================== */

/* Tablet: 700px+ — 3 columns, slightly wider container */
@media (min-width: 700px) {
  body {
    max-width: 900px;
    padding-bottom: 60px; /* less since tab bar is hidden on desktop */
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 24px 32px;
  }

  .app-header {
    padding: 36px 32px 24px;
  }

  .app-brand {
    font-size: 44px;
  }

  .search-bar {
    padding: 16px 32px;
  }

  .filter-pills {
    padding: 12px 32px 16px;
  }

  .form-section,
  .settings-list {
    padding: 28px 32px;
  }
}

/* Desktop: 1000px+ — sidebar nav, 4 columns, wider container */
@media (min-width: 1000px) {
  body {
    max-width: 1280px;
    padding-bottom: 0;
    padding-left: 220px; /* room for sidebar */
    position: relative;
  }

  /* Hide the bottom tab bar on desktop */
  .tab-bar {
    display: none;
  }

  /* Sidebar navigation */
  .desktop-sidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    left: max(0px, calc(50vw - 640px));
    top: 0;
    bottom: 0;
    width: 220px;
    background: linear-gradient(180deg, #1d1500 0%, #0A0A0A 60%);
    border-right: 0.5px solid var(--border);
    padding: 36px 20px 24px;
    z-index: 60;
  }

  .desktop-sidebar-brand {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 44px;
    letter-spacing: .02em;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 36px;
    padding-left: 8px;
  }

  .desktop-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .04em;
    transition: background .15s, color .15s;
    margin-bottom: 4px;
  }
  .desktop-nav-item:hover {
    background: var(--card);
    color: var(--text);
  }
  .desktop-nav-item.active {
    background: var(--card);
    color: var(--gold);
  }
  .desktop-nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    line-height: 1;
  }

  .desktop-sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 0.5px solid var(--border);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .14em;
    text-transform: uppercase;
    text-align: center;
  }

  /* Hide the mobile header on desktop — sidebar handles branding */
  .app-header {
    display: none;
  }

  /* Page header (non-home pages) — adjust for desktop */
  .page-header {
    padding: 36px 40px 28px;
  }
  .page-title {
    font-size: 40px;
  }

  /* 4-column grid on desktop */
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    padding: 28px 40px 40px;
  }

  /* Search + filters get more room */
  .search-bar {
    padding: 24px 40px 16px;
    position: sticky;
    top: 0;
  }

  .search-input {
    font-size: 15px;
  }

  .filter-pills {
    padding: 12px 40px 20px;
  }

  /* Card hover effects on desktop (no hover on mobile) */
  .card {
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  }
  .card:hover {
    transform: translateY(-3px);
    border-color: rgba(255,217,82,0.25);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }

  /* FAB — make it less obtrusive on desktop since the sidebar has an "Add" item */
  .fab {
    bottom: 32px;
    right: 32px;
  }

  /* Recipe detail — side-by-side layout on desktop */
  .recipe-detail-header {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 24px;
  }
  .recipe-hero,
  .recipe-hero-placeholder {
    border-radius: 20px;
    margin: 0 40px;
    width: calc(100% - 80px);
  }
  .recipe-detail-header .back-btn-overlay {
    top: 36px;
    left: 56px;
  }
  .recipe-detail-body {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 40px 60px;
  }
  .recipe-detail-title {
    font-size: 52px;
    margin-bottom: 16px;
  }

  /* Forms get a max-width on desktop so they don't sprawl */
  .form-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 40px 60px;
  }
  .form-input,
  .form-textarea {
    font-size: 15px;
  }

  /* Settings list */
  .settings-list {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 40px 60px;
  }

  /* Footer */
  .app-footer {
    padding: 40px 40px 60px;
  }
}

/* Wide desktop: 1400px+ — 5 columns */
@media (min-width: 1400px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Sidebar is hidden on mobile/tablet by default */
.desktop-sidebar {
  display: none;
}
