/**
 * ==========================================================================
 * VELORA AI VIDEO STUDIO — PRODUCTION LUXURY LIGHT/WHITE THEME
 * Pure White, Soft Pearl, Warm Cream, Charcoal Typography & Royal Purple
 * ==========================================================================
 */

:root {
  /* Strict Light Palette */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-cream: #fdfbf7;
  --bg-surface-elevated: #ffffff;
  --bg-surface-translucent: rgba(255, 255, 255, 0.92);
  
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.14);
  --border-highlight: rgba(124, 58, 237, 0.35);

  --purple-primary: #7c3aed;
  --purple-hover: #6d28d9;
  --purple-glow: rgba(124, 58, 237, 0.18);
  --purple-soft: rgba(124, 58, 237, 0.08);
  --purple-badge-bg: rgba(124, 58, 237, 0.08);

  --text-dark: #0f172a;
  --text-slate: #1e293b;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-light: #94a3b8;

  --color-success: #059669;
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-danger: #dc2626;
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  --color-warning: #d97706;

  /* Geometry & Physics */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.09);
  --shadow-glow: 0 4px 20px var(--purple-glow);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-slate);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Glow */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(140px);
  opacity: 0.4;
}

.glow-top-left {
  top: -140px;
  left: -140px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
}

.glow-top-right {
  top: -120px;
  right: -120px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.07) 0%, transparent 70%);
}

.glow-center {
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.05) 0%, transparent 70%);
}

/* Header Navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px var(--purple-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-dark);
}

.brand-title span {
  color: var(--purple-primary);
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.system-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--color-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.badge-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--purple-primary);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  outline: none;
  user-select: none;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-slate);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-surface-cream);
  border-color: rgba(15, 23, 42, 0.22);
  color: var(--text-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-hover) 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--purple-glow);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

/* Main Studio Layout */
.main-stage {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 50px;
}

.stage-container {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(400px, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .stage-container {
    grid-template-columns: 1fr;
  }
}

/* Studio Glass Card */
.studio-card {
  background: var(--bg-surface-translucent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Mode Switcher Tabs */
.mode-switcher-wrap {
  width: 100%;
}

.mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: var(--text-dark);
}

.mode-tab.active {
  background: #ffffff;
  color: var(--purple-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-highlight);
}

/* Control Blocks */
.control-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.control-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-icon {
  font-size: 0.95rem;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--purple-badge-bg);
  color: var(--purple-primary);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.char-count {
  font-size: 0.72rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

/* Image Dropzone */
.image-dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  text-align: center;
  background: #fafbfd;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-dropzone:hover, .image-dropzone.dragover {
  border-color: var(--purple-primary);
  background: var(--purple-soft);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.drop-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.drop-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dark);
}

.drop-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Uploaded Preview */
.uploaded-preview-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-highlight);
  background: #0f172a;
  max-height: 220px;
}

.uploaded-preview-wrap img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(15,23,42,0.6) 0%, transparent 40%, rgba(15,23,42,0.7) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px;
}

.preview-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: #059669;
  color: #ffffff;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.btn-remove-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-remove-preview:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
}

/* Prompt Textarea */
.prompt-input-wrapper {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.prompt-input-wrapper:focus-within {
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.prompt-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
  outline: none;
}

.prompt-textarea::placeholder {
  color: var(--text-light);
}

.prompt-action-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border-subtle);
}

.prompt-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-slate);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-tool-btn:hover {
  background: var(--purple-soft);
  border-color: var(--purple-primary);
  color: var(--purple-primary);
}

.btn-clear {
  margin-left: auto;
  color: var(--text-dim);
}

.btn-clear:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* Preset Chips */
.presets-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.preset-label {
  font-size: 0.73rem;
  color: var(--text-dim);
  font-weight: 700;
}

.preset-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-slate);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.preset-chip:hover {
  background: var(--purple-soft);
  border-color: var(--purple-primary);
  color: var(--purple-primary);
  transform: translateY(-1px);
}

/* Settings Grids */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafbfd;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.setting-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
}

.option-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
}

.option-pill {
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.option-pill:hover {
  color: var(--text-dark);
  border-color: rgba(15, 23, 42, 0.3);
}

.option-pill.active {
  background: #ffffff;
  border-color: var(--purple-primary);
  color: var(--purple-primary);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
  font-weight: 700;
}

.setting-row-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Generate Button */
.btn-generate {
  width: 100%;
  padding: 14px 20px;
  font-size: 0.98rem;
  font-weight: 700;
  border-radius: var(--radius-lg);
  letter-spacing: 0.02em;
}

/* Viewport Stage */
.viewport-card {
  min-height: 520px;
  position: sticky;
  top: 86px;
  width: 100%;
}

.viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.viewport-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewport-icon {
  font-size: 1.15rem;
}

.viewport-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}

.badge-engine {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--purple-soft);
  border: 1px solid var(--border-highlight);
  color: var(--purple-primary);
}

.viewport-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 420px;
  width: 100%;
}

