/* styles.css — FoodPWA vNext (JP Fresh Theme)
   目標：日系清爽、料理感、有質感；手機優先 + 桌機自適應
*/
:root{
  --bg:#FFF7ED;            /* 柔暖奶油底 */
  --bg2:#FFEDD5;           /* 更暖的底 */
  --card:#FFFFFF;
  --card2:#FFFBF2;
  --text:#1f2328;
  --muted:#6b7280;

  --brand:#FF8A3D;         /* 主橘 */
  --brand2:#FFC145;        /* 主黃 */
  --ok:#2F9E72;            /* 綠 */
  --warn:#FFB703;          /* 黃（警示） */
  --bad:#E24B4B;           /* 紅 */
  --line:#F2E3D2;

  --shadow: 0 16px 40px rgba(28, 25, 23, .10);
  --shadow2: 0 10px 22px rgba(28, 25, 23, .08);
  --r:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans TC","PingFang TC","Microsoft JhengHei", sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 520px at 12% 0%, rgba(242,107,58,.12), transparent 60%),
    radial-gradient(900px 520px at 90% 8%, rgba(47,158,114,.10), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

a{color:inherit;text-decoration:none}
.container{max-width:1100px;margin:0 auto;padding:14px 16px 104px}
.grid{display:grid;gap:14px}
@media(min-width:920px){ .grid-2{grid-template-columns:1fr 1fr} .grid-3{grid-template-columns:1fr 1fr 1fr} }

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(251,248,242,.72);
  border-bottom: 1px solid rgba(233,224,214,.9);
}
.topbar-inner{
  max-width:1100px;margin:0 auto;
  padding:12px 16px;
  display:flex;gap:12px;align-items:center;justify-content:space-between;
}
.topbar-left{display:flex;align-items:center;gap:10px}
.topbar-actions{display:flex;align-items:center;gap:10px}
.topbar-btn{
  width:40px;height:40px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background: rgba(255,255,255,.72);
  border:1px solid rgba(233,224,214,.85);
  box-shadow: var(--shadow2);
  cursor:pointer;
  font-size:18px;
  line-height:1;
}
.topbar-btn:active{transform: translateY(1px)}
.brand{
  display:flex; gap:10px; align-items:center;
  font-weight:900; letter-spacing:.2px;
}
.brand-badge{
  width:34px;height:34px;border-radius:14px;
  background: linear-gradient(135deg, rgba(242,107,58,.95), rgba(255,155,106,.95));
  box-shadow: var(--shadow2);
  position:relative;
  overflow:hidden;
}
.brand-badge::after{
  content:"";
  position:absolute;
  inset:0;
  background-repeat:no-repeat;
  background-position:center;
  background-size:22px 22px;
  opacity:.92;
  /* 小 LOGO（內嵌 SVG，避免依賴外部檔案） */
  background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><g fill="none" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M22 18c0-6 4-10 10-10s10 4 10 10"/><path d="M16 26h32"/><path d="M14 30c2 16 10 24 18 24s16-8 18-24"/><path d="M20 42h24"/><path d="M26 14v6"/><path d="M32 14v6"/><path d="M38 14v6"/></g></svg>');
}
.pill{
  display:inline-flex;gap:8px;align-items:center;
  padding:8px 12px;border-radius:999px;
  background: rgba(255,255,255,.72);
  border:1px solid rgba(233,224,214,.85);
  color:var(--muted);
  font-size:13px;
}
.pill b{color:var(--text)}

/* Action sheet (topbar menu) */
.action-sheet{display:flex;flex-direction:column;gap:10px}
.as-item{
  width:100%;
  text-align:left;
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 12px;
  border-radius:16px;
  background: rgba(255,255,255,.85);
  border:1px solid rgba(233,224,214,.9);
  box-shadow: 0 2px 0 rgba(28,25,23,.02);
  cursor:pointer;
}
.as-item:hover{box-shadow: var(--shadow2)}
.as-ico{
  width:34px;height:34px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background: rgba(242,107,58,.10);
  color: var(--text);
}
.as-txt{font-weight:800}
.as-go{margin-left:auto;color:var(--muted)}

/* Page hero */
.page-hero{
  padding:10px 0 6px;
  display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
}
.page-hero h1{
  margin:0; font-size:22px; letter-spacing:.2px;
}
.page-hero .lead{
  margin-top:6px; color:var(--muted); font-size:13px; line-height:1.4;
}
.icon-btn{
  width:40px;height:40px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background: rgba(255,152,0,.14);
  border:1px solid rgba(255,152,0,.28);
  box-shadow: var(--shadow2);
  color: var(--primary);
  font-weight:900;
}

/* Buttons */
.btn{
  border:0; cursor:pointer;
  padding:11px 14px;border-radius:14px;
  background: rgba(255,255,255,.85);
  color:var(--text);
  border:1px solid rgba(233,224,214,.9);
  box-shadow: 0 2px 0 rgba(28,25,23,.02);
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover{box-shadow: var(--shadow2)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  background: linear-gradient(135deg, rgba(242,107,58,.98), rgba(255,155,106,.98));
  border:0;
  color:#fff;
  font-weight:900;
}
.btn.danger{
  background: rgba(226,75,75,.10);
  border-color: rgba(226,75,75,.25);
}
.btn.ghost{background: transparent; box-shadow:none}

/* Cards */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.92));
  border:1px solid rgba(233,224,214,.92);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{padding:14px 14px 10px;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.card .hd h2, .card .hd h3{margin:0;font-size:16px}
.card .bd{padding:0 14px 14px}
.sub{color:var(--muted);font-size:13px;line-height:1.45}

.kpi{display:flex;gap:10px;flex-wrap:wrap}
.kpi .pill{background: rgba(255,255,255,.72)}

/* Inputs */
.input, select, textarea{
  width:100%;
  background: rgba(255,255,255,.92);
  border:1px solid rgba(233,224,214,.92);
  color:var(--text);
  border-radius: 14px;
  padding:11px 12px;
  outline:none;
  font-size:16px; /* avoid iOS focus zoom */
}
.input:focus, select:focus, textarea:focus{
  border-color: rgba(242,107,58,.55);
  box-shadow: 0 0 0 4px rgba(242,107,58,.12);
}
textarea{min-height:96px;resize:vertical}
.row{display:flex;gap:10px;flex-wrap:wrap}
.row > *{flex:1 1 160px}

/* Lists / items */
.list{display:flex;flex-direction:column;gap:10px}
.item{
  display:flex;gap:12px;align-items:center;
  padding:12px;border-radius:16px;
  background: rgba(255,255,255,.88);
  border:1px solid rgba(233,224,214,.92);
  box-shadow: var(--shadow2);
}
.item .thumb{
  width:54px;height:54px;border-radius:16px;
  background: rgba(246,239,230,.9);
  border:1px solid rgba(233,224,214,.92);
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
.item .thumb img{width:100%;height:100%;object-fit:cover}
.item .meta{flex:1}
.item .meta .t{font-weight:900}
.item .meta .m{
  color:var(--muted);font-size:13px;margin-top:5px;
  display:flex;gap:8px;flex-wrap:wrap
}

.badge{
  font-size:12px;padding:4px 9px;border-radius:999px;
  border:1px solid rgba(233,224,214,.95);
  background: rgba(255,255,255,.78);
  color:var(--muted);
}
.badge.ok{border-color: rgba(47,158,114,.28); background: rgba(47,158,114,.10); color:#1f6f52}
.badge.warn{border-color: rgba(242,183,5,.28); background: rgba(242,183,5,.12); color:#8a6a00}
.badge.bad{border-color: rgba(226,75,75,.30); background: rgba(226,75,75,.10); color:#9b1c1c}


/* Hit/Missing boxes */
.hmBox{
  padding:10px 12px;border-radius:16px;
  border:1px solid rgba(233,224,214,.95);
  background: rgba(255,255,255,.72);
}
.hmBox.ok{border-color: rgba(47,158,114,.28); background: rgba(47,158,114,.08)}
.hmBox.warn{border-color: rgba(242,183,5,.28); background: rgba(242,183,5,.10)}
.hmTitle{display:flex;align-items:center;gap:8px;margin-bottom:6px}

/* Chips */
.tagbar{display:flex;gap:8px;flex-wrap:wrap}
.chip{
  padding:9px 11px;border-radius:999px;
  border:1px solid rgba(233,224,214,.92);
  background: rgba(255,255,255,.78);
  color:var(--muted);
  font-size:13px;
  cursor:pointer;
}
.chip.active{
  color:#fff;
  border-color: transparent;
  background: linear-gradient(135deg, rgba(242,107,58,.98), rgba(255,155,106,.98));
}

/* Separators */
.hr{height:1px;background: rgba(233,224,214,.95);margin:12px 0}
.small{font-size:12px;color:var(--muted)}

/* Bottom nav – soft glass pill */
.bottom-nav{
  position:fixed;left:0;right:0;bottom:0;z-index:30;
  background: rgba(251,248,242,.75);
  backdrop-filter: blur(14px);
  border-top:1px solid rgba(233,224,214,.95);
}
.bottom-nav .inner{
  max-width:1100px;margin:0 auto;
  display:grid;grid-template-columns:repeat(4,1fr);
  gap:6px;padding:10px 10px;
}
.nav-btn{
  display:flex;flex-direction:column;gap:4px;
  align-items:center;justify-content:center;
  padding:10px 8px;border-radius:16px;
  color:var(--muted);
  border:1px solid transparent;
}
.nav-btn.active{
  color:var(--brand);
  background: rgba(255,255,255,.86);
  border-color: rgba(233,224,214,.95);
  box-shadow: var(--shadow2);
}
.nav-btn .ico{font-size:18px}
.nav-btn .txt{font-size:12px}

/* Modal (light) */
.modal-backdrop{
  position:fixed; inset:0; z-index:50;
  background: rgba(28,25,23,.45);
  display:none;
  align-items:flex-end;
  justify-content:center;
  padding:14px;
}
.modal{
  width:min(860px,100%);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.96));
  border:1px solid rgba(233,224,214,.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow:hidden;
  max-height: 86vh;
  display:flex;flex-direction:column;
}
.modal .mh{padding:14px;display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid rgba(233,224,214,.95)}
.modal .mh h3{margin:0;font-size:16px}
.modal .mb{padding:14px;overflow:auto}
.modal .mf{padding:12px 14px;border-top:1px solid rgba(233,224,214,.95);display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.modal-backdrop.show{display:flex}
/* --- Layout helpers for JP mock --- */
.section{margin-top:12px}
.section-title{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin:6px 2px 10px}
.section-title h2{margin:0;font-size:16px}
.section-title .sub{margin:0}

.hscroll{overflow:auto; -webkit-overflow-scrolling:touch; padding-bottom:4px}
.hscroll::-webkit-scrollbar{height:6px}
.hscroll::-webkit-scrollbar-thumb{background: rgba(233,224,214,.9); border-radius:999px}

#urgentBox{
  display:flex;
  flex-direction:row;
  gap:10px;
  overflow:auto;
  padding:2px 2px 6px;
}
#urgentBox .item{
  min-width: 240px;
  align-items:flex-start;
}
@media(min-width:920px){
  #urgentBox .item{min-width: 280px}
}

/* Recommended recipes as cards grid */
#recBox{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media(min-width:920px){
  #recBox{grid-template-columns: 1fr 1fr 1fr 1fr}
}
#recBox .item{
  flex-direction:column;
  align-items:stretch;
}
#recBox .item .thumb{
  width:100%;
  height:120px;
  border-radius:16px;
}
#recBox .item .meta{width:100%}
#recBox .item button.btn{align-self:flex-end}

