/* ============================================
   IMAGE WATERMARK ADDER — Premium UI
   Futuristic dark mode · Glassmorphism · Neon
   ============================================ */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Variables ─── */
:root {
  --bg-deep: #070b14;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-hover: rgba(17, 24, 39, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.14);
  --primary-glow: #3b82f6;
  --secondary-glow: #8b5cf6;
  --accent: #06b6d4;
  --text-primary: #ffffff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-card: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --transition: 0.35s cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ─── Base ─── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Animated Mesh Background ─── */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #3b82f6, transparent);
  top: -200px; left: -200px;
  animation-delay: 0s;
}

.blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #8b5cf6, transparent);
  bottom: -150px; right: -150px;
  animation-delay: -5s;
}

.blob-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #06b6d4, transparent);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

.blob-4 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #f59e0b, transparent);
  top: 60%; right: 10%;
  animation-delay: -15s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -50px) scale(1.1); }
  50% { transform: translate(-30px, 30px) scale(0.9); }
  75% { transform: translate(40px, 40px) scale(1.05); }
}

/* ─── Floating Glow Orbs ─── */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: orbPulse 4s ease-in-out infinite;
}

.glow-orb.orb-1 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(59,130,246,0.08), transparent 70%);
  top: 10%; right: 5%;
  animation-delay: 0s;
}

.glow-orb.orb-2 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(139,92,246,0.08), transparent 70%);
  bottom: 15%; left: 10%;
  animation-delay: -1.5s;
}

.glow-orb.orb-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(6,182,212,0.06), transparent 70%);
  top: 40%; right: 30%;
  animation-delay: -3s;
}

@keyframes orbPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ─── Tool Wrapper ─── */
.tool-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 20px 20px;
}

/* ─── Tool Header ─── */
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.2));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--primary-glow);
}

.tool-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.tool-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.header-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
}

.header-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-glass);
  margin: 0 4px;
}

/* ─── Editor Layout ─── */
.editor-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 140px);
  min-height: 600px;
}

/* ─── Sidebar ─── */
.editor-sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* ─── Control Cards ─── */
.control-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.control-card:hover {
  border-color: var(--border-glass-hover);
  background: rgba(255,255,255,0.05);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.card-header svg {
  opacity: 0.6;
}

/* ─── Upload Zone ─── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover {
  border-color: var(--primary-glow);
  background: rgba(59,130,246,0.05);
}

.upload-zone.drag-over {
  border-color: var(--primary-glow);
  background: rgba(59,130,246,0.1);
  box-shadow: 0 0 20px rgba(59,130,246,0.15);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  color: var(--text-dim);
  margin-bottom: 4px;
}

.upload-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-text span {
  color: var(--primary-glow);
  font-weight: 600;
}

.upload-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.small-zone {
  padding: 16px;
}

.small-zone .upload-icon svg {
  width: 28px;
  height: 28px;
}

/* ─── Upload Info ─── */
.upload-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-xs);
  margin-top: 8px;
}

.upload-info-icon {
  color: var(--primary-glow);
  flex-shrink: 0;
}

.upload-info-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upload-info-text span:first-child {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-info-text span:last-child {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.upload-change {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.upload-change:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* ─── Type Toggle ─── */
.type-toggle {
  display: flex;
  gap: 6px;
}

.type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.type-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.type-btn.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  border-color: rgba(59,130,246,0.3);
  color: var(--text-primary);
  box-shadow: 0 0 15px rgba(59,130,246,0.1);
}

/* ─── Control Groups ─── */
.control-group {
  margin-bottom: 10px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.control-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.flex-1 {
  flex: 1;
}

/* ─── Modern Input ─── */
.modern-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.modern-input:focus {
  border-color: var(--primary-glow);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.modern-input::placeholder {
  color: var(--text-dim);
}

/* ─── Custom Select ─── */
.custom-select {
  position: relative;
}

.custom-select select {
  width: 100%;
  padding: 10px 32px 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select select:focus {
  border-color: var(--primary-glow);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.custom-select svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* ─── Modern Slider ─── */
.slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modern-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  outline: none;
  transition: var(--transition);
}

.modern-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(59,130,246,0.3);
  transition: var(--transition);
}

.modern-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(59,130,246,0.5);
}

.modern-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(59,130,246,0.3);
}

.slider-value {
  min-width: 36px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Style Chips ─── */
.style-chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.style-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.style-chip:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.style-chip[data-active="true"] {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  border-color: rgba(59,130,246,0.3);
  color: var(--text-primary);
}

/* ─── Color Picker ─── */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modern-color {
  width: 36px;
  height: 36px;
  padding: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}

.modern-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.modern-color::-webkit-color-swatch {
  border: none;
  border-radius: 7px;
}

.color-hex {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 56px;
}

.color-picker-wrapper.small .modern-color {
  width: 30px;
  height: 30px;
}

/* ─── Toggle ─── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input {
  display: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  position: relative;
  transition: var(--transition);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-label input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
}

.toggle-label input:checked + .toggle-track .toggle-thumb {
  left: 18px;
  background: white;
}

.toggle-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Gradient Controls ─── */
.gradient-controls {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-glass);
}

/* ─── Position Grid ─── */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.pos-btn {
  padding: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.pos-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}

.pos-btn.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  border-color: rgba(59,130,246,0.3);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(59,130,246,0.1);
}

.control-hint {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* ─── Effects Grid ─── */
.effects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.effect-chip {
  position: relative;
  cursor: pointer;
}

.effect-chip input {
  position: absolute;
  opacity: 0;
}

.effect-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.effect-chip input:checked + .effect-label {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.12));
  border-color: rgba(59,130,246,0.3);
  color: var(--text-primary);
}

