@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #93c5fd;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 공통 컨테이너 API ── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 16px 8px;
}

/* ── 헤더 (레지스터 페이지 등) ── */
header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
}

/* ── 카드 ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.auto-save {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  margin-left: auto;
}

/* ── 폼 & 입력 필드 ── */
.field {
  margin-bottom: 18px;
}

.field label {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.hint {
  font-weight: 400;
  color: var(--text-light);
  font-size: 12px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-main);
  background: #fff;
  transition: all 0.2s ease;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-light);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── 버튼 ── */
.btn-primary,
.btn-danger,
.btn-secondary {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-block {
  display: flex;
  width: 100%;
  text-decoration: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

button:not(:disabled):active {
  transform: scale(0.98);
}

/* ── Checkbox ── */
.chk-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
}

.chk-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== INDEX.HTML (로그인) 전용 스타일 ===== */
.login-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 0 6vh 0;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  
  /* 스크롤막대 숨김 (IE, Edge, Firefox) */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 스크롤막대 숨김 (Chrome, Safari, Opera) */
.login-page::-webkit-scrollbar {
  display: none;
}

.login-wrapper {
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 40px 32px;
  border: none;
  margin-bottom: 52px; /* Margin collapse 고려하여 52px로 계산 (max(52, 24) = 52) */
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.login-header .subtitle {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

.login-card .field-group {
  margin-bottom: 24px;
}

.login-card .field {
  margin-bottom: 20px;
}

.login-card .field:last-child {
  margin-bottom: 0;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
}

.login-card input:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-modern {
  font-size: 16px;
  padding: 16px;
  border-radius: 14px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-modern:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.agreement-section {
  border-top: 1px solid #f1f5f9;
  padding-top: 24px;
}

.agreement-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agree-label {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  align-items: center;
  flex: 1;
}

.btn-toggle-agree {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-toggle-agree:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.agreement-details {
  display: none;
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  animation: slideDown 0.3s ease-out;
}

.agreement-details.show {
  display: block;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.compact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compact-list li {
  position: relative;
  padding-left: 14px;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
}

.compact-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #94a3b8;
  font-weight: 800;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 14px;
  font-size: 13.5px;
  color: #b91c1c;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
  word-break: keep-all;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* ===== REGISTER.HTML 전용 유지 ===== */
.time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sel-hour,
.sel-min {
  width: auto;
  min-width: 70px;
}

.tilde {
  color: var(--text-muted);
  font-weight: 500;
}

.rest-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.month-picker select {
  width: auto;
  font-weight: 600;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.cal-head {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
  color: var(--text-muted);
}

.cal-head.sun {
  color: #ef4444;
}

.cal-head.sat {
  color: var(--primary);
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
  user-select: none;
  background: white;
}

.cal-day:hover:not(.disabled):not(.weekend) {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.cal-day.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.cal-day.weekend {
  color: var(--text-light);
  background: #f8fafc;
  cursor: default;
}

.cal-day.registered {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
  cursor: default;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.reg-mark {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #16a34a;
}

.cal-day.disabled {
  visibility: hidden;
}

.cal-day.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.cal-summary {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
  text-align: right;
  font-weight: 500;
}

.cal-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 2px;
}

.run-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.run-btns .chk-label {
  margin-left: auto;
  align-items: center;
}

/* 진행 상황 */
.progress-area {
  margin-top: 8px;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

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

.progress-bar>div {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

#progressText {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  width: 44px;
  text-align: right;
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.progress-list::-webkit-scrollbar {
  width: 6px;
}

.progress-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.prog-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.prog-item.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.prog-item.error {
  background: #fef2f2;
  border-color: #fecaca;
}

.prog-item.duplicate {
  background: #fefce8;
  border-color: #fef08a;
}

.prog-item.running {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.prog-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.prog-date {
  font-weight: 600;
  color: var(--text-main);
}

.prog-msg {
  color: var(--text-muted);
  margin-left: auto;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.link-back {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: white;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 99px;
  transition: all 0.15s;
}

.link-back:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

@media (max-width: 480px) {
  .container {
    padding: 24px 16px;
  }

  .card {
    padding: 20px 16px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .card h2 {
    flex-wrap: wrap;
  }

  .auto-save {
    margin-left: 0;
    padding-left: 36px;
  }

  .time-row {
    gap: 4px;
  }

  .run-btns .chk-label {
    margin-left: 0;
    width: 100%;
    margin-top: 4px;
  }
}