/* Smaller recipe list cards */
.card-soft{
  background: rgba(255,255,255,.80);
  border:1px solid rgba(233,224,214,.92);
  border-radius: var(--r);
  box-shadow: var(--shadow2);
}

/* Step cards in modal */
.step-card{
  padding:10px;
  border:1px solid rgba(233,224,214,.95);
  border-radius:16px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow2);
  margin-bottom:10px;
}


/* Recipes list as grid cards */
#recipesList{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media(min-width:920px){
  #recipesList{grid-template-columns: 1fr 1fr 1fr 1fr}
}
#recipesList .item{
  flex-direction:column;
  align-items:stretch;
}
#recipesList .item .thumb{
  width:100%;
  height:140px;
  border-radius:16px;
}
#recipesList .item .meta{width:100%}
#recipesList .item .btn{align-self:flex-end}


/* ===== Loading Skeleton (1.7A-2) ===== */
.skeleton{position:relative;overflow:hidden;background:rgba(0,0,0,.06);border-radius:12px;}
.skeleton::after{content:"";position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);animation:sk 1.1s infinite;}
@keyframes sk{to{transform:translateX(100%);}}
.skel-row{height:14px;margin:10px 0;}
.skel-card{padding:12px;border:1px solid rgba(0,0,0,.06);border-radius:16px;background:rgba(255,255,255,.55);}


