/* ================================================================
   DAV STRAINS WORKROOM — strip-player.css  v4.3
   Spotify-style compact mini player strip above bottom nav
   ================================================================ */

/* ── Strip player variables ── */
:root {
  --strip-h: 68px;
  --strip-h-mobile: 64px;
}

/* ── Strip wrapper ── */
.dav-strip {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 9995;
  background: rgba(10, 18, 32, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.32s cubic-bezier(.22,1,.36,1), opacity 0.28s ease;
  will-change: transform;
  /* Desktop: sits just above bottom desktop nav */
  bottom: calc(var(--dav-bottom-menu, 92px) + 1px);
}

/* Mobile: sits above bottom-nav */
@media (max-width: 720px) {
  .dav-strip {
    bottom: calc(var(--dav-bottom-menu, 60px) + 1px);
  }
}

/* Hidden state — slides down into nav bar */
.dav-strip.strip-hidden {
  transform: translateY(calc(100% + 2px));
  opacity: 0;
  pointer-events: none;
}

/* Show only when a track is loaded */
.dav-strip.strip-inactive {
  transform: translateY(calc(100% + 2px));
  opacity: 0;
  pointer-events: none;
}

/* ── Progress rail (thin stripe at very top of strip) ── */
.strip-progress-rail {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.strip-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue, #66c7ff), var(--gold, #f0c46c));
  transition: width 0.5s linear;
  border-radius: 99px;
}

/* ── Inner layout ── */
.strip-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  height: var(--strip-h-mobile);
}

@media (min-width: 721px) {
  .strip-inner {
    max-width: 860px;
    margin: 0 auto;
    height: var(--strip-h);
    padding: 10px 20px;
    gap: 16px;
  }
}

/* ── Cover art ── */
.strip-art {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}

.strip-art svg { width: 28px; height: 28px; }

.strip-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* ── Track meta ── */
.strip-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.strip-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Marquee animation for long titles */
.strip-title.marquee {
  animation: strip-marquee 12s linear infinite;
  white-space: nowrap;
  overflow: visible;
}
@keyframes strip-marquee {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(0); }
  70%  { transform: translateX(-60%); }
  100% { transform: translateX(0); }
}

.strip-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* ── Controls ── */
.strip-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.strip-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.strip-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.strip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.strip-btn:active { transform: scale(0.92); }

.strip-play {
  width: 44px;
  height: 44px;
  background: #fff;
  color: #071524;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.strip-play:hover {
  background: #fff;
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(0,0,0,.38);
}

.strip-play svg { width: 20px; height: 20px; }

/* ── Now-playing indicator: 3 animated bars ── */
.strip-playing-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}
.dav-strip.is-playing .strip-playing-bars { display: flex; }
.strip-playing-bars span {
  width: 3px;
  border-radius: 2px;
  background: var(--blue, #66c7ff);
  animation: strip-bar-bounce 1.1s ease-in-out infinite;
}
.strip-playing-bars span:nth-child(1) { height: 10px; animation-delay: 0s; }
.strip-playing-bars span:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.strip-playing-bars span:nth-child(3) { height: 7px;  animation-delay: 0.4s; }
@keyframes strip-bar-bounce {
  0%, 100% { transform: scaleY(0.5); }
  50%       { transform: scaleY(1); }
}

/* ── Body padding adjustment — account for strip height ── */
body {
  /* On mobile: bottom nav + strip + safe area */
  padding-bottom: calc(var(--dav-bottom-menu, 60px) + var(--strip-h-mobile) + env(safe-area-inset-bottom, 0px)) !important;
}

@media (min-width: 721px) {
  body {
    padding-bottom: calc(var(--dav-bottom-menu, 92px) + var(--strip-h) + 4px) !important;
    padding-top: 0 !important;
  }
}

/* ── FAB adjusted to sit above strip ── */
#davFAB {
  bottom: calc(var(--dav-bottom-menu, 60px) + var(--strip-h-mobile) + 14px) !important;
}

