@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bg: #17121A;
  --bg-glow: radial-gradient(circle at 15% 0%, rgba(240,88,125,0.10), transparent 45%), radial-gradient(circle at 85% 15%, rgba(245,167,66,0.10), transparent 40%);
  --surface: #241C29;
  --surface-2: #2E2434;
  --ink: #F5F1EC;
  --muted: #AFA2B8;
  --line: #3A2E42;

  --teal: #2DBDAF;
  --teal-dark: #1F9285;
  --teal-glow: rgba(45,189,175,0.35);

  --amber: #F5A742;
  --amber-dark: #D6841E;
  --amber-glow: rgba(245,167,66,0.35);

  --rose: #F0587D;
  --rose-dark: #D53F63;
  --rose-glow: rgba(240,88,125,0.35);

  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 2px 8px rgba(0,0,0,0.25), 0 12px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.35), 0 26px 60px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; }

/* ---------- Topbar padronizada ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(23,18,26,0.82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); box-shadow: 0 0 0 4px rgba(245,167,66,0.12); }
.icon-btn:active { transform: scale(0.94); }

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.logo::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--rose));
  box-shadow: 0 0 12px var(--amber-glow);
  display: inline-block;
}

.container { max-width: 900px; margin: 0 auto; padding: 20px; }

/* ---------- Botões ---------- */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 13px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--amber), var(--rose));
  color: #1A1116;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(240,88,125,0.30);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 8px 22px rgba(240,88,125,0.42); }

