/* ===== 기본 설정 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #c9a96e;
  --primary-dark: #a8854d;
  --bg: #0e0e0e;
  --bg-card: #161616;
  --bg-input: #1e1e1e;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #e8d5b0;
  --radius: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== 헤더 ===== */
header {
  background: linear-gradient(135deg, #0e0e0e 0%, #1a1510 50%, #0e0e0e 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

/* ===== 메인 ===== */
main { padding: 3rem 1.5rem 4rem; }

.intro {
  text-align: center;
  margin-bottom: 3rem;
}

.intro h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.intro p {
  color: var(--text-muted);
  font-size: 1rem;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ===== 무료 배너 ===== */
.free-banner {
  background: rgba(201, 169, 110, 0.1);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
  color: var(--primary);
  text-align: center;
}

.free-banner--ended {
  background: rgba(229, 62, 62, 0.08);
  border-color: #e53e3e;
  color: #fc8181;
}

/* ===== 날씨 카드 ===== */
.weather-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.weather-loading, .weather-error {
  color: var(--text-muted);
}

.weather-info {
  align-items: center;
  gap: 0.8rem;
}

.weather-icon { font-size: 1.8rem; }

.weather-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.weather-temp {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.weather-desc { color: var(--text-muted); font-size: 0.85rem; }

.weather-location {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.api-key-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.api-key-section label {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.api-key-input-wrap {
  display: flex;
  gap: 0.5rem;
}

.api-key-input-wrap input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.api-key-input-wrap input:focus { border-color: var(--primary); }

.api-key-input-wrap button {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.api-key-input-wrap button:hover { background: var(--primary-dark); }

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

/* ===== 폼 ===== */
#styleForm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.optional { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.8rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input,
.form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--primary); }

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ===== 스타일 태그 ===== */
.style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag-label:hover { border-color: var(--primary); color: var(--primary); }

.tag-label input[type="checkbox"] {
  display: none;
}

.tag-label::before {
  content: '';
  display: none;
  font-size: 0.8rem;
}

.tag-label:has(input:checked) {
  background: rgba(201, 169, 110, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.tag-label:has(input:checked)::before {
  content: '✓';
  display: inline;
  font-weight: 700;
}

/* ===== 업로드 영역 ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 140px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(201, 169, 110, 0.04);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 0.4rem;
}

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

.upload-placeholder p { color: var(--text); font-size: 0.95rem; }
.upload-placeholder span { color: var(--text-muted); font-size: 0.8rem; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}

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

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.preview-item .remove-btn:hover { background: #e53e3e; }

/* ===== 제출 버튼 ===== */
.submit-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.03em;
  width: 100%;
}

.submit-btn:hover { opacity: 0.9; }
.submit-btn:active { transform: scale(0.99); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 로딩 ===== */
.loading {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

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

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

.loading p { color: var(--text); font-size: 1rem; }
.loading span { color: var(--text-muted); font-size: 0.85rem; }

/* ===== 결과 섹션 ===== */
.result-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-header {
  background: linear-gradient(135deg, #1a1510, #0e0e0e);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.result-header h2 {
  font-size: 1.3rem;
  color: var(--accent);
}

.result-content {
  padding: 2rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}

/* 마크다운 스타일 */
.result-content h1, .result-content h2, .result-content h3 {
  color: var(--primary);
  margin: 1.2rem 0 0.5rem;
}

.result-content h1 { font-size: 1.3rem; }
.result-content h2 { font-size: 1.15rem; }
.result-content h3 { font-size: 1rem; }

.result-content p { margin-bottom: 0.8rem; }

.result-content ul, .result-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}

.result-content li { margin-bottom: 0.3rem; }

.result-content strong { color: var(--accent); }

.result-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2rem 0;
}

.result-content .outfit-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.retry-btn {
  display: block;
  width: calc(100% - 4rem);
  margin: 0 2rem 2rem;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.retry-btn:hover {
  background: rgba(201, 169, 110, 0.1);
}

/* ===== 토스트 ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  font-size: 0.85rem;
  z-index: 1000;
  animation: fadeInUp 0.3s ease;
  max-width: 300px;
}

.toast.success { border-color: #48bb78; color: #48bb78; }
.toast.error { border-color: #e53e3e; color: #fc8181; }

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

/* ===== 제휴 문의 ===== */
.contact-section {
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--border);
}

.contact-section .container {
  max-width: 700px;
}

.contact-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.contact-form textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.contact-submit-btn {
  margin-top: 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 2rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.contact-submit-btn:hover { opacity: 0.85; }

/* ===== 댓글 ===== */
.comments-section {
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--border);
}

.comments-section .container {
  max-width: 700px;
}

#disqus_thread {
  margin-top: 1.5rem;
}

/* ===== 푸터 ===== */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* ===== 반응형 ===== */
@media (max-width: 600px) {
  .intro h1 { font-size: 1.4rem; }
  .form-grid { grid-template-columns: 1fr; }
  #styleForm { padding: 1.2rem; }
  .result-content { padding: 1.2rem; }
  .retry-btn { width: calc(100% - 2.4rem); margin: 0 1.2rem 1.5rem; }
}
