:root {
  --bg-dark: #0f1419;
  --bg-radial: #1c2630;
  --surface-glass: rgba(20, 27, 35, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --gold-accent: #d4af37;
  --gold-hover: #e6c655;
  --teal-accent: #00665e;
  --text-light: #f4f6f8;
  --text-muted: #9ba5b0;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at center, var(--bg-radial) 0%, var(--bg-dark) 100%);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

/* Header */
.topbar {
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-pill {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.contact-pill:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-accent);
  color: #fff;
}

.admin-pill {
  background: rgba(212, 175, 55, 0.14);
  border-color: rgba(212, 175, 55, 0.45);
  color: var(--gold-hover);
  font-weight: 600;
}

.brochure-selector {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.brochure-selector option {
  background: #182028;
  color: #fff;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.82);
  backdrop-filter: blur(8px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-light);
}

/* Main Stage */
.stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 56px;
  overflow: hidden;
}

.book-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.book-viewport.zoomed {
  transform: scale(1.38);
  cursor: grab;
}

.book-viewport.zoomed:active {
  cursor: grabbing;
}

.flipbook {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.page {
  background-color: #ffffff;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.06);
}

.page.--left {
  border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.page.--right {
  border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.page-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  position: relative;
}

/* Subtle spine crease shading */
.page.--left .page-content::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.page.--right .page-content::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 100%;
  background: linear-gradient(to left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.page-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Floating Side Navigation Arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--surface-glass);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.nav-arrow:hover:not(:disabled) {
  background: var(--gold-accent);
  color: #111;
  border-color: var(--gold-accent);
  transform: translateY(-50%) scale(1.06);
}

.nav-arrow:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.nav-arrow-left {
  left: 14px;
}

.nav-arrow-right {
  right: 14px;
}

/* Bottom Toolbar */
.toolbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 20;
  flex-shrink: 0;
  padding: 0 12px;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
  font-size: 0.86rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ctrl-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.ctrl-btn-primary {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.45);
}

.ctrl-btn-primary:hover:not(:disabled) {
  background: var(--gold-accent);
  color: #111;
  border-color: var(--gold-accent);
}

.ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-indicator {
  min-width: 86px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.page-divider {
  color: var(--text-muted);
  margin: 0 3px;
}

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .topbar {
    height: 48px;
    padding: 0 12px;
  }

  .brand-title {
    font-size: 0.82rem;
  }

  .phone-pill {
    display: none;
  }

  .stage {
    padding: 8px 10px;
  }

  .nav-arrow {
    width: 38px;
    height: 38px;
  }

  .nav-arrow-left {
    left: 6px;
  }

  .nav-arrow-right {
    right: 6px;
  }

  .ctrl-btn span {
    display: none;
  }
}
