/* ==========================================================================
   Mall Directory Comparison — styles
   All rules are scoped under .tmgc-root so they never leak into (or get
   clobbered by) a WordPress theme.
   ========================================================================== */

.tmgc-root {
  --tmgc-main: #A62B17;          /* Main-mall header (red)   */
  --tmgc-comp: #000000;          /* Competitor header (black) */
  --tmgc-sub: #D5D5D5;           /* Sub-category band        */
  --tmgc-line: #BFBFBF;          /* Grid lines               */
  --tmgc-divider: #6E6E6E;       /* Thick rule between malls */
  --tmgc-divider-width: 4px;
  --tmgc-closed: #ADADAD;        /* Status = FALSE text      */
  --tmgc-ink: #1a1a1a;
  --tmgc-row-h: 52px;

  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "Noto Sans Thai", "Sarabun", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  color: var(--tmgc-ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
.tmgc-root *,
.tmgc-root *::before,
.tmgc-root *::after { box-sizing: inherit; }

.tmgc-root button { font: inherit; color: inherit; }

/* ---------- Screen 1 : selection ----------------------------------------- */

.tmgc-select-screen {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  padding: 56px 20px;
}

.tmgc-field { position: relative; flex: 1 1 320px; max-width: 420px; }

.tmgc-control {
  width: 100%;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  background: #fff;
  border: 1px solid #d2d2d2;
  border-radius: 2px;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease;
}
.tmgc-control:hover { border-color: #9a9a9a; }
.tmgc-control:focus-visible { outline: 2px solid #A62B17; outline-offset: 2px; }
.tmgc-control.is-placeholder { font-weight: 700; }
.tmgc-control.is-open { border-color: #7a7a7a; }

.tmgc-control-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tmgc-caret { flex: none; font-size: 12px; line-height: 1; transform: translateY(1px); }

/* native select for the main mall, styled like the mock-up */
.tmgc-native-select {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  width: 100%;
  height: 100%;
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  padding: 0 18px;
  color: inherit;
}
.tmgc-native-wrap { position: relative; display: flex; align-items: center; padding: 0; }
.tmgc-native-wrap .tmgc-caret {
  position: absolute; right: 18px; pointer-events: none;
}

/* checkbox dropdown */
.tmgc-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d2d2d2;
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  padding: 6px;
}
.tmgc-menu[hidden] { display: none; }

.tmgc-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
}
.tmgc-opt:hover:not(:disabled) { background: #f2f2f2; }
.tmgc-opt:focus-visible { outline: 2px solid #A62B17; outline-offset: -2px; }
.tmgc-opt.is-disabled { color: #b0b0b0; cursor: not-allowed; }

.tmgc-box {
  flex: none;
  width: 18px;
  height: 18px;
  border: 1px solid #b5b5b5;
  border-radius: 3px;
  background: #fff;
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}
.tmgc-box.is-checked { background: #A62B17; border-color: #A62B17; }
.tmgc-opt.is-disabled .tmgc-box { background: #f0f0f0; border-color: #dcdcdc; }

.tmgc-opt-name { flex: 1 1 auto; }
.tmgc-opt-note { margin-left: auto; font-size: 12px; color: #999; }

.tmgc-menu-foot {
  border-top: 1px solid #ececec;
  margin-top: 6px;
  padding: 8px 12px 4px;
  font-size: 12px;
  color: #8a8a8a;
  text-align: left;
}

.tmgc-ok {
  flex: none;
  height: 62px;
  min-width: 132px;
  padding: 0 34px;
  border: 0;
  border-radius: 999px;
  background: #9b9b9b;
  color: #fff;
  font-weight: 700;
  cursor: not-allowed;
}
/* Scoped past the `.tmgc-root button { font: inherit }` reset above, which
   otherwise outranks a bare .tmgc-ok selector and pins every button to 15px.
   Rendered size: 15px + 4px. */
.tmgc-root .tmgc-ok { font-size: 19px; }
.tmgc-ok.is-ready { background: #000; color: #fff; cursor: pointer; }
.tmgc-ok.is-ready:hover { background: #262626; }
.tmgc-ok:focus-visible { outline: 2px solid #A62B17; outline-offset: 3px; }

.tmgc-hint {
  flex-basis: 100%;
  text-align: center;
  font-size: 13px;
  color: #8a8a8a;
  margin: 4px 0 0;
}

/* ---------- Screen 2 : comparison ---------------------------------------- */

/* The header is sticky against this box, so the box (not the page) owns the
   vertical scroll. Override --tmgc-max-height on the container to change it. */
.tmgc-scroller {
  width: 100%;
  max-height: var(--tmgc-max-height, 85vh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--tmgc-line);
}

.tmgc-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.tmgc-table th, .tmgc-table td {
  border: 1px solid var(--tmgc-line);
  padding: 0;
  vertical-align: middle;
}

/* Each mall occupies two sub-columns; the first of the pair carries a thick
   rule so the boundary between malls reads clearly. */
.tmgc-table .tmgc-mall-start {
  border-left: var(--tmgc-divider-width) solid var(--tmgc-divider);
}
.tmgc-table thead th.tmgc-mall-start {
  border-left: var(--tmgc-divider-width) solid #fff;
}

/* sticky mall header */
.tmgc-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 54px;
  padding: 8px 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  background: var(--tmgc-comp);
  border-color: #000;
}
.tmgc-mall-name { display: block; }

/* Second header line from mallinfo.csv: solid white, half the mall-name size. */
.tmgc-mall-info {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 50%;
  font-weight: 400;
  line-height: 1.3;
  opacity: 1;
}
.tmgc-table thead th.tmgc-th-main { background: var(--tmgc-main); border-color: var(--tmgc-main); }
.tmgc-table thead th.tmgc-th-back {
  padding: 0;
  position: sticky;
  left: 0;
  z-index: 15;
  background: var(--tmgc-main);
  border-color: var(--tmgc-main);
  padding: 0;
}

.tmgc-back {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 54px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.tmgc-back:hover { background: rgba(255,255,255,.16); }
.tmgc-back:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

/* category accordion band */
.tmgc-cat-cell { padding: 0 !important; border-color: var(--tmgc-line); }
.tmgc-cat-btn {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 19px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.tmgc-cat-btn:focus-visible { outline: 2px solid #000; outline-offset: -3px; }

/* Sticky-left so the band label survives horizontal scrolling. */
.tmgc-cat-inner {
  position: sticky;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
}
.tmgc-cat-chev { font-size: 13px; opacity: .75; transition: transform .18s ease; }
.tmgc-cat-btn[aria-expanded="true"] .tmgc-cat-chev { transform: rotate(90deg); }
.tmgc-cat-count { font-size: 13px; font-weight: 600; opacity: .7; }

/* sub-category band — an accordion, same behaviour as the category band */
.tmgc-sub-cell {
  background: var(--tmgc-sub);
  padding: 0 !important;
}
.tmgc-sub-btn {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 400;
  text-align: center;
  cursor: pointer;
}
.tmgc-sub-btn:hover { background: rgba(0, 0, 0, .06); }
.tmgc-sub-btn:focus-visible { outline: 2px solid #000; outline-offset: -3px; }

.tmgc-sub-inner {
  position: sticky;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
}
.tmgc-sub-chev { font-size: 11px; opacity: .6; transition: transform .18s ease; }
.tmgc-sub-btn[aria-expanded="true"] .tmgc-sub-chev { transform: rotate(90deg); }
.tmgc-sub-count { font-size: 12px; font-weight: 600; opacity: .55; }

/* shop rows */
.tmgc-shop-row > td { height: var(--tmgc-row-h); }

/* Indicator column stays pinned while the table scrolls sideways. */
.tmgc-dot-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #fff;
  text-align: center;
  padding: 0 4px !important;
}
.tmgc-dot {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.28), inset 0 3px 5px rgba(255,255,255,.5);
}
.tmgc-dot-green  { background: #23bf27; }
.tmgc-dot-yellow { background: #f2cf1c; }
.tmgc-dot-red    { background: #e02a1e; }

.tmgc-name-cell { text-align: center; padding: 5px 8px !important; }
.tmgc-loc-cell  { text-align: center; padding: 5px 4px !important; }

.tmgc-entry + .tmgc-entry { margin-top: 6px; padding-top: 6px; border-top: 1px dotted #dcdcdc; }
.tmgc-entry { min-height: 40px; display: flex; flex-direction: column; justify-content: center; }

.tmgc-shop { font-size: 17px; }
.tmgc-shop.has-pic {
  font-weight: 700;
  background: none;
  border: 0;
  padding: 0;
  cursor: zoom-in;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,.22);
  text-underline-offset: 3px;
}
.tmgc-shop.has-pic:hover { text-decoration-color: currentColor; }

/* Closed shops: grey and struck through. Declared after .has-pic so the
   line-through wins over the photo-link underline. */
.tmgc-shop.is-closed,
.tmgc-shop.has-pic.is-closed,
.tmgc-shop.has-pic.is-closed:hover {
  color: var(--tmgc-closed);
  text-decoration: line-through;
  text-decoration-color: var(--tmgc-closed);
}
.tmgc-icon { margin-right: 2px; }

.tmgc-floor { font-size: 16px; }
.tmgc-zone  { font-size: 12px; color: #4a4a4a; }
.tmgc-entry.is-closed .tmgc-floor,
.tmgc-entry.is-closed .tmgc-zone { color: var(--tmgc-closed); }

.tmgc-empty-note { padding: 40px 16px; text-align: center; color: #8a8a8a; }

/* ---------- Lightbox ------------------------------------------------------ */

.tmgc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0,0,0,.82);
}
.tmgc-lightbox[hidden] { display: none; }
.tmgc-lb-inner {
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.tmgc-lb-img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
}
.tmgc-lb-cap { color: #fff; font-size: 16px; text-align: center; }
.tmgc-lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.tmgc-lb-close:hover { background: rgba(255,255,255,.28); }
.tmgc-lb-fallback { color: #fff; text-align: center; font-size: 15px; }
.tmgc-lb-fallback a { color: #8ecbff; }
.tmgc-lb-spinner { color: #fff; font-size: 15px; }

/* ---------- Status / errors ---------------------------------------------- */

.tmgc-status { padding: 48px 16px; text-align: center; color: #6a6a6a; }
.tmgc-status.is-error { color: #A62B17; }

@media (max-width: 640px) {
  .tmgc-control { height: 54px; font-size: 17px; }
  .tmgc-ok { height: 54px; }
  .tmgc-root .tmgc-ok { font-size: 21px; }
  .tmgc-select-screen { padding: 28px 14px; }
}
