/* ═══════════════════════════════════════════════════════
   FloorOS Design System — main.css
   Font: Pretendard (CDN)
   Color tokens: CSS variables, light/dark 지원
   ═══════════════════════════════════════════════════════ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ─── Color Tokens ─────────────────────────────────────── */
:root {
  /* Brand */
  --primary:       #4F7EFF;
  --primary-dark:  #3B67E8;
  --primary-light: #EEF3FF;

  /* Semantic */
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #06b6d4;

  /* Shift colors */
  --shift-day:    #4F7EFF;   /* 주간 */
  --shift-night:  #1e3a8a;   /* 야간 */
  --shift-off:    #6b7280;   /* 휴무 */
  --shift-annual: #22c55e;   /* 연차 */
  --shift-absent: #ef4444;   /* 결근 */

  /* Neutrals */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Surface */
  --bg:         #f5f6fa;
  --surface:    #ffffff;
  --border:     var(--gray-200);
  --text:       var(--gray-900);
  --text-muted: var(--gray-500);

  /* Layout */
  --nav-h:   56px;
  --side-w:  240px;
  --radius:  10px;
  --radius-sm: 6px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0f1117;
    --surface:    #1c1f26;
    --border:     #2d3340;
    --text:       #e9eaf0;
    --text-muted: #8892a4;
    --gray-100:   #1c1f26;
    --gray-200:   #2d3340;
    --primary-light: #1e2d4f;
  }
}

/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ─── Layout ───────────────────────────────────────────── */
.app-wrap {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

.page-content {
  flex: 1;
  padding: 24px 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Top Nav ──────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.nav-logo span { color: var(--text); }

.nav-menu {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: .875rem;
  font-weight: 600;
  display: none;
}
@media (min-width: 640px) { .user-name { display: block; } }

.nav-logout {
  font-size: .8rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.nav-logout:hover { color: var(--danger); border-color: var(--danger); text-decoration: none; }

/* ─── Page Header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

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

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

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:hover { opacity: .9; text-decoration: none; }
.btn:active { opacity: .8; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); opacity: 1; }

.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn svg { width: 16px; height: 16px; }

/* ─── Badge ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--surface);
}

.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }

/* ─── Form ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,126,255,.15);
}

.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: 4px; }

.form-row {
  display: grid;
  gap: 16px;
}
@media (min-width: 640px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ─── Alert ─────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #22c55e; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info    { background: #cffafe; color: #164e63; border-left: 4px solid #06b6d4; }

/* ─── Stats Grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Schedule Grid ─────────────────────────────────────── */
.schedule-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.schedule-table {
  border-collapse: collapse;
  font-size: .8rem;
  min-width: 800px;
  width: 100%;
}

.schedule-table th, .schedule-table td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0;
}

.schedule-table th {
  background: var(--gray-50);
  font-weight: 700;
  font-size: .75rem;
  color: var(--text-muted);
  padding: 6px 4px;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.schedule-table th.name-col {
  min-width: 80px;
  position: sticky;
  left: 0;
  z-index: 3;
}

.schedule-table td.name-cell {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  font-weight: 600;
  padding: 8px 10px;
  white-space: nowrap;
}

.shift-cell {
  width: 36px;
  height: 40px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
  -webkit-user-select: none;
}

.shift-cell:hover { background: var(--primary-light); }

.shift-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
}

.shift-D { background: var(--shift-day); }
.shift-N { background: var(--shift-night); }
.shift-O { background: var(--shift-off); }
.shift-A { background: var(--shift-annual); }
.shift-X { background: var(--shift-absent); }

.date-weekend { background: #fff9f0; }
.date-today th { color: var(--primary); }

/* ─── Calendar ──────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.cal-header {
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  padding: 6px 0;
  color: var(--text-muted);
}
.cal-header.sun { color: var(--danger); }
.cal-header.sat { color: var(--primary); }

.cal-day {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  font-size: .85rem;
  font-weight: 600;
  background: var(--surface);
  user-select: none;
  -webkit-user-select: none;
}

.cal-day:hover { border-color: var(--primary); background: var(--primary-light); }
.cal-day.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.cal-day.empty { visibility: hidden; }
.cal-day.past { opacity: .4; cursor: not-allowed; }
.cal-day.today { border-color: var(--primary); font-weight: 800; }
.cal-day.sunday { color: var(--danger); }
.cal-day.saturday { color: var(--primary-dark); }

/* ─── Checklist ─────────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.check-toggle {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}

.check-toggle.done {
  background: var(--success);
  border-color: var(--success);
}

.check-toggle svg { display: none; }
.check-toggle.done svg { display: block; }

.check-label {
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.4;
}

.check-label.done-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

.progress-bar-wrap {
  height: 8px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 99px;
  transition: width .3s ease;
}

/* ─── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 9px 16px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── Utilities ─────────────────────────────────────────── */
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ─── Landing Page ──────────────────────────────────────── */
.landing-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f0f4ff 0%, #fafafa 100%);
}

.hero-logo {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -2px;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  line-height: 1.4;
}

.hero-sub {
  font-size: 1rem;
  color: var(--gray-500);
  margin-bottom: 36px;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.features-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 48px auto;
  max-width: 900px;
  padding: 0 20px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Pricing */
.pricing-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.price-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.price-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,126,255,.12);
}

.price-plan { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.price-amount { font-size: 2.5rem; font-weight: 900; color: var(--primary); }
.price-period { font-size: .875rem; color: var(--text-muted); }
.price-features { list-style: none; margin: 16px 0; text-align: left; }
.price-features li { padding: 5px 0; font-size: .875rem; }
.price-features li::before { content: '✓ '; color: var(--success); font-weight: 700; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

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

.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; color: var(--text-muted); cursor: pointer; }

/* ─── Responsive Tweaks ─────────────────────────────────── */
@media (max-width: 768px) {
  .page-content { padding: 16px 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 14px; }
}

@media (max-width: 480px) {
  .page-title { font-size: 1.15rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
