/* ============ Global Styles ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Task row animation */
@keyframes taskPulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }
.task-generating { animation: taskPulse 1.2s ease-in-out infinite; }

/* ============================================ */
/* Sub-row accordion animation                  */
/* ============================================ */
.sub-row-hidden {
  display: none;
}

/* Expand icon rotation */
#expandIcon_ {
  transition: transform 0.2s ease;
}

/* ============================================ */
/* Gallery Product Cards (v3)                   */
/* ============================================ */

/* Gallery grid is now flex-column for products */
/* Inner sub-grid uses CSS grid (set inline via Tailwind) */

/* ============================================ */
/* Before/After Comparator                      */
/* ============================================ */
.comparator-container {
  position: relative;
  overflow: hidden;
  user-select: none;
}

.comparator-slider {
  position: absolute;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  transition: none;
}

.comparator-handle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 11;
}

/* --- Comparator Toolbar Mode Buttons --- */
.cmp-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.cmp-mode-btn:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.08);
}
.cmp-mode-btn.cmp-mode-active {
  color: #ffffff;
  background: #1e6ef5;
  border-color: #1e6ef5;
  box-shadow: 0 1px 4px rgba(30,110,245,0.4);
}

/* --- Swap & Reset buttons --- */
.cmp-swap-btn,
.cmp-reset-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  background: transparent;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.cmp-swap-btn:hover,
.cmp-reset-btn:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(148,163,184,0.6);
}
.cmp-swap-btn.cmp-swap-active {
  color: #38e08a;
  background: rgba(56,224,138,0.12);
  border-color: rgba(56,224,138,0.4);
}

/* Drag & drop zone highlight */
.drop-zone-active {
  outline: 3px dashed #3b82f6;
  outline-offset: -4px;
  background: rgba(59,130,246,0.04);
}

/* Toast notification */
@keyframes toastSlideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.toast-enter { animation: toastSlideIn 0.3s ease-out; }

/* Modal backdrop blur */
.modal-backdrop { backdrop-filter: blur(4px); }

/* Preset card hover */
.preset-card:hover .preset-apply-btn { opacity: 1; }
.preset-apply-btn { opacity: 0; transition: opacity 0.15s; }

/* ============================================ */
/* Product sub-row slide-in animation           */
/* ============================================ */
@keyframes subRowSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sub-row-expanded {
  animation: subRowSlideIn 0.2s ease-out;
}

/* ============================================ */
/* Watermark Management System Styles           */
/* ============================================ */

/* Toggle Switch (Large - Global) */
.wm-toggle-track {
  width: 48px;
  height: 26px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background 0.25s ease;
  cursor: pointer;
}
.wm-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .wm-toggle-track {
  background: #1555d4;
}
input:checked + .wm-toggle-track::after {
  transform: translateX(22px);
}

/* Toggle Switch (Mini) */
.wm-toggle-mini {
  width: 38px;
  height: 21px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background 0.25s ease;
  cursor: pointer;
}
.wm-toggle-mini::after {
  content: '';
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
input:checked + .wm-toggle-mini {
  background: #1555d4;
}
input:checked + .wm-toggle-mini::after {
  transform: translateX(17px);
}

/* Profile list items */
.wm-profile-item:hover {
  background: #f8fafc;
}

/* Inline rename input (FIX Bug #5: replaces window.prompt) */
.wm-inline-rename-input {
  animation: wmFadeIn 0.15s ease-out;
}

/* Preview background switcher active state */
.wm-bg-btn.wm-bg-active {
  background: #eff6ff;
  border-color: #1555d4;
  color: #1555d4;
  box-shadow: 0 1px 3px rgba(21,85,212,0.15);
}

/* ============================================ */
/* Watermark Preview Canvas Container           */
/* Background modes (FIX Bug #3)                */
/* ============================================ */

/* Default: subtle neutral — gets overridden by mode classes */
#wmCanvasContainer {
  background-color: #f8fafc;
  transition: background-color 0.25s ease, background-image 0.25s ease;
}

/* White background */
#wmCanvasContainer.wm-bg-white {
  background-image: none !important;
  background-color: #ffffff;
}

/* Dark background */
#wmCanvasContainer.wm-bg-dark {
  background-image: none !important;
  background-color: #1e293b;
}

/* Checkerboard pattern */
#wmCanvasContainer.wm-bg-checkers {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Watermark view container smooth transition */
#watermarkViewContainer {
  animation: wmFadeIn 0.2s ease-out;
}
@keyframes wmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================ */
/* Auth / Call Mode / Redeem                    */
/* ============================================ */
.mode-btn {
  border-color: #e2e8f0;
  background: #ffffff;
  color: #475569;
}
.mode-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.mode-btn.active {
  border-color: #1555d4;
  background: #eff6ff;
  color: #1555d4;
  box-shadow: 0 1px 3px rgba(21,85,212,0.12);
}

#authScreen {
  backdrop-filter: blur(6px);
}