/* ════════════════════════════════════════
   LAZOS — Catálogo Viewer
   Aesthetic: Luxury lookbook / editorial jewelry
   ════════════════════════════════════════ */

:root {
  --bg: #fdf2f6;
  --bg-warm: #f9e4ec;
  --bg-toolbar: rgba(253, 245, 248, 0.92);
  --bg-control: rgba(180, 60, 100, 0.06);
  --bg-control-hover: rgba(180, 60, 100, 0.12);
  --border: rgba(180, 60, 100, 0.1);
  --border-hairline: rgba(180, 60, 100, 0.06);
  --text: #3d1f2e;
  --text-secondary: #8a5a6e;
  --text-tertiary: #b8899c;
  --accent: #c96b8b;
  --accent-light: #e8a0b8;
  --accent-dim: rgba(201, 107, 139, 0.12);
  --whatsapp: #25D366;
  --whatsapp-hover: #1ebe5a;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-pill: 999px;
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-page:
    0 1px 3px rgba(100, 30, 60, 0.04),
    0 4px 16px rgba(100, 30, 60, 0.06),
    0 0 0 0.5px rgba(180, 60, 100, 0.04);
  --shadow-toolbar: 0 1px 0 var(--border-hairline), 0 2px 12px rgba(100, 30, 60, 0.06);
  --shadow-float: 0 4px 20px rgba(100, 30, 60, 0.12), 0 1px 4px rgba(100, 30, 60, 0.06);
  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* Visibility helpers */
.mobile-only { display: none; }
.desktop-only { display: flex; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ════════════════════════════════════════
   VIEWER
   ════════════════════════════════════════ */

.viewer {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ─── Top Toolbar ─── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 16px;
  background: var(--bg-toolbar);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--shadow-toolbar);
  gap: 8px;
  user-select: none;
  flex-shrink: 0;
  overflow: visible;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-left { flex: 1; min-width: 0; overflow: visible; }
.toolbar-center { flex: 0 0 auto; }
.toolbar-right { flex: 1; justify-content: flex-end; min-width: 0; }

/* ─── Brand ─── */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
  z-index: 10;
  align-self: stretch;
}

.brand-logo {
  height: 62px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.04));
}

/* ─── Toolbar buttons ─── */
.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.toolbar-btn:hover {
  background: var(--bg-control-hover);
  color: var(--text);
}

.toolbar-btn:active { transform: scale(0.94); }

.toolbar-zoom-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-control);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  height: 28px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}

.toolbar-zoom-label:hover {
  background: var(--bg-control-hover);
  color: var(--text);
}

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

.toolbar-page-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.page-input {
  width: 36px;
  background: var(--bg-control);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 4px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -moz-appearance: textfield;
}

.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.page-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.page-sep { color: var(--text-tertiary); }

/* ─── Progress bar ─── */
.progress-bar {
  height: 2px;
  background: var(--bg-warm);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.progress-bar.done { opacity: 0; transition: opacity 800ms 400ms; }

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e8a0b8);
  transition: width 200ms ease-out;
  border-radius: 0 1px 1px 0;
}

/* ─── Pages Container ─── */
.pages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 100px;
  gap: 10px;
  background: var(--bg);
}

/* ─── Page wrapper ─── */
.page-wrapper {
  position: relative;
  background: #fff;
  border-radius: 2px;
  box-shadow: var(--shadow-page);
  overflow: hidden;
  transition: box-shadow 300ms ease;
  flex-shrink: 0;
}

.page-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── Skeleton / placeholder ─── */
.page-skeleton {
  position: absolute;
  inset: 0;
  background: #fdf0f4;
  transition: opacity 300ms ease;
}

.page-skeleton.rendered { opacity: 0; pointer-events: none; }

/* ════════════════════════════════════════
   MOBILE ACTION STRIP
   ════════════════════════════════════════ */

