/* ==========================================================================
   Trang Giờ Mặt Trời Mọc & Lặn (.ttn-sun) — chỉ nạp trên template-sun-times.php
   ========================================================================== */

.ttn-sun {
  --sun-ink: #0f172a;
  --sun-muted: #64748b;
  --sun-line: #e2e8f0;
  --sun-surface: #ffffff;
  --sun-soft: #f8fafc;
  --sun-rise: #c2410c;
  --sun-rise-soft: #fff7ed;
  --sun-set: #4338ca;
  --sun-set-soft: #eef2ff;
  --sun-gold: #d97706;
  --sun-now: #e11d48;
  padding-bottom: 40px;
  color: var(--sun-ink);
}

.ttn-sun__card,
.ttn-sun__answer {
  background: var(--sun-surface);
  border: 1px solid var(--sun-line);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 18px;
}

/* ---------- Trả lời ngay ---------- */
.ttn-sun__answer {
  border-top: 4px solid var(--sun-rise);
}
.ttn-sun__answer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ttn-sun__date {
  font-size: 14px;
  font-weight: 600;
  color: var(--sun-muted);
}
.ttn-sun__picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ttn-sun__select select {
  height: 38px;
  min-width: 170px;
  margin: 0;
  padding: 0 32px 0 12px;
  border: 1px solid var(--sun-line);
  border-radius: 10px;
  background-color: var(--sun-soft);
  font-size: 14px;
  font-weight: 600;
  color: var(--sun-ink);
}
.ttn-sun__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--sun-line);
  border-radius: 10px;
  background: var(--sun-surface);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--sun-ink);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.ttn-sun__btn:hover {
  border-color: var(--sun-rise);
  color: var(--sun-rise);
}
.ttn-sun__btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.ttn-sun__answer h1 {
  margin: 0 0 20px;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 800;
  color: var(--sun-ink);
}
.ttn-sun__answer h1 span {
  color: var(--sun-rise);
}

.ttn-sun__big {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1fr;
  gap: 12px;
}
.ttn-sun__big-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--sun-soft);
}
.ttn-sun__big-item.is-rise { background: var(--sun-rise-soft); }
.ttn-sun__big-item.is-set { background: var(--sun-set-soft); }
.ttn-sun__big-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--sun-muted);
}
.ttn-sun__big-item strong {
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.ttn-sun__big-item.is-rise strong { color: var(--sun-rise); }
.ttn-sun__big-item.is-set strong { color: var(--sun-set); }
.ttn-sun__big-item.is-len strong {
  font-size: 22px;
  line-height: 1.3;
  margin-top: 6px;
}
.ttn-sun__big-item small {
  font-size: 13px;
  color: var(--sun-muted);
}

.ttn-sun__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--sun-muted);
}
.ttn-sun__status-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sun-set);
}
.ttn-sun__status-dot.is-day { background: var(--sun-gold); }

/* ---------- Tiêu đề khối ---------- */
.ttn-sun__head {
  margin-bottom: 18px;
}
.ttn-sun__head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--sun-ink);
}
.ttn-sun__head p {
  margin: 0;
  font-size: 14px;
  color: var(--sun-muted);
}
.ttn-sun__head p strong { color: var(--sun-ink); }
.ttn-sun__head--search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}
.ttn-sun__head--search > div { flex: 1 1 320px; }

/* ---------- Dải 24h ---------- */
.ttn-sun__ribbon-wrap {
  position: relative;
  padding: 30px 0 24px;
}
.ttn-sun__ribbon-marks {
  position: absolute;
  inset: 0 0 auto;
  height: 26px;
}
.ttn-sun__mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 12px;
  white-space: nowrap;
  color: var(--sun-muted);
}
.ttn-sun__mark b { color: var(--sun-ink); }
.ttn-sun__mark.is-rise b { color: var(--sun-rise); }
.ttn-sun__mark.is-set b { color: var(--sun-set); }
.ttn-sun__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  height: 10px;
  border-left: 1px dashed currentColor;
}
.ttn-sun__ribbon {
  position: relative;
  height: 44px;
  border-radius: 10px;
  background: #141b3a;
}
.ttn-sun__ribbon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 24 - 1px), rgba(255, 255, 255, .25) calc(100% / 24 - 1px), rgba(255, 255, 255, .25) calc(100% / 24));
  pointer-events: none;
}
.ttn-sun__ribbon.is-allday { background: #9fd8f5; }
.ttn-sun__now {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--sun-now);
  z-index: 1;
}
.ttn-sun__now i {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--sun-now);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.ttn-sun__ticks {
  position: relative;
  height: 16px;
  margin-top: 8px;
}
.ttn-sun__ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--sun-muted);
}
.ttn-sun__ticks span:first-child { transform: none; }
.ttn-sun__ticks span:last-child { transform: translateX(-100%); }

