/* =====================================================================
   SUBIDHA HOME PAGE
   Loaded AFTER style.css: reuses its colours, fonts, search box, tabs and
   footer, and only adds what the home page needs (header, area buttons,
   shop cards). Subidha's own colour is Himalayan blue, so it never looks
   like any one shop.
   ===================================================================== */

/* 22 Nov (Batch C): ONE Subidha look = the deep green of Shop Admin (was Himalayan blue + orange).
   The control room's Look tab (main colour) still wins over this default. */
body.market { --brand: #1f6f50; --brand-dark: #154d38; --brand-soft: #e8f3ee; --sky: #1f6f50; }

/* 📍 Shops near me: a white button in the dark header. Buttons inherit the
   header's white text, so the colour must be set here or the words vanish. */
#near-me { background: #fff; color: var(--brand); font-weight: 800; border: 0; }

/* ---------- Header: name + area choice ---------- */

.market-header {
  background: var(--brand);
  color: white;
  position: relative;
  padding: calc(28px + env(safe-area-inset-top)) var(--gap) 18px;
}
.market-header-inner { max-width: 1100px; margin: 0 auto; position: relative; }

/* Home page only (not the compact cart header): the drawn Subidha banner
   (hills, sunrise, little shops) on top of the main colour. It's see-through,
   so it follows whatever main colour you pick in the Look tab. */
.market-header:not(.compact) {
  /* Batch C: the same soft gradient as a shop's default banner (the drawn red/orange hills clashed) */
  background-color: var(--brand);
  background-image:
    radial-gradient(120% 90% at 90% 0%, color-mix(in srgb, var(--brand) 55%, white) 0%, transparent 60%),
    linear-gradient(160deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 80%, black) 100%);
}
/* Your own photo (Look tab): covers the header, with a dark layer on top so
   white text stays readable on any photo (bright sky, white walls…) */
