﻿/* public/style.css */
:root {
  --bg-main: #0c0d14;
  --bg-surface: #141622;
  --bg-surface-elevated: #1d2033;
  --bg-card: rgba(22, 25, 41, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 105, 180, 0.5);

  --accent-pink: #ff3385;
  --accent-purple: #9b51e0;
  --accent-gradient: linear-gradient(135deg, #ff3385 0%, #b829ea 100%);
  --accent-glow: rgba(255, 51, 133, 0.35);

  --text-main: #f0f2ff;
  --text-muted: #8e95b3;
  --text-dim: #5c6280;
  --text-green: #00e5a3;
  --text-accent: #ff4fa0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(255, 51, 133, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(255, 51, 133, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(155, 81, 224, 0.08) 0%, transparent 40%);
}

/* Top Navigation */
.top-nav {
  height: 70px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(12, 13, 20, 0.8);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.sparkle {
  font-size: 22px;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #ff7bb5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cost-summary-pill {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 6px 16px;
  gap: 12px;
}

.pill-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pill-item .label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.val-highlight {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-green);
}

.val-highlight small {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: normal;
}

.val-credits {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-accent);
}

.pill-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
}

.dot.online {
  background: var(--text-green);
  box-shadow: 0 0 8px var(--text-green);
}

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* Left Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;
}

.panel-card:focus-within {
  border-color: rgba(255, 51, 133, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-with-icon .icon {
  font-size: 1.2rem;
}

.title-with-icon h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.badge-mini {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 51, 133, 0.15);
  color: var(--accent-pink);
  border: 1px solid rgba(255, 51, 133, 0.3);
}

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

/* Form Controls */
.form-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.form-select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.form-select:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 2px rgba(255, 51, 133, 0.2);
}

/* Model Info Box */
.model-info-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.model-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.model-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-cell {
  background: var(--bg-surface);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.cell-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.cell-val {
  font-size: 0.82rem;
  font-weight: 700;
}

.text-green { color: var(--text-green); }
.text-accent { color: var(--text-accent); }

/* Preset Chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-main);
  transform: translateY(-1px);
}

.chip.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 51, 133, 0.3);
}

/* Detail Tags */
.detail-tags-group {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 14px;
}

.group-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.tags-section {
  margin-bottom: 10px;
}

.tag-cat {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: inline-block;
  margin-bottom: 4px;
  font-weight: 500;
}

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tag-btn.active {
  background: rgba(255, 51, 133, 0.2);
  border-color: var(--accent-pink);
  color: #ff94c2;
  font-weight: 600;
}

/* Prompt Box */
.prompt-box-wrapper textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.prompt-box-wrapper textarea:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 2px rgba(255, 51, 133, 0.2);
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.76rem;
  cursor: pointer;
  transition: color 0.15s;
}

.btn-text-action:hover {
  color: var(--accent-pink);
}

.btn-text-action.danger:hover {
  color: #ff4757;
}

/* Accordion */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.accordion-header:hover {
  color: var(--text-main);
}

.accordion-body {
  margin-top: 8px;
}

.accordion-body.hidden {
  display: none;
}

.accordion-body textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  outline: none;
  font-family: inherit;
}

/* Aspect Ratio Selector */
.ratio-selector {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.ratio-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.ratio-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-main);
}

.ratio-btn.active {
  background: rgba(255, 51, 133, 0.12);
  border-color: var(--accent-pink);
  color: #fff;
}

.ratio-box {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.ratio-btn.active .ratio-box {
  background: var(--accent-pink);
}

.r-1-1 { width: 18px; height: 18px; }
.r-9-16 { width: 14px; height: 24px; }
.r-3-4 { width: 16px; height: 21px; }
.r-16-9 { width: 24px; height: 14px; }
.r-4-3 { width: 21px; height: 16px; }

.ratio-txt {
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
}

.ratio-txt small {
  font-size: 0.64rem;
  color: var(--text-dim);
}

/* Option Row Split */
.option-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.option-field label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.seed-input-group {
  display: flex;
  gap: 6px;
}

.seed-input-group input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.btn-icon-sub {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-icon-sub:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Action Button */
.action-btn-area {
  margin-top: 20px;
}

.btn-generate {
  width: 100%;
  position: relative;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(255, 51, 133, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 51, 133, 0.6);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.btn-icon {
  font-size: 1.3rem;
}

.btn-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-cost-tag {
  font-size: 0.76rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  color: #ffdeeb;
}

/* Right Result Panel */
.result-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.preview-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  box-shadow: var(--shadow-card);
}

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

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.indicator.live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-pink);
  box-shadow: 0 0 10px var(--accent-pink);
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.btn-preview-action {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preview-action:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-preview-action.primary {
  background: var(--accent-pink);
  border-color: transparent;
  color: #fff;
}

.btn-preview-action.primary:hover {
  background: #ff1974;
}

/* Canvas Container */
.preview-canvas-container {
  flex: 1;
  background: #08090f;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 440px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  max-width: 420px;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 50%, #ff85b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.model-quick-tips {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tip-badge {
  color: #ffd166;
  font-weight: 700;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-state.hidden {
  display: none;
}

.spinner-core {
  position: relative;
  width: 70px;
  height: 70px;
}

.ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
}

.ring.r1 {
  border-top-color: var(--accent-pink);
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.ring.r2 {
  border-right-color: var(--accent-purple);
  animation: spin 1.6s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

.ring.r3 {
  border-bottom-color: var(--text-green);
  animation: spin 2s linear infinite;
}

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

.loading-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.loading-model-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timer-badge {
  font-family: monospace;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 12px;
  border-radius: 12px;
  color: var(--accent-pink);
  font-weight: 700;
}

/* Image View State */
.image-view-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: zoom-in;
}

.image-view-wrapper.hidden {
  display: none;
}

.image-view-wrapper img {
  max-width: 100%;
  max-height: 580px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  transition: transform 0.2s;
}

.image-view-wrapper img:hover {
  transform: scale(1.01);
}

.image-overlay-info {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-model {
  font-weight: 700;
  color: var(--accent-pink);
}

.info-meta {
  color: var(--text-muted);
}

/* History Gallery */
.gallery-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.gallery-count {
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-pink);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-modal.hidden {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.lightbox-content {
  position: relative;
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0,0,0,0.9);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}
