/* Chapter reader in-content header (story cover, actions). */

.chapter-reader-topbar {
  align-items: center;
  background-color: var(--chapter-surface);
  border-bottom: 1px solid var(--chapter-border-soft);
  display: flex;
  height: 66px;
  padding: 0 24px;
}

.chapter-reader-topbar__inner {
  align-items: center;
  display: flex;
  gap: 16px;
  width: 100%;
}

.chapter-reader-topbar__story {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

.chapter-reader-topbar__cover {
  border-radius: 4px;
  height: 45px;
  object-fit: cover;
  width: 45px;
}

.chapter-reader-topbar__titles {
  align-items: baseline;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.chapter-reader-topbar__story-title {
  color: var(--chapter-text);
  font-family: var(--Heading-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 700;
  max-width: 320px;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-reader-topbar__story-title:hover {
  color: var(--chapter-brand-strong);
}

.chapter-reader-topbar__chapter-title {
  color: var(--chapter-text);
  font-family: var(--Heading-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-reader-topbar__actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.chapter-reader-topbar__tip-icon {
  color: inherit;
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}

.chapter-reader-topbar__tip-icon svg {
  display: block;
  height: 20px;
  width: 20px;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn--tip.btn-tunwalai-outline:disabled {
  background-color: transparent !important;
  border-color: var(--Icon-Brand-disabled, #ffc4b6) !important;
  color: var(--Icon-Brand-disabled, #ffc4b6) !important;
  cursor: not-allowed;
  opacity: 1;
  pointer-events: auto;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn--tip.btn-tunwalai-outline:disabled:hover,
.chapter-reader-topbar__actions .chapter-reader-topbar__btn--tip.btn-tunwalai-outline:disabled:focus {
  background-color: transparent !important;
  border-color: var(--Icon-Brand-disabled, #ffc4b6) !important;
  color: var(--Icon-Brand-disabled, #ffc4b6) !important;
}

/* Override global site.css .btn-tunwalai (!important) — Figma Chapter Head tokens */
.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai,
.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai-outline {
  align-items: center;
  border-radius: var(--twl-radius-full, 999px);
  box-shadow: none !important;
  display: inline-flex;
  font-family: var(--Action-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 700;
  gap: 8px;
  height: 40px;
  justify-content: center;
  line-height: 1;
  padding: 10px 24px;
  white-space: nowrap;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai {
  background-color: var(--Background-Brand-default, #ff775f) !important;
  border: 1px solid var(--Border-Brand-default, #ff775f) !important;
  color: var(--Text-Static-white, #ffffff) !important;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai:hover,
.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai:focus {
  background-color: var(--Background-Brand-hover, #e85d45) !important;
  border-color: var(--Border-Brand-hover, #e85d45) !important;
  color: var(--Text-Static-white, #ffffff) !important;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai-outline {
  background-color: transparent !important;
  border: 1px solid var(--Border-Brand-default, #ff775f) !important;
  color: var(--Text-Brand-default, #e85d45) !important;
}

.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai-outline:hover,
.chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai-outline:focus {
  background-color: var(--chapter-surface-muted) !important;
  border-color: var(--Border-Brand-default, #ff775f) !important;
  color: var(--Text-Brand-default, #e85d45) !important;
}

/* เมนูแชร์/รายงาน — เปิดจากไอคอน three dots เท่านั้น (ไม่มีลูกศร dropdown) */
.chapter-reader-topbar__overflow {
  flex-shrink: 0;
  position: relative;
}

.chapter-reader-topbar__menu-btn {
  align-items: center;
  background: transparent;
  border: none;
  color: var(--chapter-text);
  cursor: pointer;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  line-height: 0;
  padding: 0;
  width: 40px;
}

.chapter-reader-topbar__menu-btn .icon-tunwalai-line-kebab {
  font-size: 24px;
  font-weight: 600;
}

.chapter-reader-topbar__menu-btn:hover,
.chapter-reader-topbar__menu-btn:focus-visible {
  color: var(--chapter-brand-strong);
  outline: none;
}

.chapter-reader-topbar__menu {
  background-color: var(--chapter-surface);
  border: 1px solid var(--chapter-border-soft);
  border-radius: 8px;
  box-shadow: var(--twl-elevation-sm, 0 4px 20px rgba(7, 7, 8, 0.1));
  min-width: 160px;
  padding: 8px;
}

.chapter-reader-topbar__menu-item {
  align-items: center;
  border-radius: 6px;
  color: var(--chapter-text) !important;
  display: flex;
  font-family: var(--Action-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 500;
  gap: 12px;
  padding: 10px 12px;
}

.chapter-reader-topbar__menu-item:hover,
.chapter-reader-topbar__menu-item:focus {
  background-color: var(--chapter-surface-muted);
  color: var(--chapter-text) !important;
}

.chapter-reader-topbar__menu-item .icon-tunwalai-line-share,
.chapter-reader-topbar__menu-item .icon-tunwalai-line-report {
  flex-shrink: 0;
  font-size: 20px;
  width: 20px;
}

@media (max-width: 767px) {
  .chapter-reader-topbar {
    height: auto;
    min-height: 66px;
    padding: 10px 16px;
  }

  .chapter-reader-topbar__inner {
    gap: 12px;
  }

  .chapter-reader-topbar__actions {
    gap: 8px;
  }

  .chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai,
  .chapter-reader-topbar__actions .chapter-reader-topbar__btn.btn-tunwalai-outline {
    padding: 10px 16px;
  }
}

@media (max-width: 575px) {
  .chapter-reader-topbar__chapter-title {
    display: none;
  }

  .chapter-reader-topbar__story-title {
    max-width: 180px;
  }
}
