/* ── 기본 변수 ──────────────────────────────────────────────────────────────── */
:root {
  --bg:     #0D0D0D;
  --bg2:    #1A1A1A;
  --bg3:    #252525;
  --gold:   #C9A565;
  --gold2:  #E8C98A;
  --white:  #F0F0F0;
  --gray:   #8C8C8C;
  --gray2:  #555;
  --radius: 6px;
  --font:   -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold2); }

/* ── 헤더 ───────────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.brand {
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--gold);
  font-weight: 500;
}

.site-header nav {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--gray);
}

.site-header nav a { color: var(--gray); }
.site-header nav a:hover { color: var(--white); }
.logout { color: var(--gray2) !important; font-size: 12px; }

/* ── 레이아웃 ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 22px; font-weight: 500; color: var(--white); }
.page-sub { color: var(--gray); font-size: 13px; margin-top: 6px; }
.hint { color: var(--gray); font-size: 12px; font-weight: 400; }

/* ── 로그인 ─────────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 340px;
  padding: 48px 36px;
  background: var(--bg2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  text-align: center;
}

.login-brand {
  font-size: 18px;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--gray);
  margin-bottom: 36px;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--white);
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s;
}

.login-card input[type="password"]:focus { border-color: var(--gold); }

.error-msg {
  background: #2a1515;
  border: 1px solid #5a2020;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #e88;
  margin-bottom: 16px;
}

/* ── 폼 공통 ────────────────────────────────────────────────────────────────── */
.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field-row label {
  font-size: 13px;
  color: var(--gray);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

input[type="text"], input[type="password"], textarea, select {
  background: var(--bg3);
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
  -webkit-appearance: none;
}

input:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }

/* ── 버튼 ───────────────────────────────────────────────────────────────────── */
.btn-primary, button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  background: var(--gold);
  color: #0D0D0D;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background .2s;
  width: 100%;
}

.btn-primary:hover, button[type="submit"]:hover { background: var(--gold2); }
.btn-primary:disabled, button[type="submit"]:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  background: transparent;
  border: 1px solid #444;
  border-radius: var(--radius);
  color: var(--gray);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  width: 100%;
}

.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--gold);
  color: #0D0D0D;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  width: auto;
}

.btn-sm:hover { background: var(--gold2); color: #0D0D0D; }

.btn-sm-outline {
  background: transparent;
  border: 1px solid #444;
  color: var(--gray);
}

.btn-sm-outline:hover { border-color: var(--gold); color: var(--gold); background: transparent; }

/* ── 스타일 카드 ─────────────────────────────────────────────────────────────── */
.style-card {
  background: var(--bg2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

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

.style-num {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--gold);
}

.remove-style-btn {
  background: none;
  border: none;
  color: var(--gray2);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  width: auto;
  transition: color .2s;
}

.remove-style-btn:hover { color: #e88; background: none; }

/* ── 업로드 존 ───────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 1px dashed #444;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--gold);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-placeholder svg { color: var(--gray); margin-bottom: 8px; }
.upload-placeholder p { color: var(--gray); font-size: 14px; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.thumb-item {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #333;
  cursor: grab;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

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

.thumb-item.dragging { opacity: .4; }
.thumb-item.drag-target { outline: 2px solid var(--gold); }
.thumb-item.stored-thumb { opacity: .75; }
.thumb-item.stored-thumb::after {
  content: '기존';
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  background: rgba(0,0,0,.6);
  color: var(--gold);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ── 폼 액션 ────────────────────────────────────────────────────────────────── */
#add-style-btn { margin-bottom: 24px; }

.form-actions { margin-top: 8px; }

.btn-loading { display: none; }
.form-loading .btn-text { display: none; }
.form-loading .btn-loading { display: inline; }

/* ── 결과 ───────────────────────────────────────────────────────────────────── */
.result-card {
  background: var(--bg2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.result-styles { margin-bottom: 24px; }

.result-style-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #222;
}

.result-style-row:last-child { border-bottom: none; }

.result-style-num {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--gold);
  min-width: 24px;
  padding-top: 2px;
}

.result-style-name { font-weight: 500; color: var(--white); }
.result-style-desc { font-size: 13px; color: var(--gray); margin-top: 2px; }

.download-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-btn { font-size: 15px; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── 히스토리 ───────────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-card {
  background: var(--bg2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-meta { display: flex; gap: 12px; align-items: baseline; }
.history-date { font-size: 14px; font-weight: 500; color: var(--white); }
.history-time { font-size: 12px; color: var(--gray); }

.history-styles { font-size: 13px; color: var(--gray); }
.history-style-name { color: var(--gold); }

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state p { margin-bottom: 20px; }
.empty-state .btn-primary { width: auto; }

/* ── 모바일 ─────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 24px 16px 60px; }
  .style-card { padding: 18px 16px; }
  .result-card { padding: 20px 16px; }
  .site-header { padding: 14px 16px; }
  .site-header nav { gap: 14px; }
}

.error-banner {
  background: #2a1515;
  border: 1px solid #5a2020;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  color: #e88;
  margin-bottom: 20px;
}
