/* Thinkb4do Public Daily Ideas Sidebar v2.2.2
   Modern public-facing daily-life sidebar that replaces raw WordPress default widgets. */

#sidebar.tb4-smart-sidebar,
.tb4-smart-sidebar {
  position: sticky;
  top: calc(var(--header-h, 76px) + var(--space-lg, 24px));
  align-self: start;
  width: min(100%, 360px);
  display: grid;
  gap: 16px;
  font-family: "Noto Sans Thai", "Roboto", "Kanit", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--tb4-gray-900, #0f172a);
}

.tb4-smart-sidebar * { box-sizing: border-box; }

.tb4-smart-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 24px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 20px 45px rgba(15, 23, 42, .08);
  backdrop-filter: blur(18px);
  padding: 18px;
}

.tb4-smart-card h3,
.tb4-smart-card h4,
.tb4-smart-card p { margin: 0; }

.tb4-smart-card h3 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.25;
  letter-spacing: -.03em;
  margin-top: 8px;
  margin-bottom: 8px;
}

.tb4-smart-card h4 {
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}

.tb4-smart-card p,
.tb4-muted {
  color: rgba(51, 65, 85, .86);
  font-size: .9rem;
  line-height: 1.7;
}

.tb4-smart-kicker,
.tb4-card-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tb4-green, #1E6B45);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.tb4-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--tb4-orange, #F97316);
  box-shadow: 0 0 0 0 rgba(249, 115, 22, .36);
  animation: tb4SidebarPulse 1.9s ease-out infinite;
}

@keyframes tb4SidebarPulse {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .38); }
  70% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.tb4-smart-card-hero {
  color: #fff;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.22), transparent 26%),
    linear-gradient(135deg, #0f7a50 0%, #0b5d3e 58%, #0b3f31 100%);
  border-color: rgba(255,255,255,.18);
  min-height: 190px;
}

.tb4-smart-card-hero:after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.2) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .25;
  pointer-events: none;
}

.tb4-smart-card-hero > * { position: relative; z-index: 1; }
.tb4-smart-card-hero .tb4-smart-kicker { color: rgba(255,255,255,.86); }
.tb4-smart-card-hero p { color: rgba(255,255,255,.82); max-width: 86%; }

.tb4-smart-score {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.tb4-smart-score strong { font-size: 1.35rem; line-height: 1; }
.tb4-smart-score span { font-size: .62rem; opacity: .78; text-align: center; }

.tb4-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tb4-weather-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--tb4-green-light, #e8f5ee);
  font-size: 1.35rem;
}

.tb4-weather-location {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(30, 107, 69, .08);
  color: var(--tb4-green, #1E6B45);
  font-weight: 800;
  font-size: .78rem;
  margin-bottom: 10px;
}

.tb4-weather-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.tb4-weather-grid span {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 14px;
  background: rgba(15,23,42,.04);
  color: rgba(15,23,42,.76);
  font-size: .76rem;
  font-weight: 800;
}

.tb4-tool-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tb4-tool-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 11px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248,250,252,.92), rgba(241,245,249,.84));
  border: 1px solid rgba(15,23,42,.06);
  color: rgba(15,23,42,.9);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tb4-tool-list a:hover,
.tb4-tool-list a:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, .08);
  border-color: rgba(30, 107, 69, .18);
  outline: none;
}

.tb4-tool-list span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.06);
}

.tb4-tool-list strong { font-size: .84rem; line-height: 1.25; }

.tb4-search-card form,
.tb4-search-card .search-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 0;
}

