/* ============================================================
   LEIBROTHER — Custom Page Artistic Typography
   Enhanced artistic feel for MV custom page
   ============================================================ */

/* --- Artistic Font Stack --- */
:root {
  /* Primary artistic fonts */
  --font-serif-display: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', serif;
  --font-serif-body: 'Noto Serif SC', 'Source Han Serif SC', serif;
  --font-sans: 'Source Sans 3', 'Noto Sans SC', system-ui, sans-serif;
  
  /* Calligraphic accent font (for special elements) */
  --font-script: 'Ma Shan Zheng', 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
}

/* --- Page Header (more artistic) --- */
.page-header {
  padding-top: 140px;
  padding-bottom: var(--space-3xl);
  background: linear-gradient(180deg, oklch(93% 0.015 60) 0%, oklch(97% 0.005 60) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, oklch(92% 0.02 35 / 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.page-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  position: relative;
  z-index: 1;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  transition: all var(--duration-fast) var(--ease-out);
}

.page-back:hover {
  color: var(--text-primary);
  background: oklch(100% 0 0);
  box-shadow: 0 2px 8px oklch(0% 0 0 / 0.06);
}

.page-heading {
  font-family: var(--font-serif-display);
  font-size: clamp(2.5rem, 1.8rem + 3vw, 4.5rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
  position: relative;
}

/* Artistic underline accent */
.page-heading::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, oklch(70% 0.12 35) 100%);
  border-radius: 2px;
}

.page-subtitle {
  font-family: var(--font-serif-body);
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.4rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  max-width: 55ch;
  line-height: 1.7;
}

/* --- Form Section (artistic spacing) --- */
.form-section {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-4xl) var(--space-xl);
}

.form-group {
  margin-bottom: var(--space-3xl);
  position: relative;
}

.form-label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-serif-display);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.02em;
}

.form-label-icon {
  font-size: 1.4rem;
  filter: grayscale(0.3);
  transition: filter var(--duration-normal) var(--ease-out);
}

.form-group:hover .form-label-icon {
  filter: grayscale(0);
}

/* --- Form Inputs (more refined) --- */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-lg) var(--space-xl);
  font-family: var(--font-serif-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text-primary);
  background: oklch(100% 0 0);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  transition: all var(--duration-normal) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.7;
}

.form-input::placeholder,
.form-textarea::placeholder {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.7;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle);
  background: oklch(100% 0 0);
}

.form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.9;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23888' d='M7 10L2 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  padding-right: 48px;
}

/* --- Upload Area (more elegant) --- */
.upload-area {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: var(--space-3xl) var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  background: linear-gradient(180deg, oklch(98% 0.003 60) 0%, oklch(100% 0 0) 100%);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--accent-subtle) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
}

.upload-area:hover::before {
  opacity: 1;
}

.upload-area:hover {
  border-color: var(--accent);
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px oklch(0% 0 0 / 0.06);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.upload-icon {
  font-size: 3.5rem;
  color: var(--border-strong);
  line-height: 1;
  font-weight: 200;
  transition: all var(--duration-normal) var(--ease-out);
}

.upload-area:hover .upload-icon {
  color: var(--accent);
  transform: scale(1.1);
}

.upload-text {
  font-family: var(--font-serif-display);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.upload-hint {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 300;
}

/* --- Preview Grid --- */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
  width: 100%;
  position: relative;
  z-index: 1;
}

.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  box-shadow: 0 4px 12px oklch(0% 0 0 / 0.1);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.preview-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px oklch(0% 0 0 / 0.15);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.preview-item:hover img {
  transform: scale(1.08);
}

.preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: oklch(40% 0.15 25);
  color: oklch(98% 0 0);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 2px 8px oklch(0% 0 0 / 0.2);
}

.preview-remove:hover {
  transform: scale(1.2);
  background: oklch(35% 0.16 25);
}

/* --- Buttons (more refined) --- */
.cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-serif-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: oklch(98% 0 0);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  padding: var(--space-lg) var(--space-2xl);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  text-decoration: none;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px oklch(58% 0.16 35 / 0.3);
}