.ttn-sun__moments {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}
.ttn-sun__moments > div {
  padding: 12px 14px;
  border: 1px solid var(--sun-line);
  border-radius: 12px;
}
.ttn-sun__moments dt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sun-muted);
}
.ttn-sun__moments dt i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.ttn-sun__moments i.is-dawn { background: #f08a5d; }
.ttn-sun__moments i.is-blue { background: #3b5bdb; }
.ttn-sun__moments i.is-gold { background: #fcd34d; }
.ttn-sun__moments i.is-dusk { background: #1e2a5a; }
.ttn-sun__moments dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Bảng 7 ngày ---------- */
.ttn-sun__table-wrap { overflow-x: auto; }
.ttn-sun__table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.ttn-sun__table th,
.ttn-sun__table td {
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--sun-line);
  text-align: left;
  white-space: nowrap;
}
.ttn-sun__table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sun-muted);
}
.ttn-sun__table tbody th {
  font-weight: 700;
}
.ttn-sun__table tbody th span {
  margin-left: 4px;
  font-weight: 500;
  color: var(--sun-muted);
}
.ttn-sun__table td.is-rise { font-weight: 700; color: var(--sun-rise); }
.ttn-sun__table td.is-set { font-weight: 700; color: var(--sun-set); }
.ttn-sun__table td small {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
}
.ttn-sun__table small.is-up { color: #15803d; }
.ttn-sun__table small.is-down { color: var(--sun-muted); }
.ttn-sun__table tr.is-today { background: var(--sun-rise-soft); }
.ttn-sun__table tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Xếp hạng tỉnh ---------- */
.ttn-sun__search {
  position: relative;
  flex: 0 1 260px;
  margin: 0;
}
.ttn-sun__search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--sun-muted);
  stroke-width: 2;
}
.ttn-sun__search input {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 12px 0 36px;
  border: 1px solid var(--sun-line);
  border-radius: 10px;
  box-shadow: none;
  font-size: 14px;
}
.ttn-sun__rank-legend {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1.1fr) 1.6fr 64px 64px;
  gap: 12px;
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sun-muted);
}
.ttn-sun__rank-legend > span {
  grid-column: 3;
  display: flex;
  justify-content: space-between;
}
.ttn-sun__rank {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ttn-sun__rank-row { margin: 0; }
.ttn-sun__rank-row a {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1.1fr) 1.6fr 64px 64px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sun-ink);
  text-decoration: none;
}
.ttn-sun__rank-row a:hover { background: var(--sun-soft); }
.ttn-sun__rank-row.is-current a { background: var(--sun-rise-soft); }
.ttn-sun__rank-no {
  font-size: 13px;
  font-weight: 700;
  color: var(--sun-muted);
  font-variant-numeric: tabular-nums;
}
.ttn-sun__rank-name {
  font-weight: 600;
}
.ttn-sun__rank-name small {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sun-rise);
}
.ttn-sun__rank-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #fed7aa, #e2e8f0);
}
.ttn-sun__rank-track i {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--sun-rise);
  box-shadow: 0 0 0 1px rgba(194, 65, 12, .35);
  transform: translateY(-50%);
}
.ttn-sun__rank-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ttn-sun__rank-time.is-rise { color: var(--sun-rise); }
.ttn-sun__rank-time.is-set { color: var(--sun-set); }

.ttn-sun__rank .is-extra { display: none; }
.ttn-sun__rank.is-expanded .is-extra,
.ttn-sun__rank.is-searching .is-extra { display: block; }
.ttn-sun__rank .is-hidden { display: none !important; }

.ttn-sun__more {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 11px;
  border: 1px dashed var(--sun-line);
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sun-ink);
  cursor: pointer;
}
.ttn-sun__more:hover { border-color: var(--sun-rise); color: var(--sun-rise); }
.ttn-sun__more[hidden] { display: none; }
.ttn-sun__empty {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--sun-muted);
}

/* ---------- Quốc gia phổ biến ---------- */
.ttn-sun__places {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.ttn-sun__place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--sun-line);
  border-radius: 10px;
  font-weight: 600;
  color: var(--sun-ink);
  text-decoration: none;
}
.ttn-sun__place:hover { border-color: var(--sun-rise); }
.ttn-sun__place.is-current { background: var(--sun-rise-soft); border-color: #fed7aa; }
.ttn-sun__place-times {
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.ttn-sun__place-times .is-rise { color: var(--sun-rise); }
.ttn-sun__place-times .is-set { color: var(--sun-set); }

/* ---------- Bài viết ---------- */
.ttn-sun__article h2 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 800;
  color: var(--sun-ink);
}
.ttn-sun__article p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.7;
  color: #334155;
}
.ttn-sun__article p:last-child { margin-bottom: 0; }
.ttn-sun__intl-link a {
  font-weight: 700;
  color: var(--sun-rise);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .ttn-sun__moments { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .ttn-sun__card,
  .ttn-sun__answer { padding: 18px 16px; border-radius: 14px; }
  .ttn-sun__answer-top { flex-direction: column; align-items: stretch; }
  .ttn-sun__picker { width: 100%; }
  .ttn-sun__select { flex: 1 1 100%; }
  .ttn-sun__select select { width: 100%; }
  .ttn-sun__picker .ttn-sun__btn { flex: 1 1 0; justify-content: center; }
  .ttn-sun__answer h1 { font-size: 21px; }
  .ttn-sun__big { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ttn-sun__big-item { padding: 12px 14px; }
  .ttn-sun__big-item strong { font-size: 34px; }
  .ttn-sun__big-item.is-len { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
  .ttn-sun__big-item.is-len strong { font-size: 18px; margin-top: 0; }
  .ttn-sun__head h2 { font-size: 18px; }
  .ttn-sun__mark { font-size: 11px; }
  .ttn-sun__ribbon { height: 36px; }
  .ttn-sun__ticks span:nth-child(even) { display: none; }
  .ttn-sun__moments { grid-template-columns: 1fr 1fr; }
  .ttn-sun__moments > div:last-child { grid-column: 1 / -1; }
  .ttn-sun__table { font-size: 14px; }
  .ttn-sun__table th,
  .ttn-sun__table td { padding: 10px 6px; }
  .ttn-sun__table .is-opt { display: none; }
  .ttn-sun__table td small { display: block; margin: 2px 0 0; }
  .ttn-sun__search { flex-basis: 100%; }
  .ttn-sun__rank-legend { display: none; }
  .ttn-sun__rank-row a {
    grid-template-columns: 24px 1fr 52px 52px;
    gap: 8px;
    padding: 10px 8px;
  }
  .ttn-sun__rank-track { display: none; }
}
