/* ============================================================
   Travel Weather Widget  v4.0
   ============================================================ */

/* ── Wrapper ───────────────────────────────────────────────── */
.tw-weather-widget {
  background: #fff;
  padding: 28px 24px 24px;
  border-radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 4px 28px rgba(0,0,0,.08);
  box-sizing: border-box;
  position: relative;
  overflow: visible;
}

/* ── Header ─────────────────────────────────────────────────── */
.tw-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.tw-title-block { flex: 1 1 180px; }

.tw-country-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.tw-flag { font-size: 22px; line-height: 1; flex-shrink: 0; }

.tw-subtitle {
  margin: 0;
  font-size: 13px;
  color: #aaa;
}

/* ── Controls row ────────────────────────────────────────────── */
.tw-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Legend ─────────────────────────────────────────────────── */
.tw-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tw-legend-item {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tw-legend-item::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tw-legend-item.best::before  { background: #2e7d4f; }
.tw-legend-item.good::before  { background: #6aaa5a; }
.tw-legend-item.mixed::before { background: #e6a832; }
.tw-legend-item.poor::before  { background: #e05252; }

/* ── °C / °F toggle ─────────────────────────────────────────── */
.tw-toggle {
  display: flex;
  background: #f0f0f0;
  border-radius: 20px;
  padding: 2px;
}

.tw-toggle button {
  border: none;
  background: transparent;
  padding: 5px 14px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #888;
  transition: background .22s, color .22s, box-shadow .22s;
  line-height: 1;
}

.tw-toggle button.active {
  background: #1a1a2e;
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,26,46,.22);
}

/* ── Region <select> ─────────────────────────────────────────── */
.tw-region-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
  max-width: 210px;
}

.tw-region-select:focus { border-color: #6aaa5a; }

/* ── Chart container ────────────────────────────────────────── */
.tw-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 290px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.tw-chart::-webkit-scrollbar       { height: 4px; }
.tw-chart::-webkit-scrollbar-track { background: transparent; }
.tw-chart::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── Month column ───────────────────────────────────────────── */
.tw-month {
  text-align: center;
  flex: 1 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Weather icon ────────────────────────────────────────────── */
.tw-icon {
  font-size: 19px;
  line-height: 1;
  margin-bottom: 5px;
  transition: transform .2s;
  user-select: none;
}

.tw-month:hover .tw-icon { transform: scale(1.18) translateY(-1px); }

/* ── Capsule track ───────────────────────────────────────────── */
.tw-capsule {
  background: #f0f0f0;
  width: 38px;
  height: 200px;
  border-radius: 20px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* ── Bar ─────────────────────────────────────────────────────── */
.tw-bar {
  width: 100%;
  border-radius: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  position: relative;
  cursor: pointer;
  transition:
    height  .45s cubic-bezier(.34,1.56,.64,1),
    filter  .18s ease,
    transform .18s ease;
}

.tw-bar:hover {
  filter: brightness(1.13) saturate(1.1);
  transform: scaleX(1.07);
  z-index: 2;
}

/* Bar colours */
.bar-best  { background: linear-gradient(to top, #1b5e38, #3cb371); }
.bar-good  { background: linear-gradient(to top, #4a8e3c, #82c868); }
.bar-mixed { background: linear-gradient(to top, #c47f0a, #f5c242); }
.bar-poor  { background: linear-gradient(to top, #b83232, #e87070); }

/* Temperature label inside bar */
.tw-bar span {
  position: absolute;
  bottom: 7px;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,.95);
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  letter-spacing: -.3px;
}

/* ── Month label ─────────────────────────────────────────────── */
.tw-name {
  font-weight: 700;
  font-size: 11px;
  color: #777;
  margin-top: 7px;
  letter-spacing: .2px;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.tw-tooltip {
  position: absolute;
  z-index: 200;
  width: 178px;
  background: #1a1a2e;
  color: #fff;
  border-radius: 14px;
  padding: 13px 15px 11px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(.95);
  transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 10px 32px rgba(0,0,0,.30);
  border-top: 3px solid #6aaa5a;
}

.tw-tooltip.tw-tooltip--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Type accent colour */
.tw-tooltip.tw-tooltip--best  { border-top-color: #3cb371; }
.tw-tooltip.tw-tooltip--good  { border-top-color: #82c868; }
.tw-tooltip.tw-tooltip--mixed { border-top-color: #f5c242; }
.tw-tooltip.tw-tooltip--poor  { border-top-color: #e87070; }

/* Month label */
.tw-tt-month {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.42);
  margin-bottom: 3px;
}

/* Large temperature */
.tw-tt-temp {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.5px;
}

/* Condition text */
.tw-tt-condition {
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
  color: rgba(255,255,255,.80);
}

/* Rain + sun row */
.tw-tt-meta {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(255,255,255,.10);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.52);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .tw-weather-widget { padding: 18px 14px 16px; }

  .tw-header { flex-direction: column; gap: 12px; }

  .tw-country-title { font-size: 16px; }

  .tw-controls { width: 100%; justify-content: flex-start; }

  .tw-region-select { max-width: 100%; width: 100%; }

  .tw-chart   { height: 248px; gap: 4px; }
  .tw-month   { flex: 1 0 34px; }
  .tw-capsule { width: 32px; height: 172px; }
  .tw-icon    { font-size: 15px; }
  .tw-bar span { font-size: 9px; }
  .tw-tooltip  { width: 158px; }
  .tw-tt-temp  { font-size: 24px; }
}

@media (max-width: 380px) {
  .tw-legend   { gap: 6px; }
  .tw-chart    { gap: 3px; }
  .tw-month    { flex: 1 0 28px; }
  .tw-capsule  { width: 26px; }
}

/* ============================================================
   v5.0 ADDITIONS — Live Weather Strip
   ============================================================ */

.tw-live-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f5e9 100%);
  border: 1.5px solid #d0e8f0;
  border-radius: 12px;
  padding: 10px 16px;
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  flex-wrap: wrap;
  min-height: 42px;
  transition: background .3s;
}

.tw-live-strip.tw-live-loaded {
  background: linear-gradient(135deg, #e8f5e9 0%, #f0f8ff 100%);
}

.tw-live-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.tw-live-temp {
  font-size: 15px;
  font-weight: 800;
  color: #1a1a2e;
  white-space: nowrap;
}

.tw-live-desc {
  color: #555;
  font-weight: 600;
}

.tw-live-meta {
  margin-left: auto;
  color: #888;
  font-size: 12px;
  white-space: nowrap;
}

/* ── Live strip label badge ── */
.tw-live-strip::before {
  content: "LIVE";
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.2px;
  background: #27ae60;
  color: #fff;
  padding: 2px 6px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* ============================================================
   v5.0 ADDITIONS — Compact Card Layout
   ============================================================ */

.tw-card-layout {
  max-width: 340px;
  padding: 20px 18px 18px;
}

.tw-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tw-card-header .tw-flag {
  font-size: 34px;
  line-height: 1;
  flex-shrink: 0;
}

.tw-card-titles { flex: 1; }

.tw-card-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1.25;
}

.tw-card-best {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #2e7d4f;
  letter-spacing: -.4px;
  line-height: 1.1;
}

/* Month pills row */
.tw-month-pills {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 10px 0 4px;
  scrollbar-width: none;
}
.tw-month-pills::-webkit-scrollbar { display: none; }

.tw-pill {
  flex-shrink: 0;
  padding: 4px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  background: #f0f0f0;
  color: #999;
  letter-spacing: .2px;
  transition: background .2s, color .2s;
  cursor: default;
  user-select: none;
}

.tw-pill-best {
  background: linear-gradient(135deg, #2e7d4f, #52b788);
  color: #fff;
  box-shadow: 0 2px 6px rgba(46,125,79,.3);
}

/* Expand button */
.tw-expand-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 9px 0;
  background: #f5f5f5;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  text-align: center;
  transition: background .2s, color .2s;
  letter-spacing: .2px;
}

.tw-expand-btn:hover {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

/* Expanded panel */
.tw-expand-panel {
  margin-top: 14px;
}

.tw-card-controls {
  margin-bottom: 10px;
}

/* Card live strip (more compact) */
.tw-card-layout .tw-live-strip {
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 12px;
}

.tw-card-layout .tw-live-temp {
  font-size: 14px;
}

/* ============================================================
   v5.0 ADDITIONS — Inline Suggestion Widget [travel_best_time]
   ============================================================ */

.tw-inline-suggestion {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #e8f5e9 0%, #f0f8ff 100%);
  border: 1.5px solid #c8e6c9;
  border-radius: 30px;
  padding: 6px 14px 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  vertical-align: middle;
  flex-wrap: wrap;
  line-height: 1.3;
}

.tw-inline-flag {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.tw-inline-label {
  color: #555;
  font-weight: 600;
  font-size: 12px;
}

.tw-inline-range {
  color: #2e7d4f;
  font-weight: 900;
  font-size: 13px;
}

.tw-inline-live {
  font-size: 12px;
  background: #fff;
  border: 1px solid #d0e8d0;
  border-radius: 20px;
  padding: 2px 8px;
  color: #555;
  font-weight: 700;
  transition: all .3s;
  white-space: nowrap;
}

.tw-inline-live--loaded {
  background: #27ae60;
  color: #fff;
  border-color: #27ae60;
}

/* ============================================================
   RESPONSIVE additions v5.0
   ============================================================ */

@media (max-width: 400px) {
  .tw-card-layout { max-width: 100%; }
  .tw-card-best   { font-size: 18px; }
  .tw-inline-suggestion { font-size: 12px; padding: 5px 10px 5px 7px; }
}