.mobile-action-strip {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  display: none;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(253, 242, 246, 0.85);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 -1px 0 var(--border-hairline);
}

.action-strip-secondary {
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.action-strip-secondary:active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.action-strip-primary {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--whatsapp);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
  transition: background var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background-image: linear-gradient(
    110deg,
    var(--whatsapp) 0%,
    var(--whatsapp) 40%,
    rgba(255,255,255,0.15) 50%,
    var(--whatsapp) 60%,
    var(--whatsapp) 100%
  );
  background-size: 200% 100%;
  animation: whatsappShine 3s ease-in-out 2s infinite;
}

.action-strip-primary:active {
  background-color: var(--whatsapp-hover);
  transform: scale(0.98);
}

/* ─── Floating CTA group (desktop) ─── */
.floating-cta {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.social-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.social-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 4px rgba(100, 30, 60, 0.06);
}

.social-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-float);
}

/* ─── WhatsApp CTA ─── */
.whatsapp-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--whatsapp);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 14px 22px 14px 18px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-float), 0 0 0 0 rgba(37, 211, 102, 0.3);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  background-image: linear-gradient(
    110deg,
    var(--whatsapp) 0%,
    var(--whatsapp) 40%,
    rgba(255,255,255,0.2) 50%,
    var(--whatsapp) 60%,
    var(--whatsapp) 100%
  );
  background-size: 200% 100%;
  animation:
    whatsappEntrance 600ms cubic-bezier(.34, 1.56, .64, 1) 1s both,
    whatsappPulse 2.5s ease-in-out 2.5s infinite,
    whatsappShine 3s ease-in-out 3s infinite;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.whatsapp-btn:hover {
  background: var(--whatsapp-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-float), 0 8px 24px rgba(37, 211, 102, 0.25);
}

.whatsapp-btn:active {
  transform: translateY(0) scale(0.97);
}

.whatsapp-icon { flex-shrink: 0; }

@keyframes whatsappEntrance {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes whatsappPulse {
  0%, 100% { box-shadow: var(--shadow-float), 0 0 0 0 rgba(37, 211, 102, 0.4); }
  50% { box-shadow: var(--shadow-float), 0 0 0 12px rgba(37, 211, 102, 0); }
}

@keyframes whatsappShine {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ─── iOS-style notification badge ─── */
.notif-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ff3b30;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(255, 59, 48, 0.4);
  pointer-events: none;
  animation: badgePop 400ms cubic-bezier(.3, 1.6, .55, 1) both;
}

@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Scroll to top ─── */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), background var(--transition), color var(--transition);
  z-index: 90;
  box-shadow: var(--shadow-float);
}

.scroll-top-btn:not(.hidden) {
  animation: fadeInUp 250ms ease-out;
}

.scroll-top-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Loading overlay ─── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 20px;
}

.loading-logo {
  height: 120px;
  width: auto;
  object-fit: contain;
  animation: loadingFadeIn 500ms ease-out;
}

.loading-overlay .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.loading-overlay .loading-text {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

@keyframes loadingFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════
   MOBILE (<=640px)
   ════════════════════════════════════════ */

@media (max-width: 640px) {
  .mobile-only { display: flex; }
  .mobile-action-strip { display: flex; }
  .desktop-only { display: none !important; }

  /* Slimmer top toolbar on mobile — just logo + page */
  .toolbar {
    padding: 0 12px;
    height: 60px;
  }

  .brand-logo { height: 52px; }

  .toolbar-sep { display: none; }

  /* Bigger page input for fat fingers */
  .page-input {
    width: 40px;
    height: 34px;
    font-size: 0.85rem;
    padding: 4px 6px;
  }

  .toolbar-page-indicator {
    font-size: 0.85rem;
  }

  /* Pages fill the screen width */
  .pages-container {
    padding: 8px 2px 120px 2px;
    gap: 4px;
  }

}

@media (max-width: 400px) {
  .brand-logo { height: 46px; }
}