.market-header.has-photo {
  background: var(--brand) var(--banner-photo) center / cover no-repeat;
}
.market-header.has-photo::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0.55));
}
.market-header.has-photo .market-header-inner { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.market-logo { margin: 0; font-size: var(--step-4); font-weight: 800; line-height: 1; letter-spacing: -0.01em; }
.market-tagline { margin: 6px 0 18px; opacity: 0.9; }

.area-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.area-label { font-weight: 600; }
.area-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.area-button {
  padding: 7px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: transparent;
  color: white;
  font-weight: 600;
}
.area-button[aria-pressed="true"] { background: white; color: var(--brand); border-color: white; }


/* ---------- Shop list ---------- */

.market-main { max-width: 1100px; margin: 0 auto; padding: 8px var(--gap) 32px; }

.shop-list {
  display: grid;
  grid-template-columns: 1fr;          /* phones: one shop per row, big and easy to tap */
  gap: 18px;
}
@media (min-width: 640px)  { .shop-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .shop-list { grid-template-columns: repeat(3, 1fr); } }

/* The whole card is one link: anywhere you tap opens the shop */
.shop-card { display: block; color: inherit; text-decoration: none; }
.shop-card:hover .shop-card-name { text-decoration: underline; }

.shop-card-photo {
  position: relative;
  aspect-ratio: 16 / 7;
  border-radius: var(--radius-photo);
  overflow: hidden;
  background: var(--brand);     /* the SHOP'S colour, set per card */
}
.shop-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.shop-card-photo.no-photo {
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 3rem; font-weight: 800;
}

.open-chip {
  position: absolute; top: 10px; left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--step-0); font-weight: 600;
  background: white;
}
.open-chip.open   { color: #166534; }
.open-chip.closed { color: var(--ink-soft); }

.shop-card-body { padding: 8px 2px 0; }
.shop-card-name { margin: 0; font-size: var(--step-2); font-weight: 600; line-height: 1.25; }
.shop-card-type, .shop-card-tagline, .shop-card-hours { margin: 2px 0 0; font-size: var(--step-0); }
.shop-card-type { color: var(--ink-soft); }
.shop-card-tagline { color: var(--ink); }
.shop-card-hours.open   { color: #166534; }
.shop-card-hours.closed { color: var(--ink-soft); }


/* ---------- Cart page (/market/cart/) ---------- */

.market-header.compact { padding-bottom: 14px; }
.market-home-link { color: white; font-weight: 600; text-decoration: none; opacity: 0.9; }
.market-page-title { margin: 8px 0 0; font-size: var(--step-3); font-weight: 800; }
.market-header.compact .market-tagline { margin: 2px 0 0; }

.cart-page { max-width: 640px; }

/* One box per shop: the customer sees exactly what each shop will get */
.shop-group {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-photo);
}
.shop-group.has-problem { background: var(--mist); }
.shop-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.shop-group-head h2 { margin: 0; font-size: var(--step-2); }
.shop-group-head a { color: var(--sky); font-weight: 600; font-size: var(--step-0); white-space: nowrap; }

.group-line {
  display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.group-line-price { font-weight: 600; }
.group-sums { margin: 8px 0 0; font-size: var(--step-0); color: var(--ink-soft); text-align: right; }
.group-problem { margin: 8px 0 0; color: var(--warn); font-weight: 600; font-size: var(--step-0); }

.grand-total { margin: 18px 0 6px; padding-top: 4px; }
.hint { color: var(--ink-soft); font-size: var(--step-0); margin: 6px 0 0; }

/* After ordering */
.order-results h2 { font-size: var(--step-3); margin: 16px 0 10px; }
.results-list { list-style: none; padding: 0; margin: 0 0 12px; }
.results-list li { padding: 10px 12px; margin-bottom: 8px; border-radius: var(--radius-button); }
.results-list li.ok     { background: #ecfdf3; color: #166534; }
.results-list li.failed { background: #fff7ed; color: #7c2d12; }
.as-button { display: block; text-align: center; text-decoration: none; margin-top: 18px; }


/* ---------- Cart bar on the Subidha home page ---------- */

.market-cart-bar { text-decoration: none; }
.market-cart-bar span { font-weight: 600; }


/* ---------- Home banner (control screen → Look) ---------- */

.market-banner {
  margin: 0; padding: 10px var(--gap);
  background: var(--brand-dark);  /* replaced by the colour chosen in the Look tab */
  color: white; font-weight: 600; text-align: center;
}


/* ---------- Shops | Items switch ---------- */

.view-switch {
  display: flex; gap: 6px;
  max-width: 1100px; margin: 0 auto; padding: 10px var(--gap) 0;
}
.view-button {
  flex: 1; max-width: 200px;
  padding: 9px 12px;
  border: 1.5px solid var(--brand); border-radius: 999px;
  background: var(--paper); color: var(--brand);
  font-weight: 600;
}
.view-button[aria-pressed="true"] { background: var(--brand); color: white; }


/* ---------- Items view: same cards as a shop's product grid, plus the shop's name ---------- */

.item-card { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.item-card:hover .product-name { text-decoration: underline; }
.item-shop { margin: 2px 0 0; font-size: var(--step-0); color: var(--ink-soft); }
.more-items { display: block; margin: 24px auto 0; padding: 10px 22px; }


/* ---------- "Your shops" on Subidha home (Phase 3) ---------- */
.your-shops { margin: 18px 0 4px; }
.your-shops .section-heading { margin: 0 0 10px; }
.your-shops-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.your-shop {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border-radius: var(--radius-photo);
  border: 1px solid var(--line); border-left: 4px solid var(--shop, var(--brand));
  color: var(--ink); text-decoration: none; min-width: 120px;
}
.your-shop strong { font-weight: 600; }
.your-shop span { font-size: var(--step-0); color: var(--ink-soft); }
.your-shop span.open { color: #166534; }
.your-orders-link { display: inline-block; margin-top: 10px; color: var(--brand); font-weight: 600; text-decoration: none; }


/* ---------- Order page (/order/) ---------- */
.order-page { max-width: 640px; }
.order-shop { margin: 16px 0 2px; font-size: var(--step-2); }
.order-steps { list-style: none; padding: 0; margin: 16px 0 8px; border-left: 3px solid var(--line); }
.order-steps .step { position: relative; padding: 6px 0 6px 18px; color: var(--ink-soft); }
.order-steps .step::before {
  content: ""; position: absolute; left: -8px; top: 12px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--line);
}
.order-steps .step.done, .order-steps .step.now { color: var(--ink); }
.order-steps .step.done::before { background: #166534; border-color: #166534; }
.order-steps .step.now { font-weight: 700; }
.order-steps .step.now::before { background: var(--brand); border-color: var(--brand); }
.order-steps .step.cancelled { color: #b91c1c; font-weight: 700; }
.order-call { margin: 0 0 18px; padding: 12px; border-radius: var(--radius-button); background: #fff4d6; border: 1px solid #f0c75e; }
.order-call p { margin: 0 0 10px; font-weight: 600; }
.order-call .contact-link { background: var(--brand); color: #fff; margin: 0 6px 6px 0; }
.order-call .contact-link.whatsapp { background: #25d366; }
.order-call .contact-link.viber { background: #7360f2; }
.order-call.quiet { background: var(--mist); border-color: transparent; }
.order-call.quiet p { font-weight: 400; }
.order-hint { margin: 0 0 18px; padding: 10px 12px; border-radius: var(--radius-button); background: var(--mist); }
.order-items { list-style: none; padding: 0; margin: 0 0 8px; }
.order-items li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.order-view .primary { display: block; width: 100%; margin-top: 18px; }
.order-view .secondary.as-button { display: block; text-align: center; text-decoration: none; margin-top: 10px; color: var(--brand); border-color: var(--brand); }
.my-orders { margin-top: 28px; }
.my-orders-list { list-style: none; padding: 0; margin: 0; }
.my-orders-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.my-orders-list a { color: var(--brand); font-weight: 600; text-decoration: none; }


/* =====================================================================
   "Own a shop?" card on Subidha home (market/index.html)
   ===================================================================== */
.join-card {
  display: block; margin: 28px 0 8px; padding: 18px;
  border: 2px solid var(--warn); border-radius: 14px;
  background: color-mix(in srgb, var(--warn) 5%, white);
  color: var(--ink); text-decoration: none;
}
.join-card-top { display: flex; align-items: center; gap: 10px; }
.join-card-icon { font-size: 1.8rem; line-height: 1; }
.join-card-title { margin: 0; font-size: var(--step-2); font-weight: 800; color: #7c2d12; }
.join-card-text { display: block; margin: 6px 0 12px; color: #5b3a2a; max-width: 52ch; }
.join-card-button {
  display: block; padding: 11px; border-radius: var(--radius-button);
  background: var(--warn); color: white; text-align: center; font-weight: 800;
}
.join-card:hover .join-card-button { background: #9a3412; }
.join-card-note { display: block; margin-top: 8px; text-align: center; font-size: 0.85rem; color: #8a5a44; font-weight: 600; }
@media (min-width: 640px) { .join-card-button { display: inline-block; padding: 11px 28px; } .join-card-note { text-align: left; } }

/* 📌 My shops (/my/) */
.my-page section { margin-bottom: 22px; }
.my-list { list-style: none; margin: 0; padding: 0; }
.my-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.my-shop-link { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; color: inherit; text-decoration: none; min-width: 0; }
.my-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); flex: none; }
.my-icon { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 0.9rem; }
.my-order .hint { width: 100%; margin: 0; }
.my-call { display: flex; flex-wrap: wrap; gap: 6px; }
.my-call .contact-link { background: var(--brand); color: #fff; }
.my-camera { width: 100%; max-height: 260px; border-radius: 12px; background: #000; margin: 10px 0; }
.my-add label { display: block; margin-top: 10px; }
.my-add input { width: 100%; }
.my-explore { text-align: center; margin: 24px 0; }
.my-welcome .my-welcome-buttons { display: grid; gap: 10px; margin-top: 12px; }
.my-welcome .as-button { margin-top: 0; }
.my-sell { margin: 14px 0 0; text-align: center; }
.order-delivery { margin: 0 0 18px; padding: 10px 12px; border-radius: var(--radius-button); background: var(--mist); }
.order-delivery p { margin: 0 0 6px; }
.shop-card-near { margin: 4px 0 0; font-size: 0.9rem; font-weight: 600; }

/* ✅ Verified shop badge + filter (060) */
.shop-card-verified { margin: 2px 0 0; font-size: var(--step-0); font-weight: 600; color: #1b7a3d; }
.verified-filter { margin: 8px 0 0; }

/* 22 Nov clean-up (Explore = shops near you only): these old-model parts never show,
   even when market.js would switch them on (the code stays, dormant). */
.explore-clean #install-bar, .explore-clean #footer-install, .explore-clean #market-cart-bar,
.explore-clean .view-switch, .explore-clean #item-list, .explore-clean #more-items { display: none !important; }

/* "Own a shop? Start selling" (22 Nov): plain card in the green look; small under a list of shops */
.join-card[hidden] { display: none; }
.join-card { border: 1px solid var(--line, #e3e6ea); background: #f2f8f5; }
.join-card-title { color: #154d38; }
.join-card-text { color: var(--ink-soft, #4b5563); }
.join-card-button { background: #1f6f50; }
.join-card:hover .join-card-button { background: #154d38; }
.join-card-icon { color: #1f6f50; }
.join-card.join-card-small { padding: 12px 14px; margin-top: 20px; }
.join-card.join-card-small .join-card-title { font-size: var(--step-0, 1rem); }
.join-card.join-card-small .join-card-text { display: none; }   /* "be the first" only fits when no shop is near */
.join-card.join-card-small .join-card-top { margin-bottom: 8px; }
.join-card.join-card-small .join-card-button { display: inline-block; padding: 8px 18px; font-size: .95rem; }
