/* ===========================
   CONTAINER
   =========================== */

.kkb-app {
  max-width: 820px;
  margin: 3rem auto 4rem;
  padding: 2rem 1.75rem 3rem;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

/* ===========================
   TOOLBAR
   =========================== */

.kkb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid #eee;
}

.kkb-toolbar-left {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: .5rem;
  flex: 1 1 auto;
}

.kkb-toolbar-right {
  flex: 0 0 auto;
}

.kkb-select {
  min-width: 140px;
  border-radius: 999px;
  border: 1px solid #ddd;
  padding: .25rem .75rem;
  background: #fafafa;
  font-size: .9rem;
}

.kkb-icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  padding: .25rem .5rem;
  border-radius: 999px;
}

.kkb-icon-btn:hover {
  background: #f3f3f3;
}

/* ===========================
   HEADING & TEXT
   =========================== */

.kkb-heading {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: .5rem 0 1.2rem;
}

/* Reader text */
.kkb-text {
  font-size: 1.05rem;
  line-height: 1.9;
  color: #222;
}

/* Paragraphs & verses */
.kkb-paragraph {
  margin-bottom: .55rem;
}

/* Verse container – bigger tap area, esp. for mobile */
.kkb-verse {
  position: relative;
  display: inline-block;
  padding: 4px 6px;
  margin: 0 -2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Verse number */
.kkb-verse sup {
  font-size: .65em;
  color: #999;
  margin-right: 3px;
  pointer-events: none; /* taps on number still hit the verse */
}

/* Hover highlight (YouVersion feel) */
.kkb-verse:hover {
  background: #fffbe9;
}

/* Section headings (pericope titles) */
.kkb-section-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.1rem 0 .35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #777;
}

/* Status / loading / errors */
.kkb-status {
  font-size: .9rem;
  color: #777;
  margin-bottom: .75rem;
}

.kkb-status--error {
  color: #b00020;
}

/* ===========================
   DARK THEME
   =========================== */

.kkb-app.kkb-dark {
  background: #111827;
  color: #e5e7eb;
  box-shadow: 0 20px 40px rgba(0,0,0,0.55);
}

/* Toolbar & headings */

.kkb-app.kkb-dark .kkb-toolbar {
  border-bottom-color: #1f2937;
}

.kkb-app.kkb-dark .kkb-heading {
  color: #f9fafb;
}

.kkb-app.kkb-dark .kkb-section-heading {
  color: #9ca3af;
}

/* Text & verses */

.kkb-app.kkb-dark .kkb-text {
  color: #e5e7eb;
}

.kkb-app.kkb-dark .kkb-verse sup {
  color: #9ca3af;
}

/* Verses hover */

.kkb-app.kkb-dark .kkb-verse:hover {
  background: #1f2937;
}

/* Selects */

.kkb-app.kkb-dark .kkb-select {
  background-color: #111827;
  border-color: #374151;
  color: #e5e7eb;
}

.kkb-app.kkb-dark .kkb-select option {
  background-color: #111827;
  color: #e5e7eb;
}

/* Status messages */

.kkb-app.kkb-dark .kkb-status {
  color: #9ca3af;
}

.kkb-app.kkb-dark .kkb-status--error {
  color: #fecaca;
}

/* Icon hover in dark theme */
.kkb-app.kkb-dark .kkb-icon-btn:hover {
  background: #1f2937;
}

/* ===========================
   MOBILE
   =========================== */

@media (max-width: 768px) {
  .kkb-app {
    max-width: 100%;
    margin: 1.5rem auto 3rem;
    padding: 1.5rem 1.1rem 2.5rem;
    border-radius: 0; /* You can change to 16px if you prefer rounded on mobile too */
    box-shadow: none;
  }

  .kkb-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .kkb-toolbar-left {
    width: 100%;
  }

  .kkb-select {
    width: 100%;
  }

  /* Center the theme + search icons on mobile */
  .kkb-toolbar-right {
    align-self: center;
    display: flex;
    justify-content: center;
    gap: 0.4rem;
  }

  .kkb-heading {
    font-size: 1.3rem;
    margin-top: .4rem;
  }

  .kkb-text {
    font-size: 1rem;
    line-height: 1.8;
  }

  /* Bigger tap target on mobile */
  .kkb-verse {
    padding: 6px 8px;
  }
}

