:root {
  --bg-color: #0b0c10;
  --panel-bg: rgba(22, 26, 38, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --primary-color: #00f2fe;
  --secondary-color: #4facfe;
  --accent-color: #f35588;
  --text-main: #f5f6fa;
  --text-muted: #a4b0be;
  --success-color: #00ff87;
  --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.15);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Background Ambient Glows */
.glow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.glow-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.3;
}

.glow-circle.cyan {
  width: 500px;
  height: 500px;
  background: var(--primary-color);
  top: -10%;
  left: -10%;
}

.glow-circle.magenta {
  width: 600px;
  height: 600px;
  background: var(--accent-color);
  bottom: -15%;
  right: -10%;
}

/* Typography & Layout */
header {
  text-align: center;
  margin-bottom: 3rem;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Container & Panels */
.container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

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

.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

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

.tab-btn.active {
  color: var(--primary-color);
  background: rgba(0, 242, 254, 0.1);
  box-shadow: var(--shadow-glow);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .col {
  flex: 1;
}

input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

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

.template-card {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.template-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.template-card.active {
  border-color: var(--primary-color);
  background: rgba(0, 242, 254, 0.05);
  box-shadow: var(--shadow-glow);
}

.card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  font-family: 'Outfit', sans-serif;
}

.template-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Dynamic Inputs List */
.inputs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.input-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-remove {
  background: rgba(243, 85, 136, 0.1);
  border: 1px solid rgba(243, 85, 136, 0.2);
  color: var(--accent-color);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: bold;
}

.btn-remove:hover {
  background: rgba(243, 85, 136, 0.25);
  color: #fff;
}

/* Code Editor Textarea */
.code-editor {
  font-family: 'Courier New', Courier, monospace;
  height: 350px;
  resize: vertical;
  background: #0f111a;
  border-color: var(--border-color);
  line-height: 1.5;
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #0b0c10;
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 10px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-success {
  background: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
  color: #0b0c10;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.05rem;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 255, 135, 0.25);
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(11, 12, 16, 0.2);
  border-top-color: #0b0c10;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Preview Panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 2rem;
}

.preview-panel h2 {
  font-family: 'Outfit', sans-serif;
  margin-bottom: 1.5rem;
  align-self: flex-start;
  font-size: 1.5rem;
}

.preview-container {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 9/16;
  background: #0f111a;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
}

.video-placeholder {
  padding: 2rem;
  text-align: center;
}

.large-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.video-placeholder p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#output-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.action-buttons {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-buttons .btn {
  padding: 0.85rem;
  text-align: center;
}

/* Progress Overlay */
.progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 12, 16, 0.85);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.progress-box {
  width: 100%;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 242, 254, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem auto;
}

.progress-box h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

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

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

footer {
  text-align: center;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
