/* alivePrint AR — Start AR buttons + iframe overlay.
 *
 * Visibility controlled by:
 *   1. body[data-has-ar="1"] gate (set by JS when albumData.ar_items is non-empty)
 *   2. media queries for mobile-only + portrait/landscape split
 * No JS-driven inline display logic — same pattern as `.create-video-bottom-btn`.
 */

.start-ar-btn,
.start-ar-bottom {
  display: none;
}

.start-ar-btn {
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-right: 8px;
  background: linear-gradient(135deg, #6d28d9 0%, #ec4899 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px -1px rgba(124, 58, 237, 0.4);
}

.start-ar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -2px rgba(124, 58, 237, 0.5);
}

.start-ar-btn i { color: #ffffff; }

/* The shared flex container that pins both bottom buttons to the screen.
 * Each child wrapper (.start-ar-bottom / .create-video-bottom) is just a
 * normal-flow item inside this row — no individual position:fixed required. */
.bottom-actions {
  position: fixed;
  bottom: 7vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  pointer-events: none; /* let the camera/album receive taps in empty space */
  max-width: calc(100vw - 16px);
}

.bottom-actions > div {
  pointer-events: auto;
}

.start-ar-bottom {
  display: none; /* default hidden — overridden by media query below */
}

/* Override the legacy .create-video-bottom-btn's own position:fixed so it
 * sits inside .bottom-actions instead of pinning itself to the viewport.
 * Also harmonise its shape/padding with .start-ar-bottom-btn so both
 * buttons read as a matching pair on the same row. */
.bottom-actions .create-video-bottom-btn {
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  border-radius: 999px !important;
  padding: 10px 18px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.bottom-actions .create-video-bottom-btn i {
  margin-right: 8px;
}

.start-ar-bottom-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #6d28d9 0%, #ec4899 100%);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 16px -4px rgba(124, 58, 237, 0.55);
}

.start-ar-bottom-btn i { color: #ffffff; }

/* Visibility rules — only when album has AR items AND on mobile.
 * Mobile = viewport <= 1024px (covers phones in any orientation + small tablets).
 * Header button shows in landscape; floating button shows in portrait. */
@media (max-width: 1024px) and (orientation: landscape) {
  body[data-has-ar="1"] .start-ar-btn { display: inline-flex; }
}

@media (max-width: 1024px) and (orientation: portrait) {
  body[data-has-ar="1"] .start-ar-bottom { display: block; }
}

/* Fullscreen iframe overlay that loads aliveprintweb/index.html */
.ap-ar-frame {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.ap-ar-frame.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.ap-ar-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.ap-ar-frame .ap-ar-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 22px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100001;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ap-ar-frame .ap-ar-close:hover {
  background: rgba(0, 0, 0, 0.75);
}