@media (min-width: 721px) {
  #davFAB {
    bottom: calc(var(--dav-bottom-menu, 92px) + var(--strip-h) + 18px) !important;
  }
}

/* ── Desktop: strip above desktop header (which is at bottom) ── */
@media (min-width: 721px) {
  .dav-strip {
    /* Desktop nav (.app-header) is at bottom:14px, height ~72px */
    bottom: calc(14px + 72px + 4px);
  }
}

/* ════════════════════════════════════════════════════════════
   LOGIN MODAL
   ════════════════════════════════════════════════════════════ */
.dav-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10010;
  background: rgba(3, 8, 18, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.dav-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.dav-modal {
  background: rgba(9, 18, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 32px 28px;
  width: min(440px, 100%);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.55);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(.22,1,.36,1);
  position: relative;
}

.dav-modal-overlay.open .dav-modal {
  transform: translateY(0) scale(1);
}

.dav-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: 0.18s;
}

.dav-modal-close:hover { background: rgba(255,255,255,.14); color: #fff; }

.dav-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.dav-modal-header img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.dav-modal-header strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.dav-modal-header small {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.dav-login-form { display: flex; flex-direction: column; gap: 16px; }

.dav-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dav-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.dav-form-field input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 13px 16px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s;
}

.dav-form-field input:focus {
  border-color: var(--blue, #66c7ff);
  background: rgba(255, 255, 255, 0.09);
}

.dav-pass-wrap { position: relative; }
.dav-pass-wrap input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.dav-pass-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.dav-pass-toggle:hover { opacity: 1; }

.dav-form-error {
  font-size: 13px;
  color: #ff6b6b;
  min-height: 18px;
  line-height: 1.4;
}

.dav-login-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.dav-login-links a,
.dav-link-btn {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.dav-link-btn strong { color: var(--gold, #f0c46c); }
.dav-login-links a:hover, .dav-link-btn:hover { color: #fff; }

/* Loading state for login button */
.dav-login-submit.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   BOTTOM NAV ACCOUNT DROPDOWN
   ════════════════════════════════════════════════════════════ */
.bottom-nav-account {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bottom-nav-account-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.bottom-nav-account-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav-account-btn.active { color: var(--blue, #66c7ff); }

.account-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(9, 18, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  transform: translateY(8px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(.22,1,.36,1), opacity 0.2s ease;
  backdrop-filter: blur(20px);
  z-index: 9999;
}

.account-dropdown.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.account-dropdown a,
.account-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.account-dropdown svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: 0.65;
}

/* WhatsApp item in dropdown */
.account-dropdown a[href*="wa.me"] svg { fill: #25d366; stroke: none; }

/* ════════════════════════════════════════════════════════════
   BOOKS TILE GRID
   ════════════════════════════════════════════════════════════ */
.books-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

@media (max-width: 640px) {
  .books-tile-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.book-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.book-tile:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.book-tile-art {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(102,199,255,.2), rgba(240,196,108,.2));
}

.book-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-tile-type {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(10, 18, 32, 0.78);
  color: var(--gold, #f0c46c);
  border: 1px solid rgba(240, 196, 108, 0.32);
  backdrop-filter: blur(6px);
}

.book-tile-type.type-novel    { color: var(--gold, #f0c46c); border-color: rgba(240,196,108,.32); }
.book-tile-type.type-story    { color: var(--blue, #66c7ff); border-color: rgba(102,199,255,.32); }
.book-tile-type.type-free     { color: #7bc67b; border-color: rgba(123,198,123,.32); }

.book-tile-info {
  padding: 12px 12px 14px;
}

.book-tile-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-tile-author {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* ── Updated toast position (fix old calc bug) ── */
#davPreviewToast {
  bottom: calc(var(--dav-bottom-menu, 60px) + var(--strip-h-mobile) + 14px) !important;
  top: auto !important;
  transform: translateX(-50%) translateY(16px);
}
#davPreviewToast.show {
  transform: translateX(-50%) translateY(0);
}