/* Idle State */
.viewport-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 360px;
  gap: 12px;
}

.idle-graphic-wrap {
  position: relative;
  width: 95px;
  height: 95px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.idle-sphere {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
  border: 1.5px dashed var(--border-highlight);
  animation: rotate-sphere 14s linear infinite;
}

@keyframes rotate-sphere {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.idle-icon {
  font-size: 2.1rem;
  color: var(--purple-primary);
  filter: drop-shadow(0 2px 8px var(--purple-glow));
}

.idle-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}

.idle-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.idle-feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
}

.feature-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: var(--text-slate);
}

/* Multi-Stage Loading State */
.viewport-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  gap: 14px;
}

.neural-spinner-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.neural-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3.5px solid rgba(124, 58, 237, 0.12);
  border-top-color: var(--purple-primary);
  border-right-color: var(--purple-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner-core {
  font-size: 1.6rem;
  color: var(--purple-primary);
}

.loading-timer {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
}

.loading-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}

.loading-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stage-pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 6px;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.pipeline-step.active {
  opacity: 1;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-light);
}

.pipeline-step.active .step-dot {
  background: var(--purple-primary);
  box-shadow: 0 0 8px var(--purple-primary);
}

.step-text {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pipeline-step.active .step-text {
  color: var(--purple-primary);
}

.btn-cancel {
  margin-top: 10px;
}

/* Video Player Viewport (Clean, Centered, Zero Bleed) */
.viewport-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.video-player-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 460px;
  background: #0b0f19;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-player-container.ratio-9-16 {
  aspect-ratio: 9 / 16;
  max-height: 500px;
  max-width: 290px;
  margin: 0 auto;
}

.video-player-container.ratio-1-1 {
  aspect-ratio: 1 / 1;
  max-height: 440px;
  max-width: 440px;
  margin: 0 auto;
}

.video-player-container.ratio-16-9 {
  aspect-ratio: 16 / 9;
  max-height: 460px;
  width: 100%;
}

.master-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0b0f19;
}

.video-meta-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fafbfd;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .video-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .video-meta-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.video-meta-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.meta-prompt {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-tags {
  display: flex;
  gap: 8px;
}

.meta-tag {
  font-size: 0.73rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
}

.video-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.download-btn {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.download-btn:hover {
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

/* Video Vault Gallery */
.gallery-section {
  margin-top: 36px;
  background: var(--bg-surface-translucent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.gallery-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-icon {
  font-size: 1.2rem;
}

.gallery-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.gallery-count-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--purple-soft);
  color: var(--purple-primary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.gallery-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
  border-color: var(--purple-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.gallery-thumb-wrap {
  position: relative;
  width: 100%;
  height: 155px;
  background: #0f172a;
}

.gallery-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.gallery-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-card-prompt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fafbfd;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close-btn:hover {
  color: var(--text-dark);
}

/* Admin Portal Specifics */
.admin-login-screen {
  padding: 40px 24px;
  display: flex;
  justify-content: center;
}

.admin-login-card {
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.lock-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--purple-soft);
  border: 1px solid var(--border-highlight);
  color: var(--purple-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.login-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-dark);
}

.login-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.admin-input {
  width: 100%;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
}

.admin-input:focus {
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.login-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.login-hint code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--purple-primary);
  font-weight: 700;
}

/* Admin Dashboard */
.admin-dashboard-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.admin-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
}

.admin-tab {
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-tab:hover {
  color: var(--text-dark);
}

.admin-tab.active {
  color: var(--purple-primary);
  border-bottom-color: var(--purple-primary);
  background: #ffffff;
}

.admin-tab-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  max-height: 460px;
}

.admin-keys-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-dark);
}

.toolbar-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.add-keys-box {
  background: #fafbfd;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-keys-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
}

.add-keys-input-group {
  display: flex;
  gap: 8px;
}

.admin-textarea {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  outline: none;
  resize: vertical;
}

.admin-textarea:focus {
  border-color: var(--purple-primary);
}

.admin-keys-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.key-code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat-card {
  background: #fafbfd;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  font-family: var(--font-mono);
}

.stat-success {
  color: var(--color-success);
}

.settings-box {
  background: #fafbfd;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-box-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
}

.settings-box-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.change-pass-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.admin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: #fafbfd;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  color: var(--text-dark);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
  border-color: var(--color-success);
}

.toast.error {
  border-color: var(--color-danger);
}

.toast.info {
  border-color: var(--purple-primary);
}

/* ==========================================================================
   SOFTWARE LOCK GATE — Full-Screen Access Gate
   ========================================================================== */

/* Gate Overlay */
.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0012 0%, #0d0a1e 40%, #050510 70%, #0a0018 100%);
  overflow: hidden;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.gate-overlay.unlocked {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.03);
}

/* Floating Particles */
.gate-bg-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.gate-particle {
  position: absolute;
  border-radius: 50%;
  animation: gateParticleFloat linear infinite;
  opacity: 0;
}

@keyframes gateParticleFloat {
  0% { transform: translateY(110vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-20vh) scale(1.5); opacity: 0; }
}

