/* ==========================================================================
   ZIROVA — Premium Diwali Catalogue Viewer Styles
   ========================================================================== */

:root {
  --bg-teal: #0E2F3A;
  --bg-teal-dark: #071C23;
  --bg-card: rgba(10, 34, 43, 0.85);
  --gold-primary: #C8A660;
  --gold-light: #F2D6A2;
  --gold-dark: #B4924D;
  --gold-border: rgba(198, 162, 96, 0.35);
  --gold-glow: rgba(198, 162, 96, 0.22);
  --text-light: #F5F0E5;
  --text-muted: #C9C4B7;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Jost', system-ui, -apple-system, sans-serif;
  --header-height: 70px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-teal);
  color: var(--text-light);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle background grain & ambient glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle 900px at 50% 15%, rgba(200, 166, 96, 0.08) 0%, transparent 70%),
              radial-gradient(circle 800px at 50% 85%, rgba(14, 47, 58, 0.4) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   Top Navigation Bar (Default State at Top of Page)
   ========================================================================== */
.cat-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 30, 38, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(4, 12, 18, 0.45);
  transition: all 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cat-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 200px;
  transition: all 300ms ease;
}

.cat-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-light);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid rgba(198, 162, 96, 0.3);
  border-radius: 2px;
  background: rgba(14, 47, 58, 0.6);
  transition: all 300ms ease;
}

.cat-back-btn:hover {
  color: #FFFFFF;
  border-color: var(--gold-primary);
  background: rgba(200, 166, 96, 0.18);
  transform: translateX(-2px);
}

.cat-back-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 300ms ease;
}

.cat-back-btn:hover svg {
  transform: translateX(-3px);
}

.cat-brand {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--gold-light);
  text-transform: uppercase;
  transition: all 300ms ease;
}

.cat-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 300ms ease;
}

.cat-title {
  font-family: var(--font-serif);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 400;
  color: #FFFFFF;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.cat-subtitle {
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-top: 2px;
}

.cat-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-end;
  transition: all 300ms ease;
}

/* Control Groups */
.cat-nav-group,
.cat-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Page Navigation / Counter */
.cat-page-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(14, 47, 58, 0.7);
  border: 1px solid rgba(198, 162, 96, 0.25);
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold-light);
}

.cat-page-counter input {
  width: 32px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold-primary);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 11px;
  text-align: center;
  outline: none;
}

/* Control Buttons */
.cat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(14, 47, 58, 0.65);
  border: 1px solid rgba(198, 162, 96, 0.3);
  border-radius: 2px;
  color: var(--gold-light);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all 250ms ease;
  user-select: none;
}

.cat-btn:hover {
  color: #FFFFFF;
  border-color: var(--gold-primary);
  background: rgba(200, 166, 96, 0.16);
  transform: translateY(-1px);
}

.cat-btn:active {
  transform: translateY(0);
}

.cat-btn svg {
  width: 14px;
  height: 14px;
}

.cat-btn.primary {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 55%, var(--gold-dark) 100%);
  color: #0E2F3A;
  font-weight: 600;
  border: none;
  box-shadow: 0 4px 15px rgba(198, 162, 96, 0.3);
}

.cat-btn.primary:hover {
  box-shadow: 0 6px 22px rgba(198, 162, 96, 0.5);
  transform: translateY(-2px);
}

/* ==========================================================================
   SCROLL-ACTIVATED LEFT SIDEBAR MODE
   When scrolling down, all options & buttons dock smoothly on the left!
   ========================================================================== */
