/* ===== GĩkũyũLive custom styles (on top of Bootstrap 5) ===== */

:root {
  --app-bg: #10141a;
  --app-topbar-h: 52px;
  --app-bottomnav-h: 64px;
  --mic-dock-h: 168px;
  --caption-en-size: 1.25rem;
  --caption-ki-size: 0.85rem;
}

[data-bs-theme="dark"] body { background: var(--app-bg); }

html, body {
  height: 100%;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* ----- Layout ----- */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--app-topbar-h);
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bs-border-color);
  z-index: 1030;
  padding-top: env(safe-area-inset-top);
}

.brand-mark { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.2px; }

.app-main {
  padding-top: var(--app-topbar-h);
  padding-bottom: var(--app-bottomnav-h);
  min-height: 100%;
}

.app-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--app-bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--bs-border-color);
  z-index: 1030;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--bs-secondary-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.7rem;
}
.nav-btn i { font-size: 1.3rem; }
.nav-btn.active { color: var(--bs-success); }

/* ----- Status indicators ----- */
.net-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bs-danger);
}
.net-dot.online { background: var(--bs-success); }

.install-banner {
  position: fixed;
  top: var(--app-topbar-h);
  left: 0; right: 0;
  z-index: 1029;
  background: var(--bs-tertiary-bg);
  border-bottom: 1px solid var(--bs-border-color);
}

/* ----- Live view / caption feed ----- */
#view-live {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--app-topbar-h) - var(--app-bottomnav-h));
}
#view-live.d-none { display: none !important; }

.caption-feed {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem calc(var(--mic-dock-h) + 1rem);
  scroll-behavior: smooth;
}

.feed-empty {
  position: absolute;
  inset: 35% 1rem auto;
  pointer-events: none;
}
.feed-empty.hidden { display: none; }

.caption-card {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
  animation: card-in 0.25s ease-out;
  cursor: pointer;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.caption-kikuyu {
  font-size: var(--caption-ki-size);
  color: var(--bs-secondary-color);
  margin-bottom: 0.15rem;
}
.caption-english {
  font-size: var(--caption-en-size);
  font-weight: 600;
  line-height: 1.35;
}
.caption-meta {
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  margin-top: 0.3rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.caption-card.is-proverb .caption-english::before {
  content: "Proverb · ";
  color: var(--bs-warning);
  font-size: 0.75rem;
  font-weight: 700;
  display: block;
}
.caption-card.error-card { border-color: var(--bs-danger); }
.caption-card.refined { border-color: var(--bs-info); }

/* Text-size modes */
body.textsize-large  { --caption-en-size: 1.6rem;  --caption-ki-size: 1rem; }
body.textsize-xl     { --caption-en-size: 2.1rem;  --caption-ki-size: 1.15rem; }

/* Shimmer placeholder */
.caption-card.shimmer .shimmer-line {
  height: 1.1rem;
  border-radius: 6px;
  margin: 0.35rem 0;
  background: linear-gradient(90deg,
    var(--bs-secondary-bg) 25%,
    var(--bs-tertiary-bg) 50%,
    var(--bs-secondary-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.caption-card.shimmer .shimmer-line.short { width: 55%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.scroll-live-btn {
  position: fixed;
  bottom: calc(var(--app-bottomnav-h) + var(--mic-dock-h) + 8px);
  right: 14px;
  z-index: 1020;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* ----- Mic dock ----- */
.mic-dock {
  position: fixed;
  bottom: var(--app-bottomnav-h);
  left: 0; right: 0;
  height: var(--mic-dock-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 0.75rem;
  pointer-events: none;
  background: linear-gradient(to top, var(--bs-body-bg) 55%, transparent);
  z-index: 1010;
}
.mic-dock > * { pointer-events: auto; }

.mic-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--bs-success);
  color: #fff;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(25, 135, 84, 0.45);
  transition: background 0.2s, transform 0.1s;
}
.mic-btn:active { transform: scale(0.95); }

.mic-btn.listening {
  background: var(--bs-danger);
  box-shadow: 0 4px 18px rgba(220, 53, 69, 0.5);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.55); }
  70%  { box-shadow: 0 0 0 22px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* ----- VU meter ----- */
.vu-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  margin-bottom: 0.6rem;
  opacity: 0;
  transition: opacity 0.25s;
}
.vu-meter.active { opacity: 1; }
.vu-meter span {
  width: 5px;
  height: 4px;
  border-radius: 2px;
  background: var(--bs-success);
  transition: height 0.09s linear;
}

/* ----- History ----- */
.history-list .list-group-item { cursor: pointer; }
.history-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ----- Session detail ----- */
.segment-row { padding: 0.6rem 0; border-bottom: 1px solid var(--bs-border-color); }
.segment-row .seg-kikuyu { font-size: 0.85rem; color: var(--bs-secondary-color); }
.segment-row .seg-english { font-weight: 600; }
.segment-row .seg-notes { font-size: 0.78rem; color: var(--bs-info); }

/* ----- Refine sheet ----- */
.refine-sheet { --bs-offcanvas-height: auto; max-height: 80dvh; border-radius: 16px 16px 0 0; }
.refine-kikuyu { font-style: italic; }
.refine-english { font-weight: 600; font-size: 1.1rem; }

/* ----- Misc ----- */
#local-segments .local-seg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--bs-border-color);
  font-size: 0.8rem;
}
#local-segments audio { height: 30px; max-width: 180px; }