.tb4-search-card input[type="search"],
.tb4-search-card .search-field {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(15,23,42,.1);
  background: rgba(248,250,252,.92);
  border-radius: 15px;
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.tb4-search-card input[type="search"]:focus,
.tb4-search-card .search-field:focus {
  border-color: rgba(30,107,69,.45);
  box-shadow: 0 0 0 4px rgba(30,107,69,.1);
}

.tb4-search-card button,
.tb4-search-card .search-submit {
  border: 0;
  min-height: 44px;
  border-radius: 15px;
  padding: 0 15px;
  background: var(--tb4-green, #1E6B45);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.tb4-sidebar-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  min-height: 46px;
  border-radius: 999px;
  background: var(--tb4-green, #1E6B45);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.tb4-recent-list { display: grid; gap: 8px; }

.tb4-recent-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: rgba(248,250,252,.8);
  border: 1px solid rgba(15,23,42,.05);
  color: inherit;
  text-decoration: none;
}

.tb4-recent-item span {
  display: grid;
  place-items: center;
  height: 34px;
  border-radius: 12px;
  background: rgba(30,107,69,.1);
  color: var(--tb4-green, #1E6B45);
  font-size: .72rem;
  font-weight: 900;
}

.tb4-recent-item strong {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: .86rem;
  line-height: 1.35;
}

.tb4-admin-note-card {
  padding: 12px 14px;
  text-align: center;
  background: rgba(15,23,42,.035);
  box-shadow: none;
}
.tb4-admin-note-card small { color: rgba(71,85,105,.78); font-weight: 700; }

.tb4-wp-widget-zone {
  display: grid;
  gap: 12px;
  margin-top: 2px;
}

.tb4-wp-widget-title {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .05);
  color: rgba(51, 65, 85, .88);
  font-size: .78rem;
  font-weight: 900;
}

.tb4-wp-widget-zone .widget {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 22px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .07);
  list-style: none;
}

.tb4-wp-widget-zone .widget-title,
.tb4-wp-widget-zone h2,
.tb4-wp-widget-zone h3,
.tb4-wp-widget-zone h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: -.01em;
}

.tb4-wp-widget-zone ul,
.tb4-wp-widget-zone ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tb4-wp-widget-zone li a,
.tb4-wp-widget-zone a {
  color: rgba(15, 23, 42, .82);
  text-decoration: none;
}

.tb4-wp-widget-zone li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.tb4-wp-widget-zone li:last-child { border-bottom: 0; }

/* Hide raw list markers that caused the old sidebar to look broken. */
.tb4-smart-sidebar ul,
.tb4-smart-sidebar ol,
.tb4-smart-sidebar li { list-style: none; }
.tb4-smart-sidebar li::marker { content: ""; }

@media (max-width: 1100px) {
  #sidebar.tb4-smart-sidebar,
  .tb4-smart-sidebar {
    position: static;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tb4-smart-card-hero,
  .tb4-search-card,
  .tb4-wp-widget-zone { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  #sidebar.tb4-smart-sidebar,
  .tb4-smart-sidebar { grid-template-columns: 1fr; gap: 12px; }
  .tb4-smart-card { border-radius: 20px; padding: 16px; }
  .tb4-tool-list { grid-template-columns: 1fr; }
  .tb4-weather-grid { grid-template-columns: 1fr 1fr 1fr; }
  .tb4-search-card form,
  .tb4-search-card .search-form { flex-direction: column; }
  .tb4-search-card button,
  .tb4-search-card .search-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .tb4-pulse-dot { animation: none; }
  .tb4-tool-list a { transition: none; }
}

/* v2.2.2 Public Daily Ideas Sidebar: daily-life cards, no private/internal wording. */
.tb4-card-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.88));
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 12px 24px rgba(15,23,42,.07);
  font-size: 1.25rem;
}

.tb4-event-card,
.tb4-food-card,
.tb4-calendar-card,
.tb4-ads-card {
  background:
    radial-gradient(circle at 88% 0%, rgba(30,107,69,.08), transparent 34%),
    rgba(255,255,255,.9);
}

.tb4-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tb4-chip-row a,
.tb4-mini-link-grid a,
.tb4-agenda-list a,
.tb4-sidebar-soft-cta {
  color: inherit;
  text-decoration: none;
}

.tb4-chip-row a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(30,107,69,.08);
  color: var(--tb4-green, #1E6B45);
  font-size: .78rem;
  font-weight: 900;
}

.tb4-mini-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.tb4-mini-link-grid a {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(15,23,42,.045);
  border: 1px solid rgba(15,23,42,.055);
  font-size: .78rem;
  font-weight: 900;
  color: rgba(15,23,42,.78);
}

.tb4-agenda-list {
  display: grid;
  gap: 9px;
  margin-top: 8px;
}

.tb4-agenda-list a {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: rgba(248,250,252,.84);
  border: 1px solid rgba(15,23,42,.055);
}

.tb4-agenda-list a > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.06);
}

.tb4-agenda-list strong {
  font-size: .86rem;
  line-height: 1.25;
}

.tb4-agenda-list small {
  color: rgba(71,85,105,.74);
  font-size: .74rem;
  line-height: 1.45;
}

.tb4-ads-card {
  border-color: rgba(249,115,22,.18);
  background:
    radial-gradient(circle at 90% 10%, rgba(249,115,22,.14), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,247,237,.88));
}

.tb4-sidebar-soft-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(249,115,22,.12);
  color: #9a3412;
  font-weight: 900;
}

.tb4-chip-row a:hover,
.tb4-chip-row a:focus-visible,
.tb4-mini-link-grid a:hover,
.tb4-mini-link-grid a:focus-visible,
.tb4-agenda-list a:hover,
.tb4-agenda-list a:focus-visible,
.tb4-sidebar-soft-cta:hover,
.tb4-sidebar-soft-cta:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15,23,42,.07);
}

@media (max-width: 720px) {
  .tb4-mini-link-grid { grid-template-columns: 1fr 1fr; }
  .tb4-smart-score strong { font-size: .92rem; }
}
