/* ============================================
   TABLET TOP BAR — GoodNotes-Style Navigation
   ============================================
   
   A clean, minimal top bar for tablet devices (768–1366px).
   
   Layout:
   ┌──────────────────────────────────────────────────────────┐
   │  [Home] [Studies] [Fathers]  │  [Book ▼ | KJV]  ◂ Ch ▸  │  [Notes] [Reader] [AI]  │
   └──────────────────────────────────────────────────────────┘
   
   LHS: Navigation tile buttons
   Center: Book/Translation pill + Chapter nav
   RHS: Mode toggle buttons
*/

/* ---- CONTAINER ---- */

.tablet-top-bar {
  display: none; /* Hidden by default, shown via tablet-optimization.css */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 10000;
  
  /* Light mode — match desktop top navbar */
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  
  /* Layout */
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  
  /* Smooth appearance */
  transition: opacity 0.2s ease, transform 0.2s ease;
  
  /* Font */
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

/* Dark mode — dark bar */
body.dark-mode .tablet-top-bar,
[data-theme="dark"] .tablet-top-bar {
  background: rgba(18, 18, 18, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ---- LEFT SECTION: Navigation Tabs ---- */

.tablet-top-bar__left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tablet-nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.55);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tablet-nav-tab:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-nav-tab:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.97);
}

.tablet-nav-tab.active {
  background: rgba(120, 118, 240, 0.12);
  color: #6c63ff;
}

/* Dark mode nav tabs */
body.dark-mode .tablet-nav-tab,
[data-theme="dark"] .tablet-nav-tab {
  color: rgba(255, 255, 255, 0.65);
}
body.dark-mode .tablet-nav-tab:hover,
[data-theme="dark"] .tablet-nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}
body.dark-mode .tablet-nav-tab.active,
[data-theme="dark"] .tablet-nav-tab.active {
  background: rgba(120, 118, 240, 0.25);
  color: #a5a3ff;
}

.tablet-nav-tab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Nav tabs: icon-only (no text labels) */
.tablet-nav-tab span {
  display: none;
}

.tablet-nav-tab {
  padding: 7px 10px;
}

/* ---- DIVIDER (vertical line between groups) ---- */

.tablet-top-bar__divider {
  width: 1px;
  height: 24px;
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  margin: 0 4px;
}

body.dark-mode .tablet-top-bar__divider,
[data-theme="dark"] .tablet-top-bar__divider {
  background: rgba(255, 255, 255, 0.15);
}

/* ---- DISPLAY BUTTONS (column layout, Aa) ---- */

.tablet-display-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tablet-display-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-display-btn:active {
  transform: scale(0.95);
}

.tablet-display-btn.active {
  background: rgba(120, 118, 240, 0.12);
  color: #6c63ff;
}

/* Dark mode display buttons */
body.dark-mode .tablet-display-btn,
[data-theme="dark"] .tablet-display-btn {
  color: rgba(255, 255, 255, 0.5);
}
body.dark-mode .tablet-display-btn:hover,
[data-theme="dark"] .tablet-display-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}
body.dark-mode .tablet-display-btn.active,
[data-theme="dark"] .tablet-display-btn.active {
  background: rgba(120, 118, 240, 0.25);
  color: #a5a3ff;
}

.tablet-display-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Aa button text styling */
.tablet-aa-btn {
  width: auto;
  padding: 0 10px;
}

.tablet-aa-label {
  font-size: 15px;
  font-weight: 700;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: -0.5px;
}

/* ---- DOUBLE COLUMN = WIDER LAYOUT ---- */
/* Moved to tablet-optimization.css for higher specificity */

/* ---- Aa FLOATING TOOLBAR ---- */

.tablet-text-toolbar {
  position: fixed;
  z-index: 10002;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 6px rgba(0,0,0,0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  animation: tabletToolbarFadeIn 0.15s ease;
}

body.dark-mode .tablet-text-toolbar,
[data-theme="dark"] .tablet-text-toolbar {
  background: #2c2c2e;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.1);
}

@keyframes tabletToolbarFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Toolbar divider */
.tablet-text-toolbar__divider {
  width: 1px;
  height: 22px;
  background: rgba(0, 0, 0, 0.12);
  margin: 0 4px;
  flex-shrink: 0;
}

body.dark-mode .tablet-text-toolbar__divider,
[data-theme="dark"] .tablet-text-toolbar__divider {
  background: rgba(255,255,255,0.15);
}

/* Size stepper group */
.tablet-text-toolbar__size {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
}

body.dark-mode .tablet-text-toolbar__size,
[data-theme="dark"] .tablet-text-toolbar__size {
  background: rgba(255,255,255,0.08);
}

.tablet-text-toolbar__size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.6);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}

