/* Google Fonts: Outfit & Hind Siliguri */

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(23, 32, 51, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.09);
  --bg-input: rgba(13, 19, 33, 0.7);
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-gold: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 12px 35px -10px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Outfit', 'Hind Siliguri', sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(245, 158, 11, 0.05) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header */
.header {
  border-bottom: 1px solid var(--bg-card-border);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
}

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

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-green), #047857);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.logo-text h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text h1 span {
  background: linear-gradient(90deg, #10b981, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #34d399;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Layout */
.main-wrapper {
  max-width: 1440px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent-green);
}

/* Form Elements */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-label span.req {
  color: var(--accent-red);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: 'Hind Siliguri', 'Outfit', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background: rgba(13, 19, 33, 0.95);
}

.form-textarea {
  resize: vertical;
  min-height: 85px;
  line-height: 1.5;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .form-grid, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Tabs */
.source-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 0.75rem;
  background: rgba(13, 19, 33, 0.7);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
}

.source-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.source-tab.active {
  background: var(--accent-green);
  color: #fff;
}

.input-folder-box {
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.input-folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-refresh {
  background: transparent;
  border: none;
  color: var(--accent-green);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-refresh:hover {
  text-decoration: underline;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  background: rgba(13, 19, 33, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.05);
}

.dropzone-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  color: var(--accent-green);
}

.dropzone-text {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
}

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

.file-chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
}

.file-chosen-name {
  font-size: 0.85rem;
  color: #34d399;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-chosen-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Template Cards Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 1.25rem;
}

.template-card {
  background: var(--bg-input);
  border: 2px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.template-card.active {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.template-preview-bar {
  height: 18px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.template-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

/* Range Sliders */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-input {
  flex: 1;
  accent-color: var(--accent-green);
  cursor: pointer;
}

.slider-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-green);
  min-width: 38px;
}

/* Collapsible Settings Details */
.accordion {
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: rgba(13, 19, 33, 0.5);
}

.accordion-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}

.accordion-header:hover {
  color: #fff;
}

.accordion-content {
  padding: 1rem;
  border-top: 1px solid var(--bg-card-border);
  display: none;
}

.accordion.open .accordion-content {
  display: block;
}

/* Action Button */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Hind Siliguri', 'Outfit', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  margin-top: 1rem;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Preview Section */
.preview-container {
  position: sticky;
  top: 5.5rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.preview-badge {
  font-size: 0.75rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.photocard-stage {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #18181b;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#sourceVideo {
  display: none;
}

/* Progress Overlay */
.progress-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.progress-box {
  background: #172033;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(16, 185, 129, 0.15);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.25rem;
}

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

.progress-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}

.progress-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: #34d399;
}

/* Result Card */
.result-card {
  display: none;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  text-align: center;
}

.result-video-player {
  width: 100%;
  max-height: 260px;
  border-radius: var(--radius-md);
  background: #000;
  margin-bottom: 0.75rem;
}

.btn-download {
  background: #10b981;
  color: #fff;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-download:hover {
  background: #059669;
  transform: translateY(-2px);
}

.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--bg-card-border);
  margin-top: 3rem;
}
