/* public/style.css */
:root {
  --bg-dark: #0b0c10;
  --bg-card: rgba(22, 24, 34, 0.85);
  --bg-card-hover: rgba(30, 33, 48, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #ff3366;
  --primary-pink: #ff2a70;
  --primary-glow: rgba(255, 42, 112, 0.35);
  --accent-purple: #7928ca;
  --accent-gold: #ffb800;
  --accent-cyan: #00f0ff;
  --text-main: #f5f6fa;
  --text-muted: #8e95a5;
  --text-dim: #5a6072;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(255, 42, 112, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(121, 40, 202, 0.12) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: rgba(11, 12, 16, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-pink), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 18px var(--primary-glow);
}

.logo-text h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: linear-gradient(90deg, #ff2a70, #ffb800);
  color: #fff;
  letter-spacing: 0.5px;
}

.logo-text .sub {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cost-summary-pill {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 30px;
  gap: 12px;
}

.pill-item {
  display: flex;
  flex-direction: column;
}

.pill-item .label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill-item .val-highlight {
  font-size: 13px;
  font-weight: 700;
  color: #00f0ff;
  font-family: var(--font-display);
}

.pill-item .val-credits {
  font-size: 13px;
  font-weight: 700;
  color: #ffb800;
  font-family: var(--font-display);
}

.pill-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-main);
  font-weight: 500;
}

.dot.online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 8px #00ff88;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 500px 1fr;
  flex: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
  gap: 24px;
}

/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
  padding-right: 6px;
}

.control-panel::-webkit-scrollbar {
  width: 6px;
}
.control-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Random Mega Hero */
.random-hero-card {
  background: linear-gradient(135deg, rgba(255, 42, 112, 0.22), rgba(121, 40, 202, 0.22));
  border: 1px solid rgba(255, 42, 112, 0.4);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(255, 42, 112, 0.18);
}

.random-hero-card::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 42, 112, 0.3), transparent 70%);
  pointer-events: none;
}

.hero-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 42, 112, 0.3);
  color: #ff6b9d;
  margin-bottom: 6px;
}

.hero-text-wrap h3 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.hero-text-wrap p {
  font-size: 12px;
  color: #ddd;
  line-height: 1.4;
}

.btn-random-mega {
  background: linear-gradient(90deg, #ff2a70, #7928ca, #00f0ff);
  background-size: 200% 200%;
  animation: rainbowGlow 4s ease infinite;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 20px rgba(255, 42, 112, 0.4);
}

@keyframes rainbowGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-random-mega:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(255, 42, 112, 0.6);
}

.btn-random-mega:active {
  transform: scale(0.98);
}

.dice-icon {
  font-size: 28px;
  animation: diceRoll 3s ease-in-out infinite;
}

@keyframes diceRoll {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-15deg); }
}

.btn-text-block {
  text-align: left;
  display: flex;
  flex-direction: column;
}

.btn-text-block strong {
  font-size: 15px;
  font-weight: 800;
}

.btn-text-block small {
  font-size: 11px;
  opacity: 0.9;
  font-family: var(--font-display);
}

/* Panel Cards */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-with-icon .icon {
  font-size: 18px;
}

.title-with-icon h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.badge-mini {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 42, 112, 0.15);
  color: #ff6b9d;
  font-weight: 600;
}

.btn-text-action {
  background: none;
  border: none;
  color: #00f0ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-text-action:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Models Grid */
.models-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.model-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.model-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.model-card.active {
  border-color: var(--primary-pink);
  background: rgba(255, 42, 112, 0.1);
  box-shadow: 0 0 16px rgba(255, 42, 112, 0.25);
}

.model-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.model-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.model-cost-tag {
  font-size: 11px;
  font-weight: 800;
  color: #00f0ff;
  font-family: var(--font-display);
}

.model-provider {
  font-size: 10px;
  color: var(--text-muted);
}

.model-badge-txt {
  font-size: 10px;
  color: #ffb800;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Option Group & Chips */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.chip-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.chip.active {
  background: linear-gradient(135deg, rgba(255, 42, 112, 0.25), rgba(121, 40, 202, 0.25));
  border-color: var(--primary-pink);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(255, 42, 112, 0.3);
}

/* Specs Row */
.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}

