/* ==========================================================
   Xitô WebApp — xito-webapp.css  v1.4.1
   ========================================================== */

/* ── Wrapper tổng thể ──────────────────────────────────── */
.xito-webapp {
  max-width: 42rem;
  margin: 0 auto;
  color: #1f1a14;
  text-align: left;
  /* Header đỏ fixed (~100px desktop) không che nút / bài đọc. */
  padding-top: 100px;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .xito-webapp {
    padding-top: 80px;
  }
}

@media (min-width: 992px) {
  .xito-webapp {
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 100px 20px 0;
  }
}

/* Nút quay về Giờ Kinh (nằm trong toolbar) */
.xito-back-current {
  margin: 0;
  text-align: left;
}
.xito-back-current__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  background: #b3121f;
  color: #fff !important;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}
.xito-back-current__btn:hover,
.xito-back-current__btn:focus {
  background: #8e0e18;
  color: #fff !important;
}

/* Kế thừa font/size từ plugin mẹ (Giờ Kinh Phụng Vụ). */
#xito-reading-content {
  font-family: inherit !important;
  font-size: inherit !important;
}

/* ══════════════════════════════════════════════════════════
   THANH ĐIỀU HƯỚNG (NAV TOOLBAR)
   3 khối: KINH HIỆN TẠI | ‹ ngày › | HÔM NAY
   ══════════════════════════════════════════════════════════ */
.xito-nav-toolbar {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 35px 0 20px;
  margin-top: 35px !important;
  position: relative;
}

.xito-date-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

@media (max-width: 768px) {
  .xito-nav-toolbar {
    flex-direction: column;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 35px !important;
  }
  .xito-nav-toolbar .xito-back-current__btn,
  .xito-nav-toolbar .xito-nav-today {
    width: fit-content !important;
    margin: 0 auto !important;
    padding: 10px 20px !important;
    justify-content: center;
  }
  .xito-date-controls {
    width: 100%;
  }
  .xito-nav-datepicker {
    flex: 1 1 auto;
  }
}

/* Nút gốc dùng chung cho Prev / Next */
.xito-nav-prev,
.xito-nav-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(31, 26, 20, 0.2);
  border-radius: 50%;
  background: #fffdf8;
  color: #1f1a14;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  padding: 0;
  flex-shrink: 0;
}
.xito-nav-prev:hover,
.xito-nav-next:hover {
  background: #f0ebe0;
  border-color: #b3121f;
  color: #b3121f;
}
.xito-nav-prev:disabled,
.xito-nav-next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.xito-nav-datepicker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 40;
}

.xito-nav-datepicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid #b3121f;
  border-radius: 8px;
  background: #fff8f6;
  color: #b3121f;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, box-shadow 160ms ease;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.xito-nav-datepicker:hover {
  background: #ffeaea;
  box-shadow: 0 0 0 3px rgba(179, 18, 31, 0.15);
}
.xito-nav-datepicker svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: #b3121f;
}
.xito-nav-datepicker__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nút HÔM NAY (nền đỏ thẫm, chữ trắng) */
.xito-nav-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: #b3121f;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, transform 80ms ease;
  flex-shrink: 0;
}
.xito-nav-today:hover { background: #8e0e18; }
.xito-nav-today:active { transform: scale(0.97); }
.xito-nav-today svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
  flex-shrink: 0;
}

/* Input ẩn — neo điểm Flatpickr bung popup */
.xito-datepicker-anchor {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  overflow: hidden;
}
.xito-nav-toolbar,
.xito-webapp {
  overflow: visible !important;
}
.xito-nav-datepicker-wrap .flatpickr-calendar {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  z-index: 80 !important;
}

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */
.xito-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.15rem;
  justify-content: center;
}
.xito-tabs__btn {
  min-height: 44px;
  padding: 0.45rem 0.95rem;
  border: 1px solid rgba(47, 92, 70, 0.28);
  border-radius: 8px;
  background: transparent;
  color: #2f5c46;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.xito-tabs__btn.is-active,
.xito-tabs__btn.active,
.xito-tabs__btn[aria-selected="true"] {
  background: #386150;
  border-color: #386150;
  color: #fff;
}
.xito-tab-panel.is-hidden,
.xito-tab-panel[hidden] { display: none; }

/* ══════════════════════════════════════════════════════════
   HEADER THÔNG TIN (bên trong #xito-reading-content)
   ══════════════════════════════════════════════════════════ */
.xito-content-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(31, 26, 20, 0.12);
  text-align: center;
}

.xito-content-header__date {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: #1f1a14;
  text-align: center;
}