.cta-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, oklch(45% 0.17 35) 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px oklch(58% 0.16 35 / 0.4);
}

.cta-primary:active {
  transform: translateY(-1px);
}

.cta-primary--block {
  width: 100%;
  padding: var(--space-xl);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
}

.cta-primary--large {
  font-size: var(--text-lg);
  padding: var(--space-xl) var(--space-3xl);
}

.cta-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Secondary Button --- */
.cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: oklch(100% 0 0);
  padding: var(--space-sm) var(--space-lg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.cta-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--bg-warm);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px oklch(0% 0 0 / 0.06);
}

/* --- Result Panel --- */
.result-panel {
  margin-top: var(--space-3xl);
  background: linear-gradient(180deg, oklch(96% 0.01 60) 0%, oklch(98% 0.005 60) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-2xl);
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.04);
}

.result-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.result-panel-title {
  font-family: var(--font-serif-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.01em;
}

.result-actions {
  display: flex;
  gap: var(--space-md);
}

.result-content {
  width: 100%;
  min-height: 240px;
  max-height: 500px;
  font-family: var(--font-serif-body);
  font-size: var(--text-sm);
  line-height: 1.9;
  color: var(--text-primary);
  background: oklch(100% 0 0);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  padding: var(--space-lg);
  resize: vertical;
}

.result-content:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle);
}

/* --- Lyrics Panel --- */
.lyrics-panel {
  margin-top: var(--space-2xl);
  background: linear-gradient(180deg, oklch(95% 0.012 60) 0%, oklch(97% 0.008 60) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-2xl);
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.04);
}

.lyrics-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.lyrics-panel-title {
  font-family: var(--font-serif-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.lyrics-content {
  width: 100%;
  min-height: 300px;
  font-family: var(--font-serif-body);
  font-size: var(--text-base);
  line-height: 2.1;
  color: var(--text-primary);
  background: oklch(100% 0 0);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  padding: var(--space-xl);
  resize: vertical;
  white-space: pre-wrap;
}

.lyrics-content:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle);
}

/* --- Song Result --- */
.song-result {
  margin-top: var(--space-2xl);
  background: linear-gradient(180deg, oklch(96% 0.01 60) 0%, oklch(98% 0.005 60) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-2xl);
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.04);
}

.song-result-title {
  font-family: var(--font-serif-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.song-player {
  width: 100%;
  border-radius: 8px;
  margin-bottom: var(--space-md);
}

/* --- Video Preview --- */
.video-preview {
  margin-top: var(--space-3xl);
  background: linear-gradient(180deg, oklch(96% 0.01 60) 0%, oklch(98% 0.005 60) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-2xl);
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.04);
}

.video-container {
  text-align: center;
}

.video-title {
  font-family: var(--font-serif-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.video-loading {
  padding: var(--space-3xl) var(--space-lg);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-lg);
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-weight: 300;
}

.video-player {
  width: 100%;
  max-width: 720px;
  border-radius: 8px;
  margin-bottom: var(--space-lg);
}

.video-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Error State --- */
.video-error {
  padding: var(--space-2xl) var(--space-lg);
}

.error-text {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--error);
  margin-bottom: var(--space-lg);
  font-weight: 400;
}

/* --- Action Row --- */
.action-row {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
  text-align: center;
}

.action-row-text {
  font-family: var(--font-serif-body);
  font-size: var(--text-base);
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-2xl) var(--space-xl);
  background: var(--text-primary);
  color: oklch(90% 0.005 60);
  margin-top: var(--space-4xl);
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: oklch(65% 0.008 60);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .page-header {
    padding-top: 100px;
    padding-bottom: var(--space-2xl);
  }

  .form-section {
    padding: var(--space-2xl) var(--space-lg);
  }

  .result-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .video-actions {
    flex-direction: column;
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .upload-area {
    padding: var(--space-2xl) var(--space-lg);
  }

  .upload-icon {
    font-size: 2.5rem;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