.btn-secondary { background: var(--teal); color: #0D2523; font-weight: 700; box-shadow: 0 4px 14px var(--teal-glow); }
.btn-secondary:hover { background: var(--teal-dark); color: white; }

.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-lg { padding: 17px 26px; font-size: 1.05rem; border-radius: 15px; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
input[type="text"], input[type="password"], input[type="url"], textarea, select {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  width: 100%;
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 100px; font-family: 'Inter', sans-serif; }
select { color: var(--ink); }
select option { background: var(--surface); color: var(--ink); }

/* ---------- Totem (tela inicial) ---------- */
.totem { min-height: 100vh; display: flex; flex-direction: column; }

.totem-tiles {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 24px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  align-content: center;
}

.tile {
  position: relative;
  border-radius: var(--radius);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  min-height: 210px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.22s cubic-bezier(.2,.8,.3,1.3), box-shadow 0.22s ease;
}
.tile:hover { transform: translateY(-5px) scale(1.02); }
.tile:active { transform: scale(0.97); }

.tile-icon {
  position: relative;
  font-size: 1.8rem;
  z-index: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

.tile-label {
  position: relative;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.25rem, 2.3vw, 1.65rem);
  font-weight: 700;
  color: white;
  z-index: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.tile-sub {
  position: relative;
  font-size: 0.86rem;
  color: rgba(255,255,255,0.88);
  z-index: 1;
  margin-top: 3px;
}

.tile-salgados {
  background-image: linear-gradient(200deg, rgba(214,132,30,0.35), rgba(23,18,26,0.88)), linear-gradient(160deg, var(--amber), #A8540F);
  box-shadow: var(--shadow), 0 0 40px -12px var(--amber-glow);
}
.tile-doces {
  background-image: linear-gradient(200deg, rgba(213,63,99,0.35), rgba(23,18,26,0.88)), linear-gradient(160deg, var(--rose), #8E2C48);
  box-shadow: var(--shadow), 0 0 40px -12px var(--rose-glow);
}
.tile-favoritas {
  background-image: linear-gradient(200deg, rgba(31,146,133,0.35), rgba(23,18,26,0.88)), linear-gradient(160deg, var(--teal), #145E56);
  box-shadow: var(--shadow), 0 0 40px -12px var(--teal-glow);
}

@media (max-width: 760px) {
  .totem-tiles { grid-template-columns: 1fr; }
  .tile { min-height: 160px; }
}

/* ---------- Cartões de receita ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.recipe-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--line);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(245,167,66,0.35); }

.recipe-card .thumb {
  height: 165px;
  background: var(--surface-2) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2.3rem;
}
.recipe-card .thumb.cat-Salgados { background-color: #3A2A17; }
.recipe-card .thumb.cat-Doces { background-color: #3A1D28; }

.recipe-card .body { padding: 13px 15px 15px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.recipe-card .title { font-size: 1.02rem; line-height: 1.3; font-weight: 600; }
.recipe-card .meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 10px; }
.recipe-card .fav-btn {
  position: absolute; top: 10px; right: 10px;
  background: rgba(23,18,26,0.75); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%;
  width: 34px; height: 34px; font-size: 1.1rem; cursor: pointer; color: var(--amber);
  backdrop-filter: blur(4px);
}

.tag-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--teal);
}

/* ---------- Filtros ---------- */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.filters-bar select { width: auto; min-width: 140px; }

/* ---------- Modo Cozinha ---------- */
.cook-mode { min-height: 100vh; display: flex; flex-direction: column; background: #0F0B12; color: var(--ink); }
.cook-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; }
.cook-progress { font-family: 'JetBrains Mono', monospace; font-size: 1rem; color: var(--amber); }
.cook-step { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px 30px 40px; text-align: center; }
.cook-step p {
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  line-height: 1.35;
  max-width: 760px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
}
.cook-nav { display: flex; gap: 12px; padding: 20px; }
.cook-nav .btn { flex: 1; font-size: 1.15rem; padding: 20px; }
.cook-timer { font-family: 'JetBrains Mono', monospace; font-size: 2.2rem; color: var(--amber); text-align: center; padding-bottom: 10px; }

/* ---------- Hero de imagem na receita ---------- */
.recipe-hero {
  height: 240px;
  background: var(--surface-2) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 3rem;
  position: relative;
}
.recipe-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(23,18,26,0.9));
}

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 38px 30px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 { font-size: 1.8rem; margin-bottom: 6px; background: linear-gradient(135deg, var(--amber), var(--rose)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card p { color: var(--muted); margin: 0 0 20px; font-size: 0.9rem; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Import ---------- */
.import-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.import-tabs button {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}
.import-tabs button.active { background: linear-gradient(135deg, var(--amber), var(--rose)); color: #1A1116; border-color: transparent; }

.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--teal); }

.preview-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 20px; }

.ing-row, .step-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.ing-row input:nth-child(1) { flex: 0 0 90px; }
.ing-row input:nth-child(2) { flex: 0 0 60px; }
.ing-row input:nth-child(3) { flex: 0 0 80px; }
.ing-row input:nth-child(4) { flex: 1; }
.step-row textarea { flex: 1; }
.remove-btn { background: none; border: none; color: var(--rose); font-size: 1.3rem; cursor: pointer; width: 32px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h2 { color: var(--ink); margin-bottom: 8px; }

.spinner {
  border: 3px solid var(--surface-2);
  border-top-color: var(--amber);
  border-radius: 50%;
  width: 28px; height: 28px;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: rgba(240,88,125,0.12);
  border: 1px solid var(--rose);
  color: #FF9CB4;
  padding: 12px 14px;
  border-radius: 13px;
  font-size: 0.9rem;
  margin-top: 12px;
}

/* ---------- Ja fiz / avaliacao ---------- */
.rating-box { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tried-toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; font-size: 1rem; }
.tried-toggle input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--teal); }
.rating-buttons { display: flex; gap: 8px; margin-top: 12px; }
.rating-btn { flex: 1; padding: 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 0.85rem; cursor: pointer; color: var(--ink); }
.rating-btn.active { background: linear-gradient(135deg, var(--amber), var(--rose)); border-color: transparent; color: #1A1116; }

.badge-row { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.badge-tried { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--teal); }
.badge-rating-Mediano { color: var(--amber); }
.badge-rating-Bom { color: var(--teal); }
.badge-rating-Otimo { color: var(--rose); }

.recipe-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 32px;
  margin-top: 24px;
}
.recipe-columns h3 { margin-bottom: 4px; }

@media (min-width: 720px) {
  .recipe-columns { grid-template-columns: 1fr 1.3fr; }
}

#stepsView li { margin-bottom: 8px; }

@media (max-width: 600px) {
  .container { padding: 14px; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