.effect-chip:hover .effect-label {
  border-color: var(--border-glass-hover);
  color: var(--text-muted);
}

/* ─── Effect Sub-controls ─── */
.effect-sub {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
}

/* ─── Tool Actions (Share & Save) ─── */
.tool-actions {
  display: flex;
  gap: 8px;
  padding: 8px 0 4px;
  justify-content: center;
}

.tool-actions .share-btn,
.tool-actions .save-btn {
  position: relative;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  overflow: hidden;
}

.tool-actions .share-btn:hover,
.tool-actions .save-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
}

.tool-actions .share-btn .outline,
.tool-actions .save-btn .outline {
  display: none;
}

.tool-actions .share-btn .state,
.tool-actions .save-btn .state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.tool-actions .share-btn .state p,
.tool-actions .save-btn .state p {
  display: flex;
  gap: 1px;
}

.tool-actions .share-btn .state p span,
.tool-actions .save-btn .state p span {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  transition: var(--transition);
}

.tool-actions .share-btn:hover .state p span,
.tool-actions .save-btn:hover .state p span {
  color: var(--text-muted);
}

.tool-actions .share-btn .icon svg,
.tool-actions .save-btn .icon svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}

.tool-actions .share-btn:hover .icon svg,
.tool-actions .save-btn:hover .icon svg {
  color: var(--text-muted);
}

.tool-actions .share-btn .state--sent,
.tool-actions .save-btn .state--saved {
  display: none;
}

.tool-actions .share-btn.sent .state--default,
.tool-actions .save-btn.saved .state--default {
  display: none;
}

.tool-actions .share-btn.sent .state--sent,
.tool-actions .save-btn.saved .state--saved {
  display: flex;
}

.tool-actions .save-btn .save-3d-bottom {
  display: none;
}

/* ─── Action Bar ─── */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
  border: none;
  border-radius: var(--radius-xs);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: 0.5s;
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-glass-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  border-color: var(--border-glass-hover);
}

/* ─── Preview Panel ─── */
.editor-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preview-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  position: relative;
  animation: glowBorder 4s ease-in-out infinite;
}

@keyframes glowBorder {
  0%, 100% { box-shadow: 0 0 30px rgba(59,130,246,0.05), inset 0 0 30px rgba(59,130,246,0.02); }
  50% { box-shadow: 0 0 50px rgba(59,130,246,0.1), inset 0 0 50px rgba(59,130,246,0.04); }
}

/* ─── Preview Toolbar ─── */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.preview-toolbar-left,
.preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-badge {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}

.preview-tool-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
}

.preview-tool-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border-color: var(--border-glass);
}

.preview-divider {
  width: 1px;
  height: 20px;
  background: var(--border-glass);
}

/* ─── Canvas Wrapper ─── */
.preview-canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.02), transparent);
}

.preview-canvas-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ─── Placeholder ─── */
.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.placeholder-icon {
  color: var(--text-dim);
  opacity: 0.4;
}

.placeholder-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.placeholder-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  max-width: 280px;
}

.placeholder-shortcuts {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.placeholder-shortcuts span {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.placeholder-shortcuts kbd {
  padding: 2px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}

/* ─── Preview Footer ─── */
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-top: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.preview-footer-left,
.preview-footer-right {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Before/After Overlay ─── */
.before-after-overlay,
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 11, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.before-after-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.before-after-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.before-after-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.before-after-content {
  display: flex;
  gap: 20px;
}

.ba-image {
  flex: 1;
  text-align: center;
}

.ba-image h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.ba-image img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

/* ─── Fullscreen ─── */
.fullscreen-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  z-index: 2;
}

.fullscreen-header span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fullscreen-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 40px 40px;
}

.fullscreen-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .editor-layout {
    flex-direction: column-reverse;
    height: auto;
    min-height: auto;
  }

  .editor-sidebar {
    width: 100%;
    max-height: 500px;
  }

  .editor-preview {
    min-height: 400px;
  }

  .tool-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .before-after-content {
    flex-direction: column;
  }

  .position-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .effects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .tool-wrapper {
    padding: 10px;
  }

  .tool-header {
    padding: 10px 14px;
  }

  .header-brand {
    gap: 8px;
  }

  .header-icon {
    width: 36px;
    height: 36px;
  }

  .header-icon svg {
    width: 22px;
    height: 22px;
  }

  .tool-title {
    font-size: 1rem;
  }

  .tool-subtitle {
    display: none;
  }

  .editor-sidebar {
    max-height: 400px;
  }

  .editor-preview {
    min-height: 300px;
  }

  .control-card {
    padding: 12px;
  }

  .control-row {
    flex-direction: column;
    gap: 8px;
  }

  .effects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .position-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .before-after-modal {
    padding: 16px;
    max-width: 95vw;
  }

  .placeholder-shortcuts {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .action-bar {
    gap: 6px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-ghost {
    padding: 10px 14px;
    font-size: 0.8rem;
  }
}

/* ─── Utility ─── */
.hidden {
  display: none !important;
}

/* ─── Fabric.js Overrides ─── */
.canvas-container {
  margin: auto !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3) !important;
}

/* ─── Smooth scrollbar for sidebar ─── */
.sidebar-scroll {
  scroll-behavior: smooth;
}

/* ─── Selection styling ─── */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: white;
}

/* ─── Focus visible ─── */
:focus-visible {
  outline: 2px solid var(--primary-glow);
  outline-offset: 2px;
}

/* ─── Loading spinner ─── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary-glow);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Toast notification ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}