.tablet-text-toolbar__size-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.9);
}

.tablet-text-toolbar__size-btn:active {
  background: rgba(0, 0, 0, 0.12);
}

body.dark-mode .tablet-text-toolbar__size-btn,
[data-theme="dark"] .tablet-text-toolbar__size-btn {
  color: rgba(255,255,255,0.7);
}

body.dark-mode .tablet-text-toolbar__size-btn:hover,
[data-theme="dark"] .tablet-text-toolbar__size-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.tablet-text-toolbar__size-value {
  min-width: 28px;
  text-align: center;
  color: rgba(0, 0, 0, 0.85);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

body.dark-mode .tablet-text-toolbar__size-value,
[data-theme="dark"] .tablet-text-toolbar__size-value {
  color: #fff;
}

/* Font family dropdown button */
.tablet-text-toolbar__font-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.85);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tablet-text-toolbar__font-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .tablet-text-toolbar__font-btn,
[data-theme="dark"] .tablet-text-toolbar__font-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

body.dark-mode .tablet-text-toolbar__font-btn:hover,
[data-theme="dark"] .tablet-text-toolbar__font-btn:hover {
  background: rgba(255,255,255,0.14);
}

.tablet-text-toolbar__font-btn svg {
  width: 10px;
  height: 10px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* Bold / Weight toggle button */
.tablet-text-toolbar__weight-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.5);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  font-family: Georgia, serif;
}

.tablet-text-toolbar__weight-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tablet-text-toolbar__weight-btn.active {
  background: rgba(120,118,240,0.12);
  color: #6c63ff;
}

body.dark-mode .tablet-text-toolbar__weight-btn,
[data-theme="dark"] .tablet-text-toolbar__weight-btn {
  color: rgba(255,255,255,0.6);
}

body.dark-mode .tablet-text-toolbar__weight-btn:hover,
[data-theme="dark"] .tablet-text-toolbar__weight-btn:hover {
  background: rgba(255,255,255,0.1);
}

body.dark-mode .tablet-text-toolbar__weight-btn.active,
[data-theme="dark"] .tablet-text-toolbar__weight-btn.active {
  background: rgba(120,118,240,0.3);
  color: #c4c3ff;
}

/* Font dropdown panel */
.tablet-font-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 6px rgba(0,0,0,0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10003;
}

body.dark-mode .tablet-font-dropdown,
[data-theme="dark"] .tablet-font-dropdown {
  background: #2c2c2e;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.1);
}

.tablet-font-dropdown.open {
  display: flex;
}

.tablet-font-dropdown__item {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(0, 0, 0, 0.8);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  white-space: nowrap;
}

.tablet-font-dropdown__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tablet-font-dropdown__item.active {
  background: rgba(120,118,240,0.12);
  color: #6c63ff;
}

body.dark-mode .tablet-font-dropdown__item,
[data-theme="dark"] .tablet-font-dropdown__item {
  color: rgba(255,255,255,0.8);
}

body.dark-mode .tablet-font-dropdown__item:hover,
[data-theme="dark"] .tablet-font-dropdown__item:hover {
  background: rgba(255,255,255,0.1);
}

body.dark-mode .tablet-font-dropdown__item.active,
[data-theme="dark"] .tablet-font-dropdown__item.active {
  background: rgba(120,118,240,0.25);
  color: #c4c3ff;
}

.tablet-font-dropdown::-webkit-scrollbar {
  width: 4px;
}

.tablet-font-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

body.dark-mode .tablet-font-dropdown::-webkit-scrollbar-thumb,
[data-theme="dark"] .tablet-font-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}

/* (Dark mode tabs already handled above) */

/* ---- CENTER SECTION: Arrows flanking Book/Translation Pill ---- */

.tablet-top-bar__center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

