/* ============================================================
   APP CSS — Base escalable
   Variables → componentes → layouts → utilidades
   ============================================================ */

/* ---- Variables ------------------------------------------- */
:root {
  --color-bg:        #F9F7F4;
  --color-surface:   #FFFFFF;
  --color-border:    #E8E4DF;
  --color-text:      #1A1714;
  --color-muted:     #7A7370;
  --color-accent:    #C8521A;       /* acción principal */
  --color-accent-lt: #F4E8E1;       /* fondo suave accent */

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  --nav-h: 64px;        /* altura bottom nav */
  --fab-size: 56px;     /* botón central */
  --page-pad: 16px;
  --max-w: 680px;       /* ancho máximo contenido */
}

/* ---- Reset mínimo ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 16px); /* espacio para bottom nav */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ---- Tipografía ------------------------------------------ */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p  { color: var(--color-muted); }

/* ---- Layout principal ------------------------------------ */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px var(--page-pad);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--page-pad) 8px;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ---- Bottom Nav ------------------------------------------ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  color: var(--color-muted);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
  transition: color .15s;
  flex: 1;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item.active { color: var(--color-accent); }
.nav-item:hover  { color: var(--color-text); }

/* Hueco central para el FAB */
.nav-item--fab {
  pointer-events: none;
  flex: 1;
  visibility: hidden;
}

/* ---- FAB (botón central crear) --------------------------- */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) / 2);
  left: 50%;
  transform: translateX(-50%) translateY(50%);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .15s;
  z-index: 101;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2; }
.fab:hover {
  transform: translateX(-50%) translateY(50%) scale(1.07);
  box-shadow: var(--shadow-lg);
}
.fab:active {
  transform: translateX(-50%) translateY(50%) scale(.96);
}

/* ---- Cards de receta ------------------------------------- */
.recipe-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: box-shadow .15s;
}
.recipe-card:hover { box-shadow: var(--shadow-md); }

.recipe-card__cover {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  background: var(--color-border);
}

.recipe-card__body {
  padding: 14px 16px 16px;
}

.recipe-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.recipe-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: var(--color-text);
}

.recipe-card__author {
  font-size: .8rem;
  color: var(--color-muted);
}

.recipe-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* ---- Feed grid ------------------------------------------- */
.feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 540px) {
  .feed { grid-template-columns: 1fr 1fr; }
}

/* ---- Tag pill -------------------------------------------- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent-lt);
  color: var(--color-accent);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
}

/* ---- Avatar ---------------------------------------------- */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--color-border);
  flex-shrink: 0;
}
.avatar--sm { width: 28px; height: 28px; }
.avatar--md { width: 44px; height: 44px; }
.avatar--lg { width: 80px; height: 80px; }

/* ---- Formularios ----------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .95rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color .15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-accent);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-error { font-size: .78rem; color: #D0351C; margin-top: 4px; }
.form-hint  { font-size: .78rem; color: var(--color-muted); margin-top: 4px; }

/* ---- Botones --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn--primary  { background: var(--color-accent); color: #fff; }
.btn--outline  { border: 1.5px solid var(--color-border); color: var(--color-text); }
.btn--ghost    { color: var(--color-muted); padding: 8px 12px; }
.btn--full     { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .5; pointer-events: none; }

/* ---- Alertas / flash ------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 16px;
}
.alert--error   { background: #FEF0ED; color: #C0321A; border: 1px solid #F9C9C0; }
.alert--success { background: #EDFAF2; color: #1A7A45; border: 1px solid #B8EDD0; }

/* ---- Divisor --------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}

/* ---- Utilidades ------------------------------------------ */
.text-muted  { color: var(--color-muted); }
.text-accent { color: var(--color-accent); }
.text-sm     { font-size: .85rem; }
.text-xs     { font-size: .75rem; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-sm      { gap: 8px; }
.gap-md      { gap: 16px; }
.mt-sm       { margin-top: 8px; }
.mt-md       { margin-top: 16px; }
.mt-lg       { margin-top: 24px; }
.mb-md       { margin-bottom: 16px; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
