/* ==========================================================================
   Ray Aero - Client-Side Watermark Adder Studio Stylesheet
   Ultra-Premium Aerospace Dark Theme & Canvas Workbench
   ========================================================================== */

:root {
  --bg-deep: #050810;
  --bg-canvas-stage: #070b14;
  --bg-sidebar: #0b111e;
  --bg-card: #101828;
  --bg-card-hover: #162238;
  --bg-input: #090e18;
  --bg-input-focus: #0f172a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-focus: #38bdf8;
  --accent-silver: #c0c0c0;
  --accent-cyan: #38bdf8;
  --accent-gold: #fbbf24;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

/* Studio Application Shell */
.wm-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Top Studio Header Navbar */
.wm-navbar {
  height: 56px;
  min-height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  position: relative;
}

.wm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.wm-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-silver);
  object-fit: cover;
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.25);
}

.wm-brand-title {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.wm-brand-badge {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #050810;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.8px;
  font-family: 'Inter', sans-serif;
}

.wm-brand-sub {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Header Action Buttons */
.wm-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-pill {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.5px;
}

.btn-wm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-wm-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-wm-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-hover);
  color: #ffffff;
}

.btn-wm-accent {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}

.btn-wm-accent:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.btn-wm-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn-wm-success:hover {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  color: #ffffff;
}

/* Main Workspace */
.wm-workspace {
  flex: 1;
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
  position: relative;
}

/* Left Sidebar Controls */
.wm-sidebar {
  width: 440px;
  min-width: 360px;
  max-width: 480px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

/* Tabs Navigation */
.wm-tabs-nav {
  display: flex;
  background: rgba(5, 8, 16, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  min-height: 48px;
}

.wm-tab-btn {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.wm-tab-btn i {
  font-size: 15px;
}

.wm-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.wm-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.06);
}

/* Sidebar Scroll Area */
.wm-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wm-tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.wm-tab-pane.active {
  display: flex;
}

/* Control Section Box */
.control-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition-fast);
}

.control-card:hover {
  border-color: var(--border-hover);
}

.control-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-card-title {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-silver);
  display: flex;
  align-items: center;
  gap: 7px;
}

.control-card-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* Form inputs & controls */
.form-label-custom {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label-val {
  color: var(--accent-cyan);
  font-family: 'Space Grotesk', monospace;
  font-weight: 700;
}

.form-control-custom, .form-select-custom {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  outline: none;
  font-family: 'Inter', sans-serif;
}

.form-control-custom:focus, .form-select-custom:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.form-range-custom {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* 9-Grid Position Matrix */
.position-grid-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 220px;
  margin: 0 auto;
}

.grid-pos-btn {
  height: 38px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.grid-pos-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.grid-pos-btn.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #050810;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Style Preset Cards */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition-fast);
  text-align: left;
}

.preset-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.preset-card.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.preset-card-title {
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

.preset-card-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(2, 132, 199, 0.04);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.2);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-cyan);
}

/* Batch Queue Filmstrip */
.queue-filmstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px 2px;
  min-height: 70px;
}

.queue-item {
  position: relative;
  width: 72px;
  height: 54px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  background: #000;
}

.queue-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  transition: opacity var(--transition-fast);
}

.queue-item:hover img, .queue-item.active img {
  opacity: 1;
}

.queue-item.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transform: scale(1.05);
}

.queue-item-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.85);
  color: #fff;
  border: none;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.queue-item:hover .queue-item-remove {
  display: flex;
}

/* Center Canvas Workbench */
.wm-stage {
  flex: 1;
  background: var(--bg-canvas-stage);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Workbench Stage Toolbar */
.wm-stage-toolbar {
  height: 48px;
  background: rgba(11, 17, 30, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

.wm-stage-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.wm-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Space Grotesk', monospace;
  font-size: 11px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.wm-chip.highlight {
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

/* Canvas Viewport */
.wm-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  position: relative;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.03) 0%, transparent 80%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

.canvas-container {
  position: relative;
  display: inline-flex;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform var(--transition-fast);
  user-select: none;
}

#watermarkMainCanvas {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #000;
  cursor: default;
}

#watermarkMainCanvas.can-drag {
  cursor: grab;
}

#watermarkMainCanvas.dragging {
  cursor: grabbing;
}

/* Interactive Watermark Bounding Overlay */
.wm-drag-indicator {
  position: absolute;
  border: 2px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  pointer-events: none;
  display: none;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Empty State Backdrop */
.wm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-dim);
  text-align: center;
  max-width: 440px;
  padding: 40px 20px;
}

.wm-empty-icon {
  font-size: 54px;
  color: rgba(56, 189, 248, 0.3);
  animation: pulse-slow 3s infinite ease-in-out;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

/* Bottom Action Dock */
.wm-stage-dock {
  height: 64px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

/* Toast System */
.wm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  border: 1px solid var(--border-focus);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-smooth);
}

.wm-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Batch Processing Modal */
.wm-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.wm-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.wm-modal-card {
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .wm-workspace {
    flex-direction: column;
  }
  .wm-sidebar {
    width: 100%;
    max-width: 100%;
    height: 45vh;
  }
  .wm-stage {
    height: 55vh;
  }
}

/* Admin Auth Gate Screen */
.admin-auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #050810;
  background-image: 
    radial-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.admin-auth-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-silver);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #ffffff;
}

.admin-auth-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--accent-silver);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.admin-auth-title {
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffffff;
  margin: 0;
}

.admin-auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.admin-google-btn {
  width: 100%;
  padding: 12px 18px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.admin-google-btn:hover {
  background: #334155;
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
}