@media (min-width: 900px) {
  body.is-scrolled .cat-header {
    position: fixed;
    top: 50%;
    left: 20px;
    right: auto;
    bottom: auto;
    transform: translateY(-50%);
    width: 160px;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
    align-items: center;
    padding: 18px 12px;
    gap: 12px;
    background: rgba(7, 24, 32, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(198, 162, 96, 0.45);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(2, 8, 12, 0.85), 0 0 30px rgba(198, 162, 96, 0.16);
    scrollbar-width: none;
  }
  body.is-scrolled .cat-header::-webkit-scrollbar {
    display: none;
  }

  body.is-scrolled .cat-header-left {
    flex-direction: column;
    min-width: auto;
    width: 100%;
    gap: 8px;
    border-bottom: 1px solid rgba(198, 162, 96, 0.22);
    padding-bottom: 8px;
  }

  body.is-scrolled .cat-brand {
    font-size: 12px;
    letter-spacing: 3.5px;
    text-align: center;
  }

  body.is-scrolled .cat-back-btn {
    width: 100%;
    padding: 7px 8px;
    font-size: 9.5px;
    letter-spacing: 1.5px;
    justify-content: center;
  }

  body.is-scrolled .cat-header-center {
    display: none; /* Hide large title block in compact sidebar */
  }

  body.is-scrolled .cat-header-right {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  body.is-scrolled .cat-nav-group {
    flex-direction: row;
    justify-content: center;
    width: 100%;
    gap: 3px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(198, 162, 96, 0.22);
  }

  body.is-scrolled .cat-nav-group .cat-btn {
    padding: 6px 8px;
  }

  body.is-scrolled .cat-page-counter {
    padding: 5px 6px;
    font-size: 10px;
    gap: 4px;
  }

  body.is-scrolled .cat-page-counter input {
    width: 22px;
    font-size: 10px;
  }

  body.is-scrolled .cat-zoom-group {
    flex-direction: row;
    justify-content: center;
    width: 100%;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(198, 162, 96, 0.22);
  }

  body.is-scrolled .cat-zoom-group .cat-btn {
    padding: 6px 8px;
  }

  body.is-scrolled .cat-header-right > .cat-btn,
  body.is-scrolled .cat-header-right > a.cat-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
    font-size: 10px;
    letter-spacing: 1.5px;
  }

  /* Offset container so page stream stays perfectly centered and clear of sidebar */
  body.is-scrolled .cat-viewer-container {
    padding-left: 200px;
    padding-right: 40px;
  }

  /* Hide floating dock since all controls are now accessible on the left sidebar */
  body.is-scrolled .cat-floating-dock {
    display: none !important;
  }
}

/* ==========================================================================
   Viewer Layout Container
   ========================================================================== */
.cat-viewer-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 162, 96, 0.45) transparent;
  transition: padding 300ms ease;
}

/* Custom scrollbar for horizontal panning when zoomed in */
.cat-viewer-container::-webkit-scrollbar {
  height: 8px;
}
.cat-viewer-container::-webkit-scrollbar-track {
  background: rgba(8, 22, 28, 0.6);
}
.cat-viewer-container::-webkit-scrollbar-thumb {
  background: rgba(198, 162, 96, 0.45);
  border-radius: 4px;
}
.cat-viewer-container::-webkit-scrollbar-thumb:hover {
  background: rgba(198, 162, 96, 0.75);
}

/* ==========================================================================
   Pages Stream (Continuous Page Cards)
   ========================================================================== */
.cat-pages-stream {
  width: 1200px;
  max-width: 100%;
  flex-shrink: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  transition: width 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: top center;
}

.cat-page-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #081C23;
  border: 1px solid rgba(198, 162, 96, 0.28);
  border-radius: 4px;
  box-shadow: 0 14px 42px rgba(3, 10, 16, 0.7), 0 0 25px rgba(198, 162, 96, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.cat-page-card.active-page {
  border-color: rgba(220, 185, 115, 0.65);
  box-shadow: 0 18px 52px rgba(3, 10, 16, 0.8), 0 0 35px rgba(198, 162, 96, 0.15);
}

.cat-page-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-page-num-tag {
  position: absolute;
  bottom: 14px;
  right: 16px;
  padding: 5px 10px;
  background: rgba(10, 30, 38, 0.88);
  border: 1px solid rgba(198, 162, 96, 0.35);
  border-radius: 2px;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: var(--gold-light);
  pointer-events: none;
  z-index: 5;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   FULLSCREEN MODE STYLING
   ========================================================================== */
body.fullscreen-mode {
  overflow-y: scroll !important;
  background-color: #0E2F3A !important;
}

body.fullscreen-mode.is-scrolled .cat-viewer-container {
  padding-left: 200px !important;
  padding-right: 40px !important;
}

/* ==========================================================================
   Floating Controls (Bottom Bar)
   ========================================================================== */
.cat-floating-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 30, 38, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--gold-border);
  border-radius: 30px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 90;
  box-shadow: 0 12px 35px rgba(2, 8, 12, 0.65), 0 0 25px rgba(198, 162, 96, 0.15);
  transition: opacity 300ms ease, transform 300ms ease;
}

