/* app/static/css/app.css — 디자인 토큰 + 전체 스타일 */

/* ─── 폰트 임포트 ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

/* ─── 디자인 토큰 (CSS 변수) ─────────────────── */
:root {
  --color-bg:          #f8fafc;
  --color-surface:     #ffffff;
  --color-surface-2:   #f1f5f9;
  --color-border:      #e2e8f0;
  --color-text:        #0f172a;
  --color-text-muted:  #64748b;
  --color-accent:      #2563eb;
  --color-accent-hover:#1d4ed8;
  --color-success:     #16a34a;
  --color-warning:     #d97706;
  --color-danger:      #dc2626;
  --color-info:        #0284c7;

  /* 상태 배지 색상 */
  --badge-registered:  #d97706;
  --badge-kt4-filled:  #0284c7;
  --badge-done:        #16a34a;
  --badge-requested:   #7c3aed;
  --badge-fbk-worked:  #0284c7;
  --badge-secured:     #16a34a;

  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 4px 12px rgba(0,0,0,0.05);
  --transition: 0.18s ease;
}

/* ─── 리셋 & 기본 ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

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

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

/* ─── 레이아웃 ───────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ─── 네비게이션 바 ──────────────────────────── */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.navbar__brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.navbar__links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex: 1;
}

.navbar__links a {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.navbar__links a:hover,
.navbar__links a.active {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.navbar__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.navbar__badge-role {
  background: var(--color-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ─── 메인 콘텐츠 ────────────────────────────── */
.main-content { padding: 32px 24px; max-width: 1200px; margin: 0 auto; }

/* ─── Flash 메시지 ───────────────────────────── */
.flash-messages { padding: 12px 24px 0; max-width: 1200px; margin: 0 auto; }

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.9rem;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.flash--success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.flash--danger  { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.flash--warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.flash--info    { background: rgba(56,189,248,0.15); border: 1px solid rgba(56,189,248,0.3); color: #38bdf8; }

/* ─── 카드 ───────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ─── 버튼 ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
}

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

.btn--primary  { background: var(--color-accent);   color: #fff; }
.btn--primary:hover { background: var(--color-accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,127,255,0.4); }

.btn--success  { background: var(--color-success);  color: #fff; }
.btn--success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn--danger   { background: var(--color-danger);   color: #fff; }
.btn--danger:hover  { filter: brightness(1.1); transform: translateY(-1px); }

.btn--warning  { background: var(--color-warning);  color: #000; }
.btn--warning:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn--outline  { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-muted); }
.btn--outline:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn--sm { padding: 5px 12px; font-size: 0.8rem; }
.btn--lg { padding: 11px 24px; font-size: 1rem; }

/* ─── 폼 요소 ────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(91,127,255,0.2);
}
.form-control::placeholder { color: var(--color-text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ─── 테이블 ──────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--color-surface-2); }
thead th { padding: 12px 16px; text-align: center; color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--color-border); transition: background var(--transition); }
tbody tr:hover { background: var(--color-surface-2); }
tbody td { padding: 12px 16px; text-align: center; vertical-align: middle; }

/* ─── 상태 배지 ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--registered { background: rgba(245,158,11,0.15); color: var(--badge-registered); border: 1px solid rgba(245,158,11,0.3); }
.badge--kt4-filled { background: rgba(56,189,248,0.15); color: var(--badge-kt4-filled); border: 1px solid rgba(56,189,248,0.3); }
.badge--done       { background: rgba(34,197,94,0.15);  color: var(--badge-done);       border: 1px solid rgba(34,197,94,0.3); }
.badge--requested  { background: rgba(167,139,250,0.15);color: var(--badge-requested);  border: 1px solid rgba(167,139,250,0.3); }
.badge--fbk-worked { background: rgba(56,189,248,0.15); color: var(--badge-fbk-worked); border: 1px solid rgba(56,189,248,0.3); }
.badge--secured    { background: rgba(34,197,94,0.15);  color: var(--badge-secured);    border: 1px solid rgba(34,197,94,0.3); }

/* ─── 칸반 보드 ──────────────────────────────── */
.kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kanban-col { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px; }
.kanban-col__title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); margin-bottom: 12px; }
.kanban-card { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; cursor: pointer; transition: all var(--transition); }
.kanban-card:hover { border-color: var(--color-accent); transform: translateY(-2px); box-shadow: var(--shadow); }

/* ─── 이미지 갤러리 / 라이트박스 ─────────────── */
.gallery { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery__item { width: 120px; height: 120px; border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; border: 2px solid var(--color-border); transition: border-color var(--transition); }
.gallery__item:hover { border-color: var(--color-accent); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-lg); box-shadow: 0 0 60px rgba(0,0,0,0.8); }
.lightbox__close { position: absolute; top: 20px; right: 24px; font-size: 2rem; color: #fff; cursor: pointer; line-height: 1; }

/* ─── 이력 타임라인 ──────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--color-border); }
.timeline__item { position: relative; padding: 0 0 20px 20px; }
.timeline__item::before { content: ''; position: absolute; left: -9px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-surface); }
.timeline__time { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 4px; }
.timeline__action { font-weight: 600; font-size: 0.9rem; }
.timeline__memo { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 4px; }

/* ─── 페이지 헤더 ────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { font-size: 0.9rem; color: var(--color-text-muted); margin-top: 4px; }

/* ─── 대시보드 통계 카드 ──────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px; }
.stat-card__num { font-size: 2.2rem; font-weight: 700; color: var(--color-accent); line-height: 1; }
.stat-card__label { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 6px; }

/* ─── 필터 바 ────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input[type="date"] {
  padding: 7px 12px; background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius); color: var(--color-text); font-family: inherit; font-size: 0.875rem;
}

/* ─── 반려 사유 알림 ─────────────────────────── */
.reject-alert {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #fca5a5;
  margin-bottom: 20px;
  font-size: 0.875rem;
}
.reject-alert strong { display: block; margin-bottom: 4px; }

/* ─── 모달 (반려 사유 입력) ───────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; animation: fadeIn 0.15s ease;
}
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 28px; width: 420px; max-width: 95vw; }
.modal__title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }

/* ─── 뷰 전환 탭 ────────────────────────────── */
.view-toggle { display: flex; gap: 4px; background: var(--color-surface-2); padding: 4px; border-radius: var(--radius); }
.view-toggle button {
  padding: 5px 14px; border: none; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; color: var(--color-text-muted);
  background: transparent; transition: all var(--transition);
}
.view-toggle button.active { background: var(--color-accent); color: #fff; }

/* ─── 섹션 구분선 ────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 24px 0; }

/* ─── 파일 입력 ──────────────────────────────── */
.file-input-wrapper { position: relative; }
.file-input-wrapper input[type="file"] {
  padding: 10px; background: var(--color-surface-2); border: 2px dashed var(--color-border);
  border-radius: var(--radius); color: var(--color-text-muted); cursor: pointer; width: 100%;
}
.file-input-wrapper input[type="file"]:hover { border-color: var(--color-accent); }

/* ─── 인증 페이지 ────────────────────────────── */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(91,127,255,0.12) 0%, transparent 70%);
}
.auth-card { width: 380px; max-width: 95vw; }
.auth-card__logo { text-align: center; margin-bottom: 28px; }
.auth-card__logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--color-accent); }
.auth-card__logo p  { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 4px; }

/* ─── 반응형 ─────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { gap: 12px; }
  .navbar__links { gap: 2px; }
  .kanban { grid-template-columns: 1fr; }
  .main-content { padding: 16px 12px; }
}