/* Card */
.gate-card {
  position: relative;
  z-index: 2;
  width: min(460px, 94vw);
  padding: 44px 40px 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 28px;
  backdrop-filter: blur(32px);
  box-shadow:
    0 0 80px rgba(124, 58, 237, 0.18),
    0 32px 64px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.08);
  animation: gateCardIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-align: center;
}

@keyframes gateCardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand */
.gate-brand {
  margin-bottom: 28px;
}

.gate-icon-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-icon-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(124,58,237,0.7), 0 0 60px rgba(124,58,237,0.3);
  z-index: 2;
  position: relative;
}

.gate-icon-emoji {
  font-size: 26px;
  line-height: 1;
}

.gate-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(167,139,250,0.3);
  animation: gateRingPulse 3s ease-in-out infinite;
}
.gate-ring-1 { width: 64px;  height: 64px;  animation-delay: 0s; }
.gate-ring-2 { width: 76px;  height: 76px;  animation-delay: 0.5s; border-color: rgba(167,139,250,0.15); }
.gate-ring-3 { width: 90px;  height: 90px;  animation-delay: 1s;   border-color: rgba(167,139,250,0.07); }

@keyframes gateRingPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%       { transform: scale(1.06); opacity: 1; }
}

.gate-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #e2d9ff;
  margin-bottom: 4px;
}

.gate-title span {
  color: #a78bfa;
}

.gate-subtitle {
  font-size: 12px;
  color: rgba(167,139,250,0.6);
  letter-spacing: 0.04em;
}

/* Lock Section */
.gate-lock-section {
  margin-bottom: 24px;
}

.gate-lock-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  position: relative;
}

.gate-lock-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lock-body {
  fill: rgba(124,58,237,0.2);
  stroke: #a78bfa;
  stroke-width: 2;
  transition: fill 0.4s ease;
}

.lock-shackle {
  stroke: #a78bfa;
  stroke-width: 2.5;
  fill: none;
  transform-origin: 24px 22px;
  transition: transform 0.4s ease;
}

.lock-keyhole {
  fill: #a78bfa;
  stroke: #a78bfa;
  stroke-width: 2;
}

/* Shake animation for wrong password */
@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

.gate-card.shake { animation: gateShake 0.5s ease; }

/* Unlock animation */
.gate-lock-wrap.unlocking .lock-shackle {
  transform: translateY(-8px) rotate(-15deg);
}
.gate-lock-wrap.unlocking .lock-body {
  fill: rgba(16,185,129,0.25);
  stroke: #10b981;
}
.gate-lock-wrap.unlocking .lock-keyhole {
  fill: #10b981;
  stroke: #10b981;
}

.gate-access-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(167,139,250,0.7);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.gate-access-desc {
  font-size: 13px;
  color: rgba(167,139,250,0.5);
  line-height: 1.5;
}

/* Form */
.gate-form-wrap {
  margin-bottom: 24px;
}

.gate-input-group {
  position: relative;
  margin-bottom: 8px;
  border: 1.5px solid rgba(167,139,250,0.25);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
}

.gate-input-group:focus-within {
  border-color: rgba(167,139,250,0.6);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12), 0 0 20px rgba(124,58,237,0.1);
}

.gate-input-group.error-state {
  border-color: rgba(239,68,68,0.6) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
}

.gate-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 16px;
  color: #e2d9ff;
  font-size: 15px;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
}

.gate-input::placeholder {
  color: rgba(167,139,250,0.35);
}

.gate-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 14px;
  color: rgba(167,139,250,0.5);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.gate-eye-btn:hover { color: #a78bfa; }

.gate-error-msg {
  font-size: 12.5px;
  color: #f87171;
  min-height: 18px;
  margin-bottom: 12px;
  text-align: left;
  padding-left: 4px;
  transition: opacity 0.3s ease;
}

/* Unlock Button */
.gate-unlock-btn {
  position: relative;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #7c3aed 100%);
  background-size: 200% 100%;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background-position 0.5s ease;
  box-shadow: 0 4px 20px rgba(124,58,237,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gate-unlock-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124,58,237,0.55);
  background-position: right center;
}

.gate-unlock-btn:active {
  transform: translateY(0);
}

.gate-btn-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.18) 0%, transparent 60%);
  pointer-events: none;
}

.gate-btn-icon { font-size: 17px; }
.gate-btn-text { font-size: 15px; }

/* Gate Footer */
.gate-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gate-footer-badge {
  font-size: 11px;
  color: rgba(167,139,250,0.45);
  letter-spacing: 0.03em;
}

.gate-footer-sep { color: rgba(167,139,250,0.25); font-size: 11px; }

.gate-admin-link {
  font-size: 11px;
  color: rgba(167,139,250,0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}
.gate-admin-link:hover { color: #a78bfa; text-decoration: underline; }

/* Success State */
.gate-unlock-btn.success {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  box-shadow: 0 4px 20px rgba(16,185,129,0.5) !important;
}