.cat-floating-dock .cat-btn {
  border-radius: 20px;
  padding: 6px 14px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --header-height: auto;
  }
  .cat-header {
    flex-wrap: wrap;
    padding: 10px 1rem;
    gap: 10px;
  }
  .cat-header-left, .cat-header-right {
    min-width: auto;
  }
  .cat-header-center {
    order: 3;
    width: 100%;
    margin-top: 4px;
  }
  .cat-viewer-container {
    padding: 1.5rem 0.8rem 4rem;
  }
  .cat-pages-stream {
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .cat-btn span.btn-label {
    display: none;
  }
  .cat-btn {
    padding: 6px 8px;
  }
  .cat-page-counter {
    padding: 4px 6px;
    font-size: 10px;
  }
  .cat-page-counter input {
    width: 24px;
  }
}

/* ==========================================================================
   INTEGRATED SOOTHING MUSIC CONTROLLER (HEADER & SIDEBAR)
   Integrated into toolbar/sidebar so it NEVER covers or overlaps the PDF!
   ========================================================================== */
.zirova-audio-widget {
  display: inline-flex;
  align-items: center;
}

.zirova-audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  background: rgba(14, 47, 58, 0.65);
  border: 1px solid rgba(198, 162, 96, 0.3);
  border-radius: 2px;
  color: var(--gold-light);
  font-family: var(--font-sans, 'Jost', system-ui, sans-serif);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}

.zirova-audio-btn:hover {
  color: #FFFFFF;
  border-color: var(--gold-primary);
  background: rgba(200, 166, 96, 0.16);
  transform: translateY(-1px);
}

.zirova-audio-btn:active {
  transform: translateY(0);
}

.zirova-audio-widget.is-playing .zirova-audio-btn {
  border-color: rgba(198, 162, 96, 0.65);
  color: #FFFFFF;
  background: rgba(14, 47, 58, 0.88);
  box-shadow: 0 0 15px rgba(198, 162, 96, 0.2);
}

.zirova-audio-widget.is-muted .zirova-audio-btn {
  border-color: rgba(198, 162, 96, 0.22);
  color: rgba(242, 214, 162, 0.65);
  background: rgba(10, 30, 38, 0.6);
}

.audio-waves {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.wave-bar {
  width: 2px;
  background: #C8A660;
  border-radius: 1px;
  height: 3px;
  transition: height 250ms ease, opacity 250ms ease;
}

.zirova-audio-widget.is-playing .wave-bar {
  animation: zirovaSoundWave 1.2s ease-in-out infinite alternate;
}

.zirova-audio-widget.is-playing .wave-bar.bar-1 { animation-delay: 0.1s; }
.zirova-audio-widget.is-playing .wave-bar.bar-2 { animation-delay: 0.35s; }
.zirova-audio-widget.is-playing .wave-bar.bar-3 { animation-delay: 0.2s; }
.zirova-audio-widget.is-playing .wave-bar.bar-4 { animation-delay: 0.45s; }

@keyframes zirovaSoundWave {
  0% { height: 2px; opacity: 0.6; }
  50% { height: 12px; opacity: 1; }
  100% { height: 4px; opacity: 0.75; }
}

.zirova-audio-widget.is-muted .wave-bar {
  height: 2px !important;
  animation: none !important;
  opacity: 0.35;
}

.zirova-audio-widget.is-muted .audio-icon-sound { display: none !important; }
.zirova-audio-widget.is-muted .audio-icon-mute { display: inline-block !important; }

.audio-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.audio-icon-wrap svg {
  width: 14px;
  height: 14px;
}

/* Scrolled Sidebar Layout Integration */
body.is-scrolled .cat-header-right .zirova-audio-widget {
  width: 100%;
}

body.is-scrolled .cat-header-right .zirova-audio-btn {
  width: 100%;
  justify-content: center;
  padding: 7px 8px;
}