.xito-content-header__season {
  margin: 0.38rem 0 0;
  color: #6b6358;
  font-size: 0.97rem;
  text-align: center;
}

.xito-content-header__year {
  margin: 0.3rem 0 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: #2f5c46;
  text-align: center;
}

/* Dòng bậc lễ — màu mặc định */
.xito-content-header__rank {
  margin: 0.4rem 0 0;
  font-weight: 700;
  font-size: 0.97rem;
  color: #2f5c46;
  text-align: center;
}

/* Màu phụng vụ cho dòng bậc lễ */
.xito-content-header__rank.xito-rank--red    { color: #b3121f; }
.xito-content-header__rank.xito-rank--green  { color: #2f7d44; }
.xito-content-header__rank.xito-rank--violet { color: #5c3d82; }
.xito-content-header__rank.xito-rank--rose   { color: #8a3d56; }
.xito-content-header__rank.xito-rank--white  { color: #6b6358; }
.xito-content-header__rank.xito-rank--black  { color: #2a2a2a; }

/* ══════════════════════════════════════════════════════════
   KHU VỰC CONTENT
   ══════════════════════════════════════════════════════════ */
.xito-webapp__content {
  min-height: 8rem;
  transition: opacity 180ms ease;
}
.xito-webapp__content.is-loading { opacity: 0.55; }

.xito-webapp__loading,
.xito-webapp__empty {
  color: #6b6358;
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════
   FLATPICKR POPUP OVERRIDES
   ══════════════════════════════════════════════════════════ */

/* Ngày đang chọn → nền đỏ trơn, chữ trắng, bo tròn */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: #b3121f !important;
  border-color: #b3121f !important;
  color: #fff !important;
  border-radius: 50% !important;
  font-weight: 700;
  box-shadow: none !important;
}

/* Hiệu ứng hover nhẹ cho ngày bình thường */
.flatpickr-day:hover:not(.selected):not(.flatpickr-disabled):not(.xito-day-off) {
  background: rgba(179, 18, 31, 0.08);
  border-color: rgba(179, 18, 31, 0.25);
}

/* Ô ngày cần có flexbox để dot/lock nằm dưới số */
.flatpickr-day {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  height: 2.8rem !important;
  line-height: 1.2 !important;
  position: relative;
  overflow: visible;
}

/* Chấm màu phụng vụ */
.xito-day-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin: 2px auto 0;
  flex-shrink: 0;
}

/* Icon ổ khóa cho ngày bị tắt */
.xito-day-lock {
  display: block;
  width: 10px;
  height: 10px;
  margin: 2px auto 0;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Ngày không có bài đọc: xám, không click */
.flatpickr-day.xito-day-off,
.flatpickr-day.flatpickr-disabled {
  color: #9a9186 !important;
  background: #efeae1 !important;
  opacity: 1 !important;
  cursor: default !important;
  pointer-events: none !important;
  text-decoration: none !important;
}
.flatpickr-day.xito-day-off:hover,
.flatpickr-day.flatpickr-disabled:hover {
  background: #efeae1 !important;
  border-color: transparent !important;
}
.flatpickr-day.flatpickr-disabled .xito-day-dot,
.flatpickr-day.xito-day-off .xito-day-dot {
  display: none !important;
}

/* Tháng hiện tại header */
.flatpickr-current-month {
  font-weight: 700;
  font-size: 1rem;
}

/* ══════════════════════════════════════════════════════════
   NHUỘM MÀU PHỤNG VỤ cho ô ngày (tùy chọn khi không bị off)
   ══════════════════════════════════════════════════════════
   Chỉ dot thể hiện màu — ô ngày giữ nền trắng. */

/* ══════════════════════════════════════════════════════════
   NỘI DUNG BÀI ĐỌC
   ══════════════════════════════════════════════════════════ */
.xito-reading {
  color: #1f1a14;
  text-align: justify;
  text-justify: inter-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.xito-reading .mslot { margin: 0 0 1.5em; }

/* Tiêu đề + câu trích dẫn cùng một hàng — không xếp dọc từng chữ */
.xito-reading-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  margin-top: 15px;
  margin-bottom: 10px;
  gap: 15px;
  border-bottom: none;
  flex-wrap: nowrap !important;
  min-width: 0;
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: none !important;
}

.xito-rh-title {
  color: #ff0000 !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  text-align: left;
  word-break: normal !important;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  flex-grow: 0;
  hyphens: none !important;
}

.xito-rh-citation {
  color: #ff0000 !important;
  font-style: italic !important;
  text-align: right;
  font-weight: normal !important;
  text-transform: none !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  flex-shrink: 1 !important;
  min-width: 0;
  hyphens: none !important;
}

.xito-or {
  text-align: center;
  color: #8a8178;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 1.1em 0 0.85em;
}

/* Đáp ca trình bày như thơ */
.mslot--psalm .leading,
.mslot--psalm .mslot__body p.leading,
#xito-reading-content .mslot--psalm .leading,
#xito-reading-content .mslot--psalm .mslot__body p {
  text-align: left !important;
  hyphens: none;
}
.mslot--psalm .leading br,
.mslot--psalm .mslot__body br {
  display: block;
  content: "";
}

.xito-reading .mslot__label {
  font-size: 1.05em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  color: #2f5c46;
}

.xito-reading .refrow,
.xito-reading .refrow__text,
.xito-reading .refrow__sep {
  margin: 0.2em 0 0;
  font-style: italic;
  color: #ff0000;
}

.xito-reading .mslot__incipit {
  font-style: italic;
  color: #6b6358;
  margin: 0 0 0.5em;
}

.xito-reading .mslot__lead {
  font-weight: 600;
  margin: 0 0 0.7em;
}

.xito-reading .holycross {
  color: #ff0000;
  font-weight: 700;
  font-style: normal;
  margin-right: 0.4em;
}

.xito-reading .mslot--gospel .mslot__lead:not(:has(.holycross)):before {
  content: "+";
  color: #ff0000;
  font-weight: 700;
  margin-right: 0.4em;
}

.xito-reading .mslot__body p,
.xito-reading .leading,
.xito-reading .poem {
  margin: 0 0 0.75em;
  line-height: 1.8;
  text-align: justify !important;
  text-justify: inter-word;
  hyphens: auto;
  word-break: break-word;
}

/* Màu đỏ chung cho tất cả chỉ số / câu KT */
.xito-reading .chap,
.xito-reading .verse-start sup,
.xito-reading sup,
.xito-reading .firstIndex,
.xito-reading .leading sup,
.xito-reading .poem sup {
  color: #ff0000;
}

/* Chỉ .chap và .firstIndex mới cần in đậm (số chương, chỉ số đặc biệt) */
.xito-reading .chap,
.xito-reading .firstIndex {
  font-weight: 700;
}

.xito-reading .verse-start { color: inherit; font-weight: 400; }

.xito-reading .mass-refrain {
  display: flex;
  align-items: flex-start;
  gap: 0.55em;
  margin: 0.85em 0;
}

.xito-reading .mass-refrain-marker {
  flex: 0 0 auto;
  display: inline-block;
  font-weight: 700;
  font-style: normal;
  color: #fff;
  background: #ff0000;
  padding: 0.05em 0.38em 0.08em;
  line-height: 1.35;
}

.xito-reading .mass-refrain-marker + span,
.xito-reading .mass-refrain > span:not(.mass-refrain-marker) {
  font-style: italic;
  color: #ff0000;
  font-weight: 400;
}

.xito-reading__source,
.xito-reading__source em {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════
   SỐ CÂU KINH THÁNH (VERSE NUMBERS) — RESET CHỐNG THEME
   ══════════════════════════════════════════════════════════
   Vấn đề: Theme WordPress tự ép <sup> thành bold + font-size lớn.
   Giải pháp: Reset hoàn toàn bằng position+top thay vì vertical-align:super
   (kỹ thuật này nhất quán hơn giữa các trình duyệt và theme).
   Scope: #xito-reading-content đảm bảo specificity cao hơn mọi rule theme.
   ══════════════════════════════════════════════════════════ */

/* Reset chính — áp dụng cho mọi <sup> và class số câu kpv.vn */
#xito-reading-content sup,
#xito-reading-content .verse-start sup,
#xito-reading-content .leading sup,
#xito-reading-content .poem sup,
#xito-reading-content .verse-number,
#xito-reading-content .v-num {
  font-weight: 400 !important;
  font-size: 75% !important;
  line-height: 0 !important;
  position: relative !important;
  vertical-align: baseline !important;
  top: -0.4em !important;
  font-family: inherit !important;
}

/* Trung hòa <b>/<strong> kpv.vn bên trong <sup> (tránh nhân đôi thu nhỏ) */
#xito-reading-content sup b,
#xito-reading-content sup strong,
#xito-reading-content .verse-number b,
#xito-reading-content .verse-number strong,
#xito-reading-content .v-num b,
#xito-reading-content .v-num strong {
  font-weight: 400 !important;
  font-size: inherit !important;
  font-family: inherit !important;
}