.spec-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-label {
  font-size: 11px;
  color: var(--text-muted);
}

.custom-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  outline: none;
}

/* Prompt Preview Wrap */
.prompt-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.korean-desc-bar {
  font-size: 12px;
  color: #ff6b9d;
  font-weight: 600;
  line-height: 1.4;
}

#videoPromptInput {
  background: transparent;
  border: none;
  color: #ddd;
  font-size: 11.5px;
  font-family: monospace;
  resize: vertical;
  outline: none;
  line-height: 1.4;
}

.prompt-meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-tag {
  font-size: 11px;
  color: #00f0ff;
}

.btn-copy-sm {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-sm:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Main Generate Button */
.generate-actions {
  margin-top: 4px;
}

.btn-generate-main {
  width: 100%;
  background: linear-gradient(90deg, #ff2a70, #7928ca);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-generate-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-generate-main .btn-title {
  font-size: 15px;
  font-weight: 700;
}

.btn-generate-main .btn-cost {
  font-size: 12px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
  color: #00f0ff;
  font-family: var(--font-display);
}

/* Right Result Panel & Stage */
.result-panel {
  display: flex;
  flex-direction: column;
}

.stage-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 600px;
  position: relative;
}

/* Stage Placeholder */
.stage-placeholder {
  text-align: center;
  max-width: 480px;
}

.halo-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 42, 112, 0.2), rgba(121, 40, 202, 0.2));
  border: 1px solid rgba(255, 42, 112, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
  box-shadow: 0 0 30px rgba(255, 42, 112, 0.2);
}

.stage-placeholder h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #fff;
}

.stage-placeholder p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.quick-feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-feature-tags span {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: #ddd;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Stage Loading */
.stage-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 420px;
}

.loader-spinner {
  width: 54px;
  height: 54px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-pink);
  border-right-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.stage-loading h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.stage-loading p {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-bar-wrap {
  width: 280px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, #ff2a70, #00f0ff);
  animation: progressAnim 2.5s ease-in-out infinite;
}

@keyframes progressAnim {
  0% { width: 10%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 30%; margin-left: 70%; }
}

.loading-model-info {
  font-size: 11px;
  color: #00f0ff;
  font-family: var(--font-display);
}

/* Video Player Stage */
.video-player-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.video-media-box {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 30px var(--primary-glow);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.video-media-box.landscape {
  aspect-ratio: 16 / 9;
  max-width: 720px;
}

.video-media-box.square {
  aspect-ratio: 1 / 1;
  max-width: 560px;
}

#mainVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-overlay-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff2a70;
  box-shadow: 0 0 6px #ff2a70;
}

/* Video Controls Bar */
.video-controls-bar {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ctrl {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.18);
}

.speed-selector {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.btn-speed {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-speed.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: #fff;
}

.btn-download {
  background: linear-gradient(90deg, #ff2a70, #7928ca);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-block;
}

.btn-download:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Video Details Card */
.video-details-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.status-success {
  font-size: 11px;
  color: #00ff88;
  font-weight: 700;
  display: block;
}

.det-title h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.det-cost-badge {
  text-align: right;
}

.det-usd {
  font-size: 15px;
  font-weight: 800;
  color: #00f0ff;
  font-family: var(--font-display);
}

.det-krw {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.det-col {
  display: flex;
  flex-direction: column;
}

.det-col .k {
  font-size: 10px;
  color: var(--text-muted);
}

.det-col .v {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.details-prompt-box {
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 12px;
  border-radius: 6px;
}

.det-prompt-title {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#detPromptText {
  font-size: 11px;
  color: #ccc;
  font-family: monospace;
  line-height: 1.3;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .control-panel {
    max-height: none;
  }
}
