/* =============================================
   style.css — AppfitJoin 공통 스타일
   Tailwind CSS와 함께 사용 (커스텀 컴포넌트)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700&display=swap');

:root {
  --brand: #4F46E5;
  --brand-light: #818CF8;
  --brand-dark: #3730A3;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 32px rgba(79, 70, 229, .12);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── hidden 유틸 ── */
.hidden {
  display: none !important;
}

/* ── 로그인 섹션 ── */
#login-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
}

.login-box {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
}

.login-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.error-msg {
  color: var(--danger);
  font-size: .85rem;
  margin-top: 8px;
}

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, .4);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 1rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .82rem;
}

/* ── 앱 레이아웃 공통 ── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

.app-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.3px;
}

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

.user-badge {
  font-size: .85rem;
  color: var(--text-muted);
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── 진척도 바 ── */
.progress-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.progress-section h2 {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 100%);
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.progress-label {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── 제출 항목 카드 ── */
#submission-items {
  display: grid;
  gap: 16px;
}

.submission-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}

.submission-card:hover {
  border-color: var(--brand-light);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

.status-badge {
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}

.status-pending {
  background: #FEF3C7;
  color: #92400E;
}

.status-reviewing {
  background: #DBEAFE;
  color: #1E40AF;
}

.status-approved {
  background: #D1FAE5;
  color: #065F46;
}

.status-rejected {
  background: #FEE2E2;
  color: #991B1B;
}

.status-empty {
  background: #F1F5F9;
  color: #64748B;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-input {
  display: none;
}

.file-label {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.file-label:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #EEF2FF;
}

.current-file {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}

.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  transition: border-color .2s;
  outline: none;
}

.text-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}

.rejection-notice {
  font-size: .85rem;
  color: var(--danger);
  font-weight: 500;
  padding: 8px 12px;
  background: #FEF2F2;
  border-radius: var(--radius-sm);
}

/* ── 피드백 섹션 ── */
.feedback-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-top: 32px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-item {
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border-left: 3px solid var(--info);
}

.feedback-item.revision-required {
  border-left-color: var(--danger);
  background: #FEF9F9;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.feedback-label {
  font-weight: 700;
  font-size: .9rem;
}

.feedback-date {
  font-size: .8rem;
  color: var(--text-muted);
}

.badge-revision {
  font-size: .72rem;
  background: #FEE2E2;
  color: #991B1B;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.badge-ok {
  font-size: .72rem;
  background: #D1FAE5;
  color: #065F46;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.feedback-comment {
  font-size: .9rem;
  color: var(--text);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: .9rem;
}

/* ── 관리자 레이아웃 ── */
.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: stretch;
  /* 상단 헤더와 여백을 제외한 전체 높이 점유 */
  height: calc(100vh - 160px);
  min-height: 480px;
  overflow: hidden;
  /* 그리드 자체는 스크롤되지 않음 */
}

@media (max-width: 800px) {
  .admin-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
}

.client-list-panel,
.detail-panel-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.client-list-scroll {
  flex: 1;
  overflow-y: auto;
  /* 이 부분에서만 스크롤 발생 */
  min-height: 0;
  padding-bottom: 40px;
}

#detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  background: var(--surface-2);
  flex-shrink: 0;
  /* 헤더 고정 */
}

.client-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}

.client-card:hover {
  background: #F5F7FF;
}

.client-card.selected {
  background: #EEF2FF;
  border-left: 3px solid var(--brand);
}

.client-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.client-name {
  font-weight: 700;
  font-size: .95rem;
}

.client-email {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.progress-circle {
  text-align: center;
}

.progress-pct {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand);
}

.progress-mini-bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-mini-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width .4s;
}

.progress-mini-fill.complete {
  background: var(--success);
}

.client-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-muted);
}

.status-dot {
  font-weight: 600;
}

.dot-complete {
  color: var(--success);
}

.dot-pending {
  color: var(--warning);
}

/* ── 관리자 상세 카드 ── */
#detail-items {
  padding: 24px 24px 150px 24px;
  /* 마지막 항목 피드백 영역 공간 하단 여백 충분히 확보 */
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.detail-card {
  flex-shrink: 0;
  /* 카드가 스크롤 내부에서 찌그러지지 않게 함 */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.detail-card-header h4 {
  font-size: .9rem;
  font-weight: 700;
}

.status-select {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  background: var(--surface);
  cursor: pointer;
}

.detail-content {
  padding: 14px 16px;
}

.text-value-box {
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.empty-state-sm {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.feedback-section {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
}

.feedback-section h5 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.feedback-bubble {
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.feedback-meta {
  font-size: .75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

.feedback-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  cursor: pointer;
}

/* ── 토스트 알림 ── */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  transform: translateY(20px);
  opacity: 0;
  transition: all .3s;
  z-index: 9999;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-warning {
  background: var(--warning);
}

.toast-info {
  background: var(--info);
}

/* ── 기본정보 폼 스타일 ── */
.info-section-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.info-group-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid #EEF2FF;
}

.sub-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-col {
  display: flex;
  flex-direction: column;
}

.form-group-full {
  margin-bottom: 20px;
}

.info-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.info-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  transition: all 0.2s;
  outline: none;
}

.info-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.info-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.pos-kiosk-section {
  background: var(--surface-2);
  padding: 20px;
  border-radius: var(--radius);
  margin: 24px 0;
}

.checkbox-group {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.device-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.device-box {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.device-box h5 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--brand-dark);
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-group label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.file-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.file-name-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-label {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all 0.2s;
}

.radio-label:has(input:checked) {
  border-color: var(--brand);
  background: #EEF2FF;
}

.input-with-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.alert-info-sm {
  background: #EFF6FF;
  color: #1E40AF;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  border-left: 3px solid var(--info);
}

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.ml-4 { margin-left: 16px; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.opacity-50 { opacity: 0.5; }
.pointer-events-none { pointer-events: none; }

.cs-row {
  display: flex;
  align-items: center;
}

.form-actions-sticky {
  position: sticky;
  bottom: 0px;
  left: 0;
  right: 0;
  padding: 20px 0;
  background: linear-gradient(to top, var(--bg) 80%, transparent);
  z-index: 50;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
}

@media (max-width: 640px) {
  .form-row, .device-details {
    grid-template-columns: 1fr;
  }
}