/* ===========================================================
   CampusMarket — Light theme
   Light is the default theme; js/theme.js sets <html data-theme="light"> unless
   the visitor picked dark. The dark palette is still defined in each page /
   style.css and is used when the attribute is absent.
   Surfaces are shades of white; text is near-black; the blue accent
   family is kept but deepened so it stays readable on white.
   =========================================================== */
html[data-theme="light"]{
  color-scheme: light;

  /* surfaces — shades of white */
  --bg:        #ffffff;
  --bg-alt:    #f7f7f8;
  --surface:   #fafafa;
  --surface-2: #f1f1f3;
  --border:    #e2e2e6;

  /* text */
  --text:      #17171a;
  --text-dim:  #55555d;
  --text-mute: #75757e;

  /* accent family (same blue→indigo ramp, deeper for white backgrounds) */
  --c1: #0369a1;
  --c2: #1d63d1;
  --c3: #2563eb;
  --c4: #1d4ed8;
  --c5: #4f46e5;
  --c6: #3730a3;

  /* text/borders that sit on accent fills (dark text in dark mode) */
  --on-accent: #ffffff;
  --danger: #be123c;
  --danger-border: #f1b9c6;

  /* admin panel palette */
  --cabinet:     #ffffff;
  --cabinet-2:   #f7f7f8;
  --border-soft: #eeeef0;
  --paper:       #fafafa;
  --paper-2:     #f1f1f3;
  --paper-3:     #ebebee;
  --paper-border:#dcdce0;
  --ink-strong:  #17171a;
  --ink-dim:     #55555d;
  --ink-mute:    #75757e;
  --ink:         #f74689;
  --rust:        #be123c;  --rust-deep:  #9f1239;
  --moss:        #a16207;  --moss-deep:  #854d0e;
  --slate:       #4338ca;  --slate-deep: #3730a3;
  --plum:        #6d28d9;  --plum-deep:  #5b21b6;
  --red:         #be123c;  --green:      #a16207;
}

/* page backgrounds */
html[data-theme="light"] body{ background: var(--bg); color: var(--text); }
html[data-theme="light"] body::before{ background: var(--bg); }
html[data-theme="light"] body::after{ display: none; }

/* top bar */
html[data-theme="light"] .topbar{ background: rgba(255,255,255,0.88); }

/* glass panels */
html[data-theme="light"] .glass-panel{
  background: rgba(250,250,250,0.9);
  border-color: var(--border);
}

/* inputs keep the chosen surface instead of a dark fill */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{ color-scheme: light; }

/* admin status buttons that used light-on-dark text */
html[data-theme="light"] .btn-danger{ color: var(--danger); }
html[data-theme="light"] .btn-ok{ color: #166534; }
html[data-theme="light"] .tab-btn .badge.hot{ color: var(--danger); }

/* safety notices (js/safety.js) */
html[data-theme="light"] .cm-safety-tip{ background:#f4f8fb; border-color:#cfe0ea; color:#274a5c; }
html[data-theme="light"] .cm-safety-warning{ background:#fff5f3; border-color:#f1c4bb; color:#8a2f1f; }

/* theme toggle button */
.cm-theme-toggle{ cursor: pointer; }
.cm-theme-toggle-float{
  position: fixed; left: 14px; bottom: 14px; z-index: 2000;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border, #2b2b31);
  background: var(--surface, #1a1a1e); color: var(--text, #f5f5f2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer;
}

/* ===========================================================
   SEARCH MODE — while the buyer is searching (body.is-searching,
   set by index-2.js / services-2.js) everything ABOVE the search bar
   (hero, services callout) stays visible. Below it, only the matching
   products/services show: follow banner, recents, ads and trending
   shops get out of the way.
   =========================================================== */
body.is-searching #followDropsBanner,
body.is-searching #recentlyViewedSection,
body.is-searching #paidAds,
body.is-searching #sponsoredShops{
  display: none !important;
}

/* ===========================================================
   TOP-BAR SEARCH — a magnifier after the theme icon. Click it and it
   expands into a text box (index.html + services.html).
   Desktop: grows inline. Phones: takes over the whole top bar.
   =========================================================== */
.nav-search{ position: relative; display: flex; align-items: center; }
.nav-search-toggle.has-query::after{
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--c4);
}
.nav-search-form{
  display: flex; align-items: center; gap: 4px;
  width: 0; opacity: 0; overflow: hidden; visibility: hidden;
  margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  transition: width .22s ease, opacity .18s ease, margin .22s ease, visibility 0s linear .22s;
}
.nav-search.open .nav-search-form{
  width: 240px; opacity: 1; visibility: visible; margin-left: 6px; padding: 2px 6px 2px 14px;
  transition: width .22s ease, opacity .18s ease, margin .22s ease;
}
.nav-search-form input{
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 7px 0;
}
.nav-search-form input::placeholder{ color: var(--text-mute); }
.nav-search-back{ display: none; }
.filter-bar.filter-docket{ margin-top: 18px; }

@media (max-width: 720px){
  .nav-search-form{
    position: fixed; top: 0; left: 0; right: 0; height: 64px;
    width: auto; border-radius: 0; border: 0; border-bottom: 1px solid var(--border);
    background: var(--bg, #0b0b0d); z-index: 1100; padding: 0 10px;
    transform: translateY(-100%); transition: transform .2s ease, opacity .15s ease, visibility 0s linear .2s;
  }
  .nav-search.open .nav-search-form{
    width: auto; margin: 0; padding: 0 10px; transform: translateY(0);
    transition: transform .2s ease, opacity .15s ease;
  }
  .nav-search-back{ display: flex; }
  .nav-search-form input{ font-size: 16px; }   /* 16px stops iOS zooming into the field */
}

/* ---------- "I accept the Terms" checkbox ----------
   The native checkbox was a flex child with no fixed size: on narrow screens the long terms text squeezed it to a sliver, and the
   browser-drawn box is faint on light surfaces in Safari/Firefox. This one has a fixed, never-shrinking size, a clear border and a
   visible tick, and the whole line is the tap target. */
.cm-terms-check{
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14px; line-height: 1.5; margin: 14px 0; cursor: pointer;
  color: var(--text-dim);
}
.cm-terms-check input[type="checkbox"]{
  -webkit-appearance: none; appearance: none;
  flex: 0 0 24px; width: 24px; min-width: 24px; height: 24px; min-height: 24px;
  margin: 1px 0 0; padding: 0; box-sizing: border-box;
  border: 2px solid var(--text-mute); border-radius: 6px;
  background: var(--bg, #fff) center / 16px 16px no-repeat;
  cursor: pointer; display: inline-block; vertical-align: top;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.cm-terms-check input[type="checkbox"]:checked{
  background-color: var(--c5);
  border-color: var(--c5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.cm-terms-check input[type="checkbox"]:focus-visible{ outline: 3px solid var(--c5); outline-offset: 2px; }
.cm-terms-check input[type="checkbox"]:hover{ border-color: var(--c5); }
.cm-terms-check a{ color: var(--c5); text-decoration: underline; }