/* ===========================
   ICON BUTTON SVG (theme + search)
   =========================== */

.kkb-icon-btn svg {
  stroke-width: 1.8;
  width: 20px;
  height: 20px;
  display: block;
}

/* ===========================
   SELECT OVERRIDES (kill theme arrows)
   =========================== */

.kkb-app .kkb-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  background-image: none !important; /* kill theme arrow background */
  box-shadow: none !important;
  border-radius: 999px;
  border: 1px solid #ddd;
  background-color: #fafafa;
  padding: 0.45rem 2.2rem 0.45rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
}

/* Hide the IE/Edge default arrow, just in case */
.kkb-app .kkb-select::-ms-expand {
  display: none;
}

/* ===========================
   CHAPTER NAVIGATION – CIRCULAR ARROWS
   =========================== */

.kkb-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.6rem;
}

.kkb-nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 1.5rem;
  color: #4b5563;
  cursor: pointer;

  transition:
    background-color 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.05s ease,
    color 0.12s ease;
}

.kkb-nav-btn:hover:not(:disabled) {
  background: #f9fafb;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}

.kkb-nav-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10);
}

.kkb-nav-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

/* Dark mode versions of the nav buttons */

.kkb-app.kkb-dark .kkb-nav-btn {
  background: #111827;
  border-color: #374151;
  color: #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.kkb-app.kkb-dark .kkb-nav-btn:hover:not(:disabled) {
  background: #1f2937;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
}

/* Mobile tweaks for nav – keep up-arrow centered */

@media (max-width: 768px) {
  .kkb-nav {
    margin-top: 1.4rem;
    gap: 1rem;
    justify-content: center;
    flex-wrap: nowrap;          /* make sure buttons stay in one row */
  }

  .kkb-nav-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  /* slightly smaller up-arrow in the middle, still clearly visible */
  .kkb-nav-btn.kkb-nav-top {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

/* ===========================
   SCROLL TO TOP BUTTON
   =========================== */

.kkb-scroll-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 1.3rem;
  color: #4b5563;
  cursor: pointer;

  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);

  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease;

  z-index: 100001; /* above overlay background; below anything crazy */
}

.kkb-scroll-top--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.kkb-scroll-top:hover {
  background: #f9fafb;
  box-shadow: 0 8px 22px rgba(0,0,0,0.16);
}

/* Dark theme version */
.kkb-scroll-top.kkb-scroll-top--dark {
  background: #111827;
  border-color: #374151;
  color: #e5e7eb;
  box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

.kkb-scroll-top.kkb-scroll-top--dark:hover {
  background: #1f2937;
}

/* ===========================
   SEARCH OVERLAY
   =========================== */

.kkb-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;         /* Center vertically */
  justify-content: center;     /* Center horizontally */
  padding-top: 4rem;           /* Push whole modal slightly down */
  box-sizing: border-box;
  z-index: 100000;
}

/* Support both old (.kkb-search-modal) and new (.kkb-search-panel) names */
.kkb-search-panel,
.kkb-search-modal {
  width: min(640px, 90vw);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0,0,0,0.25);
  padding: 1.4rem 1.6rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  font-size: 0.95rem;
}

.kkb-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .15rem;
}

.kkb-search-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.kkb-search-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
}

.kkb-search-close:hover {
  background: rgba(0,0,0,0.05);
}

.kkb-search-form {
  margin-bottom: 0.25rem;
}

.kkb-search-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
}

.kkb-search-input:focus {
  border-color: #960000;
  box-shadow: 0 0 0 1px rgba(150,0,0,0.15);
}

.kkb-search-status {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.2rem;
}

.kkb-search-results {
  overflow-y: auto;
  padding-right: 0.1rem;
}

/* Result cards */

.kkb-search-result {
  width: 100%;
  text-align: left;
  border: none;
  background: #f9fafb;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.05s ease;
}