/* Book + Translation Pill */
.tablet-book-pill {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  overflow: hidden;
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode .tablet-book-pill,
[data-theme="dark"] .tablet-book-pill {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.tablet-book-btn,
.tablet-translation-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tablet-book-btn:hover,
.tablet-translation-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.tablet-book-btn:active,
.tablet-translation-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .tablet-book-btn,
body.dark-mode .tablet-translation-btn,
[data-theme="dark"] .tablet-book-btn,
[data-theme="dark"] .tablet-translation-btn {
  color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .tablet-book-btn:hover,
body.dark-mode .tablet-translation-btn:hover,
[data-theme="dark"] .tablet-book-btn:hover,
[data-theme="dark"] .tablet-translation-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tablet-pill-divider {
  width: 1px;
  height: 20px;
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

body.dark-mode .tablet-pill-divider,
[data-theme="dark"] .tablet-pill-divider {
  background: rgba(255, 255, 255, 0.2);
}

.tablet-book-btn .dropdown-arrow {
  width: 10px;
  height: 10px;
  opacity: 0.5;
}

.tablet-translation-code {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Chapter number inside the pill (e.g. "Genesis 10") */
.tablet-book-chapter-num {
  font-weight: 700;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

body.dark-mode .tablet-book-chapter-num,
[data-theme="dark"] .tablet-book-chapter-num {
  color: rgba(255, 255, 255, 0.75);
}

/* Chapter Navigation — arrows now flank the pill directly in center */
.tablet-chapter-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tablet-chapter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tablet-chapter-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-chapter-btn:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
}

body.dark-mode .tablet-chapter-btn,
[data-theme="dark"] .tablet-chapter-btn {
  color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .tablet-chapter-btn:hover,
[data-theme="dark"] .tablet-chapter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.tablet-chapter-btn svg {
  width: 16px;
  height: 16px;
}

.tablet-chapter-current {
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.8);
  min-width: 24px;
  text-align: center;
  padding: 0 4px;
}

body.dark-mode .tablet-chapter-current,
[data-theme="dark"] .tablet-chapter-current {
  color: rgba(255, 255, 255, 0.9);
}

/* ---- RIGHT SECTION: Mode Buttons ---- */

.tablet-top-bar__right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tablet-mode-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.45);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tablet-mode-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-mode-btn:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.97);
}

.tablet-mode-btn.active {
  background: rgba(120, 118, 240, 0.12);
  color: #6c63ff;
}

.tablet-mode-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Dark mode mode buttons */
body.dark-mode .tablet-mode-btn,
[data-theme="dark"] .tablet-mode-btn {
  color: rgba(255, 255, 255, 0.55);
}

body.dark-mode .tablet-mode-btn:hover,
[data-theme="dark"] .tablet-mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

body.dark-mode .tablet-mode-btn.active,
[data-theme="dark"] .tablet-mode-btn.active {
  background: rgba(120, 118, 240, 0.3);
  color: #c4c3ff;
}

/* Mode label — hide on narrower tablets */
.tablet-mode-label {
  display: inline;
}

/* ---- THEME TOGGLE BUTTON ---- */

.tablet-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tablet-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-theme-toggle:active {
  transform: scale(0.95);
}

body.dark-mode .tablet-theme-toggle,
[data-theme="dark"] .tablet-theme-toggle {
  color: rgba(255, 255, 255, 0.65);
}

body.dark-mode .tablet-theme-toggle:hover,
[data-theme="dark"] .tablet-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.tablet-theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ---- ACTION BUTTONS (moved from floating FABs) ---- */

.tablet-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tablet-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}

.tablet-action-btn:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
}

body.dark-mode .tablet-action-btn,
[data-theme="dark"] .tablet-action-btn {
  color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .tablet-action-btn:hover,
[data-theme="dark"] .tablet-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

.tablet-action-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .tablet-mode-label {
    display: none;
  }
  
  .tablet-mode-btn {
    padding: 7px 10px;
  }
}

/* ---- LANDSCAPE ADJUSTMENT ---- */
@media (max-height: 500px) and (min-width: 768px) {
  .tablet-top-bar {
    height: 44px;
  }
  
  .tablet-nav-tab {
    padding: 5px 8px;
    font-size: 12px;
  }
  
  .tablet-book-pill {
    height: 30px;
  }
  
  .tablet-book-btn,
  .tablet-translation-btn {
    padding: 0 10px;
    font-size: 13px;
  }
}
