/* Styles for Craft Druk Photo-Certs (Festive Theme) */

/* Global Mobile Fix: Strictly lock horizontal movement, prevent swipe/zoom/wobble */
html, body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  touch-action: pan-y !important; /* Only vertical scrolling allowed, no horizontal pan */
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Strict background lock when modal is open */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
}

/* Modal Master Scroller & Mobile Momentum Scrolling */
#modalOrderCert {
  position: fixed !important;
  inset: 0 !important;
  z-index: 50 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: scroll-position;
}

#modalOrderCertWrapper {
  min-height: 100% !important;
  width: 100% !important;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
}

#modalOrderCertCard {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
}

body {
  position: relative;
  background-color: #1a1512;
  color: #1e293b;
  min-height: 100vh;
  transition: background-color 0.4s ease;
}

/* Background Themes */
body.theme-festive-green {
  background-color: #83A510 !important;
}
body.theme-festive-green #siteBgImage {
  display: none !important;
}
body.theme-festive-green #bgFestiveBlobs {
  display: block !important;
}
body.theme-festive-green header {
  background-color: rgba(131, 165, 16, 0.88) !important;
  border-bottom-color: rgba(255, 255, 255, 0.25) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

body.theme-photo-table,
body.theme-custom {
  background-color: #1a1512 !important;
}
body.theme-photo-table #siteBgImage,
body.theme-custom #siteBgImage {
  display: block !important;
}
body.theme-photo-table #bgFestiveBlobs,
body.theme-custom #bgFestiveBlobs {
  display: none !important;
}
body.theme-photo-table header,
body.theme-custom header {
  background-color: rgba(15, 23, 42, 0.88) !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

/* Rock-solid, jitter-free background layers for mobile devices */
#siteBgImage {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100lvh !important;
  min-height: 100vh !important;
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
}

#bgFestiveBlobs {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  pointer-events: none !important;
  overflow: hidden !important;
  z-index: 0 !important;
  contain: paint layout !important;
}

/* ========================================================
   FROSTED GLASS WINDOWS ("Скляні матові віконця")
   ======================================================== */
.glass-window {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.90) 0%, rgba(255, 255, 255, 0.80) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 
    0 20px 45px -12px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset,
    0 2px 4px 0 rgba(255, 255, 255, 0.9) inset !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.glass-window:hover {
  box-shadow: 
    0 24px 50px -10px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 2px 4px 0 rgba(255, 255, 255, 0.95) inset !important;
}

/* Frosted Sub-panels for Metrics, Insets & Option Cards */
.glass-panel {
  background: rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

.glass-input {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.85) !important;
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: #83A510 !important;
  box-shadow: 0 0 0 3px rgba(131, 165, 16, 0.25) !important;
}

/* Master wrapper strictly clipping sideways overflow on iOS Safari */
.mobile-lock-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  position: relative !important;
}

/* Strict mobile side alignment lock: exact 16px side margins, perfectly centered */
.mobile-page-container {
  width: 100% !important;
  max-width: 36rem !important; /* 576px (max-w-xl) */
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1rem !important;  /* Strict 16px side fixation on mobile */
  padding-right: 1rem !important; /* Strict 16px side fixation on mobile */
  box-sizing: border-box !important;
}

/* Prevent iOS Safari from auto-zooming into inputs on focus */
input, select, textarea {
  font-size: 16px !important;
}

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

/* Custom Scrollbar in Festive Holiday Colors */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #68850A;
}
::-webkit-scrollbar-thumb {
  background: #CC1D08;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #e02610;
}

/* Photo Thumbnail Preview Grid */
.preview-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  background-color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.preview-thumb:hover img {
  transform: scale(1.05);
}

.preview-thumb .btn-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(204, 29, 8, 0.9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.preview-thumb .btn-del:hover {
  background: #991404;
  transform: scale(1.15);
}

/* Subtle sparkle animation for holiday background */
@keyframes festiveTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 0.9; transform: scale(1.15); }
}

.animate-twinkle {
  animation: festiveTwinkle 3s ease-in-out infinite;
}

.animate-twinkle-delay-1 {
  animation: festiveTwinkle 3.5s ease-in-out 1s infinite;
}

.animate-twinkle-delay-2 {
  animation: festiveTwinkle 4s ease-in-out 2s infinite;
}

/* Hanging Stockings sway animation */
@keyframes stockingSway {
  0%, 100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

.animate-stocking-sway {
  transform-origin: top center;
  animation: stockingSway 5s ease-in-out infinite;
}

/* Snowflake floating fall (fixed pixel translation prevents mobile viewport resize jump) */
@keyframes snowfallSlow {
  0% {
    transform: translateY(-30px) translateX(0) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.75;
  }
  85% {
    opacity: 0.75;
  }
  100% {
    transform: translateY(1100px) translateX(35px) rotate(360deg);
    opacity: 0;
  }
}

.snowflake {
  position: absolute;
  top: -30px;
  color: rgba(255, 255, 255, 0.75);
  user-select: none;
  pointer-events: none;
  animation: snowfallSlow 12s linear infinite;
}