.kkb-search-result:hover {
  background: #f3f4f6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.kkb-search-ref {
  font-size: 0.86rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.08rem;
}

.kkb-search-snippet {
  font-size: 0.9rem;
  color: #4b5563;
}

/* Dark mode overlay */

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-panel,
.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-modal {
  background: #020617;
  color: #e5e7eb;
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-input {
  background: #020617;
  border-color: #374151;
  color: #e5e7eb;
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-input:focus {
  border-color: #960000;
  box-shadow: 0 0 0 1px rgba(150,0,0,0.35);
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-status {
  color: #9ca3af;
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-result {
  background: #020617;
  border: 1px solid #111827;
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-result:hover {
  background: #020617;
  box-shadow: 0 3px 10px rgba(0,0,0,0.7);
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-ref {
  color: #f9fafb;
}

.kkb-search-overlay.kkb-search-overlay--dark .kkb-search-snippet {
  color: #e5e7eb;
}

/* Mobile search panel tweaks */

@media (max-width: 768px) {
  .kkb-search-panel,
  .kkb-search-modal {
    width: 94vw;
    max-height: 80vh;
    padding: 1.1rem 1.2rem 1.1rem;
  }
}

/* ===========================
   VERSE HIGHLIGHT FROM SEARCH
   =========================== */

.kkb-verse--search-hit {
  background: rgba(255, 153, 51, 0.25);   /* soft orange wash */
  border-radius: 4px;
  padding: 2px 4px;
  box-shadow: inset 0 -2px 0 #FF9933;     /* strong orange underline */
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.kkb-app.kkb-dark .kkb-verse--search-hit {
  background: rgba(255, 153, 51, 0.18);  
  border-radius: 4px;
  padding: 2px 4px;
  box-shadow: inset 0 -2px 0 #FF9933;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

/* ===========================
   MULTI-VERSE SELECTION (ROUNDED PILL)
   =========================== */

.kkb-verse--selected {
  background: rgba(0, 0, 0, 0.08);   /* very soft grey */
  color: inherit;
  padding: 4px 8px;
  border-radius: 10px;              /* half-pill */
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.kkb-app.kkb-dark .kkb-verse--selected {
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  padding: 4px 8px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Floating share / copy pill for selected verse */

.kkb-verse-actions {
  position: absolute;
  z-index: 100001;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  padding: 0.2rem 0.45rem;
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.kkb-verse-action-btn {
  border: none;
  background: transparent;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  color: #374151;
}

.kkb-verse-action-btn:hover {
  background: #f3f4f6;
}

/* Dark mode floating actions */

.kkb-app.kkb-dark .kkb-verse-actions {
  background: #020617;
  color: #e5e7eb;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.kkb-app.kkb-dark .kkb-verse-action-btn {
  color: #e5e7eb;
}

.kkb-app.kkb-dark .kkb-verse-action-btn:hover {
  background: #111827;
}

/* ===========================
   VERSE ACTION BUTTONS (larger, icons, better UX)
   =========================== */

.kkb-verse-actions {
  position: fixed;
  z-index: 100001;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  padding: 0.35rem 0.55rem;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

/* Dark mode container */
.kkb-app.kkb-dark .kkb-verse-actions {
  background: #020617;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
}

/* BUTTONS (ikon + label) */
.kkb-verse-action-btn {
  border: none;
  background: #f1f5f9;
  color: #374151;

  display: flex;
  align-items: center;
  gap: 6px;

  padding: 0.45rem 0.75rem;   /* daha büyük dokunma alanı */
  border-radius: 12px;        /* hafif yuvarlatılmış */
  font-size: 0.85rem;
  font-weight: 500;

  cursor: pointer;
  min-height: 38px;           /* mobil için rahat tap alanı */

  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

/* icons inside buttons */
.kkb-verse-action-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

/* Hover – desktop */
.kkb-verse-action-btn:hover {
  background: #e2e8f0;
}

/* “Copied” success state — green pill (#336666) */
.kkb-verse-action-btn--success {
  background: #336666 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(51,102,102,0.45);
  transform: translateY(-1px);
}

/* DARK MODE */
.kkb-app.kkb-dark .kkb-verse-action-btn {
  background: #1f2937;
  color: #e5e7eb;
}

.kkb-app.kkb-dark .kkb-verse-action-btn:hover {
  background: #374151;
}

.kkb-app.kkb-dark .kkb-verse-action-btn--success {
  background: #336666 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 18px rgba(51,102,102,0.55);
}

/* ===========================
   FONT SIZE CONTROLS (LEGACY - disabled)
   =========================== */

/*
.kkb-font-sm .kkb-text { font-size: 0.98rem; line-height: 1.85; }
.kkb-font-md .kkb-text { font-size: 1.05rem; line-height: 1.9; }
.kkb-font-lg .kkb-text { font-size: 1.18rem; line-height: 1.95; }
.kkb-font-xl .kkb-text { font-size: 1.30rem; line-height: 2.0; }
*/

/* === KBE Font Scaling (scoped) === */
#kkb-app { --kbe-font-scale: 1; }

/* Base: text container */
#kkb-app .kkb-text {
  font-size: 1rem; /* baz değer */
  line-height: 1.55;
}

/* Sadece okunan metinler ölçeklensin */
#kkb-app .kkb-paragraph,
#kkb-app .kkb-verse,
#kkb-app .kkb-section-heading {
  font-size: calc(1em * var(--kbe-font-scale));
  line-height: calc(1.55em * var(--kbe-font-scale));
}

/* Ayet numarası (sup) kontrollü */
#kkb-app .kkb-verse sup {
  font-size: calc(0.8em * var(--kbe-font-scale));
}

/* Readability: ideal line length + spacing */
#kkb-app .kkb-heading,
#kkb-app .kkb-text{
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

#kkb-app .kkb-paragraph{
  margin: 0 0 14px 0;
}
#kkb-app .kkb-section-heading{
  margin: 18px 0 10px 0;
  font-weight: 700;
}

/* Smooth font scaling */
#kkb-app .kkb-paragraph,
#kkb-app .kkb-section-heading,
#kkb-app .kkb-verse{
  transition: font-size 150ms ease, line-height 150ms ease;
}

/* =========================
   Desktop toolbar layout
========================= */

@media (min-width: 1024px){

  /* Sağ blok genel yapı */
  #kkb-app .kkb-toolbar-right{
    display: flex;
    flex-direction: column;
    align-items: center;   /* YATAY ORTALA */
    justify-content: center;
    gap: 10px;
    min-width: 90px;       /* Sağ alanı dengeler */
  }

  /* Üst sıra (dark + search) */
  #kkb-app .kkb-main-controls{
    display: flex;
    justify-content: center;   /* ORTALA */
    align-items: center;
    gap: 14px;
    width: 100%;
  }

  /* Alt sıra (font controls) */
  #kkb-app .kkb-font-controls{
    display: flex;
    justify-content: center;   /* ORTALA */
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  /* Butonların görsel dengesi */
  #kkb-app .kkb-icon-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
  }

}

#kkb-app svg{
  display:inline-block;
  vertical-align: middle;
}
#kkb-app .kkb-nav-btn{
  color:#111;
}
#kkb-app.kkb-dark .kkb-nav-btn{
  color:#fff;
}

/* =========================
   Search highlight fade-out
========================= */

#kkb-app .kkb-verse--search-hit{
  transition: background-color .45s ease, box-shadow .45s ease, outline-color .45s ease;
}

#kkb-app .kkb-verse--search-fade{
  background-color: transparent !important;
  box-shadow: none !important;
  outline-color: transparent !important;
}

/* TOOLBAR ICONLARI – NAV BUTONLARINA DOKUNMA */

/* Sadece üstteki toolbar’daki ikon butonlarını hafif toparla */
.kkb-toolbar .kkb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Toolbar içindeki SVG ikon boyutlarını eşitle */
.kkb-toolbar .kkb-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Tema + Arama + A-/A/A+ aynı satırda kalsın */
.kkb-main-controls,
.kkb-font-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}