/* ShopShot AI - 디자인 시스템 */

:root {
  --ss-primary: #7C3AED;
  --ss-primary-light: #EDE9FE;
  --ss-bg: #F8F7FF;
  --ss-text: #1E1B4B;
  --ss-text-secondary: #6B7280;
  --ss-success: #22C55E;
  --ss-warning: #F59E0B;
  --ss-danger: #EF4444;
  --ss-placeholder: #9CA3AF;
  --ss-card-radius: 12px;
  --ss-card-padding: 16px;
  --ss-white: #FFFFFF;
}

/* 전역 스타일 */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--ss-text);
  background-color: var(--ss-bg);
  margin: 0; padding: 0;
}

/* 앱 컨테이너 (모바일 퍼스트) */
.ss-container {
  max-width: 480px; margin: 0 auto;
  min-height: 100vh; background: var(--ss-white);
  position: relative;
}

/* 타이포그래피 */
h1, .ss-h1 { font-size: 24px; font-weight: 700; color: var(--ss-text); }
h2, .ss-h2 { font-size: 18px; font-weight: 600; color: var(--ss-text); }
.ss-body { font-size: 14px; font-weight: 400; }
.ss-caption { font-size: 12px; color: var(--ss-text-secondary); }

/* 버튼 */
.btn-ss-primary {
  background-color: var(--ss-primary); color: var(--ss-white);
  border: none; border-radius: 12px; padding: 14px 24px;
  font-size: 16px; font-weight: 600; width: 100%;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-ss-primary:hover { opacity: 0.9; color: var(--ss-white); }
.btn-ss-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ss-secondary {
  background-color: var(--ss-white); color: var(--ss-primary);
  border: 1px solid var(--ss-primary); border-radius: 12px;
  padding: 14px 24px; font-size: 16px; font-weight: 600; width: 100%;
}

.btn-ss-danger {
  background-color: var(--ss-danger); color: var(--ss-white);
  border: none; border-radius: 12px; padding: 14px 24px;
  font-size: 16px; font-weight: 600; width: 100%;
}

/* 뱃지 */
.badge-ss-success { background: #DCFCE7; color: #15803D; padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.badge-ss-warning { background: #FEF3C7; color: #B45309; padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.badge-ss-danger { background: #FEE2E2; color: #B91C1C; padding: 4px 8px; border-radius: 6px; font-size: 12px; }

/* 카드 */
.ss-card {
  background: var(--ss-white); border-radius: var(--ss-card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: var(--ss-card-padding);
}

/* 입력 필드 */
.ss-input {
  width: 100%; padding: 14px 16px; border: 1px solid #E5E7EB;
  border-radius: 12px; font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.ss-input:focus { border-color: var(--ss-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.ss-input::placeholder { color: var(--ss-placeholder); }

/* 헤더 */
.ss-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; height: 56px; background: var(--ss-white);
  border-bottom: 1px solid #F3F4F6; position: sticky; top: 0; z-index: 100;
}
.ss-header-logo { font-size: 18px; font-weight: 700; color: var(--ss-primary); }
.ss-header-icons { display: flex; gap: 16px; }
.ss-header-icons a { color: var(--ss-text-secondary); font-size: 20px; text-decoration: none; }
.ss-header-icons a.active { color: var(--ss-primary); }

/* 스텝 인디케이터 */
.ss-steps {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 20px; gap: 0; background: var(--ss-white);
  border-bottom: 1px solid #F3F4F6;
}
.ss-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ss-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: #E5E7EB; color: var(--ss-text-secondary);
}
.ss-step.active .ss-step-dot { background: var(--ss-primary); color: var(--ss-white); }
.ss-step.completed .ss-step-dot { background: var(--ss-success); color: var(--ss-white); }
.ss-step-label { font-size: 12px; color: var(--ss-text-secondary); }
.ss-step.active .ss-step-label { color: var(--ss-primary); font-weight: 600; }
.ss-step.completed .ss-step-label { color: var(--ss-success); }
.ss-step-line { width: 40px; height: 2px; background: #E5E7EB; margin: 0 8px; margin-bottom: 18px; }
.ss-step.completed + .ss-step-line,
.ss-step-line.completed { background: var(--ss-success); }

/* 하단 탭바 */
.ss-bottom-tab {
  display: flex; justify-content: space-around; align-items: center;
  height: 60px; background: var(--ss-white);
  border-top: 1px solid #F3F4F6;
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 100;
}
.ss-tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--ss-text-secondary); font-size: 11px;
}
.ss-tab-item i { font-size: 20px; }
.ss-tab-item.active { color: var(--ss-primary); }

/* 콘텐츠 영역 (하단탭 고려 패딩) */
.ss-content { padding: 20px; padding-bottom: 80px; }

/* 드롭존 커스텀 */
.ss-dropzone {
  border: 2px dashed #D1D5DB; border-radius: 16px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: border-color 0.2s;
  background: var(--ss-bg);
}
.ss-dropzone:hover, .ss-dropzone.dz-drag-hover { border-color: var(--ss-primary); background: var(--ss-primary-light); }
.ss-dropzone i { font-size: 36px; color: var(--ss-text-secondary); margin-bottom: 12px; }
.ss-dropzone .dz-message { margin: 0; }

/* 이미지 카드 (갤러리용) */
.ss-image-card {
  background: var(--ss-white); border-radius: var(--ss-card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden;
}
.ss-image-card img { width: 100%; height: 110px; object-fit: cover; }
.ss-image-card-bottom {
  padding: 8px 12px; display: flex; justify-content: space-between; align-items: center;
}
.ss-image-card-name { font-size: 12px; font-weight: 600; color: var(--ss-text); }
.ss-image-card-btns { display: flex; gap: 8px; }
.ss-image-card-btns a { color: var(--ss-text-secondary); font-size: 16px; cursor: pointer; }
.ss-image-card-btns a:hover { color: var(--ss-primary); }

/* 히스토리 아이템 */
.ss-history-item {
  display: flex; align-items: center; padding: 16px; gap: 12px;
  border-bottom: 1px solid #F3F4F6;
}
.ss-history-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #E5E7EB; }
.ss-history-info { flex: 1; }
.ss-history-date { font-size: 12px; color: var(--ss-text-secondary); }
.ss-history-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* 프로그레스 바 커스텀 */
.ss-progress { height: 8px; border-radius: 4px; background: #E5E7EB; overflow: hidden; }
.ss-progress-fill { height: 100%; border-radius: 4px; background: var(--ss-primary); transition: width 0.3s ease; }

/* 토글 스위치 */
.ss-toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.ss-toggle input { opacity: 0; width: 0; height: 0; }
.ss-toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #D1D5DB; transition: 0.3s; border-radius: 26px;
}
.ss-toggle-slider:before {
  position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background-color: white; transition: 0.3s; border-radius: 50%;
}
.ss-toggle input:checked + .ss-toggle-slider { background-color: var(--ss-primary); }
.ss-toggle input:checked + .ss-toggle-slider:before { transform: translateX(22px); }

/* 보안 안내 카드 */
.ss-security-card {
  background: var(--ss-primary-light); border-radius: 12px; padding: 12px 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.ss-security-card i { color: var(--ss-primary); margin-top: 2px; }
.ss-security-card p { margin: 0; font-size: 12px; color: var(--ss-text-secondary); line-height: 1.5; }

/* 히스토리 진행 상태 */
.ss-history-item.is-active {
  flex-direction: column; align-items: stretch; gap: 0;
  background: var(--ss-white); cursor: default;
}
.ss-history-item.is-active .ss-history-top {
  display: flex; align-items: center; gap: 12px;
}
.ss-history-progress {
  margin-top: 12px;
}
.ss-history-progress .ss-progress { margin-bottom: 8px; }
.ss-history-progress-info {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.ss-history-progress-msg {
  font-size: 13px; font-weight: 600; color: var(--ss-primary);
}
.ss-history-progress-count {
  font-size: 12px; color: var(--ss-text-secondary);
}
.ss-history-mini-gallery {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 8px;
}
.ss-history-mini-gallery .mini-thumb {
  width: 100%; aspect-ratio: 1; border-radius: 6px; object-fit: cover;
}
.ss-history-mini-gallery .mini-placeholder {
  width: 100%; aspect-ratio: 1; border-radius: 6px; background: #F3F4F6;
  display: flex; align-items: center; justify-content: center;
}
.ss-history-mini-gallery .mini-placeholder.is-processing {
  background: var(--ss-primary-light);
}
.ss-history-mini-gallery .mini-placeholder i { font-size: 10px; }
.ss-history-steps {
  margin-top: 8px;
}
.ss-history-step {
  display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px;
}
.ss-history-step .step-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.ss-history-step .step-dot.done { background: var(--ss-success); }
.ss-history-step .step-dot.active { background: var(--ss-primary); animation: pulse 1s infinite; }
.ss-history-step .step-dot.pending { background: #D1D5DB; }
.ss-history-step .step-text { color: var(--ss-text-secondary); }
.ss-history-step .step-text.active { color: var(--ss-primary); font-weight: 600; }

.badge-ss-processing {
  background: var(--ss-primary-light); color: var(--ss-primary);
  padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 이미지 풀스크린 뷰어 */
.ss-viewer {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.95); flex-direction: column;
}
.ss-viewer.is-open { display: flex; }
.ss-viewer-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden; padding: 16px;
}
.ss-viewer-caption {
  font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 12px;
}
.ss-viewer-body img {
  max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; border-radius: 8px;
  user-select: none; -webkit-user-drag: none;
}
.ss-viewer-counter {
  font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 10px;
}
.ss-viewer-toolbar {
  display: flex; gap: 10px; padding: 12px 16px;
  flex-shrink: 0; background: rgba(0,0,0,0.6);
}
.ss-viewer-tbtn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 0; border: 1px solid rgba(255,255,255,0.25); border-radius: 10px;
  background: rgba(255,255,255,0.1); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.ss-viewer-tbtn:active { background: rgba(255,255,255,0.25); }
.ss-viewer-tbtn:disabled { opacity: 0.3; pointer-events: none; }
.ss-viewer-tbtn-close { border-color: rgba(239,68,68,0.5); color: #FCA5A5; }
.ss-viewer-tbtn-close:active { background: rgba(239,68,68,0.2); }

/* 히스토리 삭제 버튼 */
.ss-btn-delete {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: #D1D5DB; font-size: 14px; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.ss-btn-delete:hover { color: #EF4444; background: #FEE2E2; }
.ss-btn-delete:active { color: #B91C1C; background: #FECACA; }

/* 반응형 */
@media (min-width: 481px) {
  body { background-color: #E5E7EB; }
  .ss-container { box-shadow: 0 0 20px rgba(0,0,0,0.1); }
}