/* ===== Mobile Touch Optimization (Phase1) ===== */
.nav-btn{touch-action:manipulation;-webkit-tap-highlight-color:transparent;}
.nav-btn:active{transform:scale(.98);}


/* IG-like inline actions */
.iconBtn{display:inline-flex;align-items:center;gap:6px;padding:8px 10px;border-radius:12px;border:1px solid rgba(233,224,214,.95);background:#fff;cursor:pointer}
.iconBtn:active{transform:scale(.98)}
.iconBtn .small{opacity:.85}


/* Seasonal (Home) */
.seasonal-head{ margin-bottom:10px; }
.seasonal-title{ font-weight:900; font-size:18px; }
.seasonal-sub{ margin-top:4px; opacity:.82; font-size:13px; }
.seasonal-grid{ display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:720px){ .seasonal-grid{ grid-template-columns:1fr 1fr; } }
.seasonal-col{ padding:12px; border-radius:18px; background:rgba(255,255,255,.65); border:1px solid rgba(233,224,214,.95); }
.seasonal-h2{ display:flex; align-items:center; gap:8px; font-weight:900; margin-bottom:10px; }
.seasonal-h2 .ico{ font-size:18px; }
.seasonal-h2.fruit{ color:#d97706; } /* amber */
.seasonal-h2.veg{ color:#16a34a; } /* green */
.seasonal-chips{ display:flex; flex-wrap:wrap; gap:8px; }

.chip{ cursor:pointer; }
.chip-fruit{ border-color: rgba(217,119,6,.35); background: rgba(254,243,199,.85); }
.chip-veg{ border-color: rgba(22,163,74,.28); background: rgba(220,252,231,.85); }


/* Profile head (click to public page) */
.profile-head{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:18px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(233,224,214,.95);
  cursor:pointer;
}
.profile-head .avatar{
  width:40px; height:40px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-weight:900;
  background: rgba(255,245,219,.95);
  border:1px solid rgba(255,152,0,.25);
}
.profile-head .meta{ display:grid; line-height:1.15; }
.profile-head .name{ font-weight:900; }
.profile-head .subline{ font-size:13px; opacity:.9; display:flex; gap:6px; align-items:center; }
.profile-head .subline .title{ color:#e11d48; font-weight:900; } /* special title color */
.profile-head .subline .lv{ color:#0ea5e9; font-weight:900; }
.profile-head .go{ margin-left:auto; opacity:.7; font-weight:900; }

/* User title pill */
#uTitlePill #uTitleText{ color:#e11d48; font-weight:900; }
#uTitlePill #uLvText{ color:#0ea5e9; font-weight:900; }


/* --- OPT: Highlight titles --- */
.hl-title{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,152,0,.12);
  border: 1px solid rgba(255,152,0,.22);
  font-weight:800;
}
.hl-title .icon{ font-size:16px; }
.chip.kind-veg{ background: rgba(76,175,80,.12); border-color: rgba(76,175,80,.22); }
.chip.kind-fruit{ background: rgba(255,152,0,.12); border-color: rgba(255,152,0,.22); }
.chip.kind-meat{ background: rgba(244,67,54,.10); border-color: rgba(244,67,54,.22); }
.chip.kind-sea{ background: rgba(33,150,243,.10); border-color: rgba(33,150,243,.22); }
.chip.kind-season{ background: rgba(255,193,7,.12); border-color: rgba(255,193,7,.25); }


/* creations: comment preview */
.cmtPreview .cmtBox{
  margin-top:0;
  padding:10px 10px;
  border-radius:14px;
  background: rgba(255,247,230,.75);
  border:1px solid rgba(255,152,0,.18);
}
.cmtPreview .cmtLine{
  display:flex;
  gap:8px;
  padding:6px 0;
  border-bottom:1px dashed rgba(255,152,0,.18);
}
.cmtPreview .cmtLine:last-child{ border-bottom:none; }
.cmtPreview .cmtName{
  font-weight:900;
  color:#9A3412;
  white-space:nowrap;
}
.cmtPreview .cmtText{
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
.linkBtn{
  background:transparent;
  border:none;
  color:#FF7043;
  font-weight:900;
  padding:8px 0 0;
  cursor:pointer;
}

/* --- user chips (nickname/title/lv) --- */
.cmtHead{display:inline-flex;gap:6px;flex-wrap:wrap;align-items:center;margin-right:8px}
.uName{font-weight:700}
.uChip{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;font-size:12px;line-height:1.4;border:1px solid rgba(0,0,0,.08)}
.uChip .ico{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:6px;background:rgba(0,0,0,.06)}
.uChip.title.t1{background:rgba(76,175,80,.12);border-color:rgba(76,175,80,.22)}
.uChip.title.t2{background:rgba(255,152,0,.12);border-color:rgba(255,152,0,.24)}
.uChip.title.t3{background:rgba(156,39,176,.12);border-color:rgba(156,39,176,.22)}
.uChip.title.t4{background:rgba(33,150,243,.12);border-color:rgba(33,150,243,.22)}
.uChip.lv.lv1{background:rgba(158,158,158,.10);border-color:rgba(158,158,158,.20)}
.uChip.lv.lv2{background:rgba(255,193,7,.14);border-color:rgba(255,193,7,.26)}
.uChip.lv.lv3{background:rgba(255,87,34,.14);border-color:rgba(255,87,34,.26)}
.uChip.lv.lv4{background:rgba(233,30,99,.14);border-color:rgba(233,30,99,.26)}
/* comment preview lines */
.cmtLine{display:flex;gap:8px;align-items:flex-start}
.cmtLine .cmtText{flex:1;white-space:pre-wrap;line-height:1.5}

input, textarea, select { font-size: 16px; }
