@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-dark: #0f0f11;
  --bg-darker: #070708;
  --panel-bg: rgba(20, 20, 24, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-muted: #6e6e73;
  --accent-orange: #d97706;
  --accent-yellow: #f59e0b;
  --accent-teal: #0d9488;
  --accent-light: #2dd4bf;
  --glow-color: #f59e0b;
  
  --font-sans: 'Outfit', sans-serif;
  --font-serif: 'DM Serif Display', serif;
}

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

body {
  background: radial-gradient(circle at top right, #1a1a24, var(--bg-darker));
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 1200px;
}

header h1 {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 400;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #f59e0b, #e07a3f, #0d9488);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
}

.main-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  width: 100%;
  max-width: 1200px;
  align-items: start;
}

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

/* Glassmorphism Panel styles */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Global Config Styling */
.global-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-yellow);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* Playlist Slots Container */
.playlist-slots {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slot-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  grid-template-columns: auto 1fr 1.2fr;
  gap: 1rem;
  align-items: center;
  transition: all 0.3s ease;
}

.slot-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.slot-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.slot-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slot-inputs input[type="text"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  width: 100%;
}

.slot-inputs input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-teal);
  background: rgba(255, 255, 255, 0.08);
}

.slot-files {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Custom File Upload Button style */
.file-upload-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.file-upload-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-upload-label.loaded {
  background: rgba(13, 148, 136, 0.15);
  border-color: var(--accent-teal);
  color: var(--accent-light);
}

.file-upload-label:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Control Actions */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-yellow), #e07a3f);
  color: #121212;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
  filter: brightness(1.1);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-teal), #0f766e);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.25);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
  filter: brightness(1.1);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  background: var(--text-muted);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Preview Section Styling */
.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-frame {
  width: 100%;
  max-width: 380px;
  aspect-ratio: 9/16;
  border: 8px solid #222226;
  background-color: var(--bg-darker);
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 
              0 0 0 1px rgba(255, 255, 255, 0.05),
              inset 0 0 10px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas styling */
#preview-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: var(--bg-darker);
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-height: 24px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--accent-yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

.spinner.active {
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Help & Notes Footer */
footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 600px;
  line-height: 1.5;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
}

/* Hidden video elements container */
#video-pool {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
