/* ======== CSS 변수 ======== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #059669;
  --accent-dark: #047857;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ======== 기본 스타일 ======== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* ======== 헤더 ======== */
header {
  background: var(--card-bg);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header img {
  height: 40px;
  width: auto;
}

header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

/* ======== 메인 컨테이너 ======== */
body {
  padding-top: 80px;
}

/* ======== 페이지 ======== */
.page {
  display: none;
  min-height: calc(100vh - 80px);
  padding: 1rem 1rem 2rem 1rem;
  animation: fadeIn 0.3s ease-in-out;
}

.page.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======== 카드 ======== */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  text-align: center;
  min-height: 650px;
  display: flex;
  flex-direction: column;
}

.card h1 {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
  margin-top: 0;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ======== 근무지 선택 버튼 ======== */
.site-buttons {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.site-btn {
  width: 100%;
  padding: 2rem 2rem;
  font-size: 1.8rem;
  font-weight: 700;
  border: 3px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--primary);
  color: #fff;
  text-align: center;
  min-height: 80px;
  display: block;
  margin-left: 0;
  margin-right: 0;
}

.site-btn:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.site-btn:active {
  transform: translateY(-2px);
}

/* ======== 입력 필드 ======== */
input[type="text"], input[type="file"] {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin-bottom: 2rem;
  transition: all 0.2s ease;
  background: var(--bg);
}

input[type="text"]:focus, input[type="file"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="text"]::placeholder {
  color: var(--text-light);
}

/* ======== 버튼 ======== */
button {
  width: 100%;
  padding: 1.25rem 2rem;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--primary);
  color: white;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ======== 이미지 프리뷰 ======== */
#preview {
  width: 100%;
  max-width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin: 1rem 0;
  border: 2px solid var(--border);
  display: none;
}

#preview.show {
  display: block;
}

/* ======== 완료 화면 ======== */
.success-title {
  font-size: 1.4rem !important;
  color: var(--accent) !important;
  margin-top: 60px !important;
  margin-bottom: 1rem !important;
}

.success-message {
  margin: 0;
  font-size: 1.1rem;
  text-align: center;
  color: var(--text-light);
}

/* ======== 반응형 ======== */
@media (max-width: 480px) {
  .card {
    padding: 2rem 1.5rem;
    margin: 0 0.5rem;
  }
  
  .card h1 {
    font-size: 1.7rem;
  }
  
  .site-btn {
    font-size: 1.6rem;
    padding: 1.5rem 1.5rem;
    min-height: 70px;
  }
  
  input[type="text"], input[type="file"] {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }
  
  button {
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
  }
  
  header {
    padding: 0.75rem 1rem;
  }
  
  header h2 {
    font-size: 1.1rem;
  }
}

/* ======== 접근성 ======== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ======== 다크모드 지원 ======== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --card-bg: #1f2937;
    --text: #f9fafb;
    --text-light: #9ca3af;
    --border: #374151;
  }
}

.breadcrumb {
  width: 100%;
  max-width: 400px;
  margin: 1rem auto 1rem auto;
  padding: 0.7rem 1rem;
  font-size: 1.55rem;
  color: var(--text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  text-align: center;
}

.breadcrumb .crumb {
  color: var(--primary);
  font-weight: 600;
}

.breadcrumb .sep {
  color: var(--text-light);
  margin: 0 0.2em;
}

@media (max-width: 480px) {
  .breadcrumb {
    font-size: 1.25rem;
    padding: 0.5rem 0.5rem;
    max-width: 100vw;
    margin: 0.7rem auto 0.7rem auto;
  }
}

.busno-buttons {
  width: 100%;
}

.busno-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 2rem 2rem;
  font-size: 1.8rem;
  font-weight: 700;
  border: 3px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--primary);
  color: #fff;
  text-align: center;
  min-height: 80px;
  display: block;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 1.2rem;
}

.busno-btn:last-child {
  margin-bottom: 0;
}

.busno-btn:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 41, 59, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  max-width: 95vw;
  width: 380px;
  min-height: 140px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.modal-message {
  font-size: 1.35rem;
  color: var(--text);
  font-weight: 600;
  word-break: keep-all;
}
.modal-actions {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
}
.modal-btn {
  flex: 1 1 0;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 1.1rem 0;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-yes {
  background: var(--primary);
  color: #fff;
  transition: background 0.2s, box-shadow 0.2s;
}
.modal-yes:hover:not(:disabled) {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.modal-no {
  background: #e5e7eb;
  color: var(--text);
  transition: background 0.2s, box-shadow 0.2s;
}
.modal-no:hover:not(:disabled) {
  background: #cbd5e1;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.modal-btn:disabled {
  background: #f3f4f6;
  color: #bdbdbd;
  cursor: not-allowed;
  box-shadow: none;
}
@media (max-width: 480px) {
  .modal-box {
    width: 90vw;
    max-width: 90vw;
    padding: 1.5rem 1rem 1.2rem 1rem;
    min-height: 180px;
    box-sizing: border-box;
    gap: 2rem;
  }
  .modal-message {
    font-size: 1.25rem;
  }
  .modal-actions {
    gap: 1.2rem;
  }
  .modal-btn {
    font-size: 1.15rem;
    padding: 1.1rem 0;
    min-width: 0;
    border-radius: 12px;
  }
}

.card-actions {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-top: 2rem;
}
.prevBtn {
  padding: 1rem 2.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  background: #e5e7eb;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}
.prevBtn:hover:not(:disabled) {
  background: #cbd5e1;
}
.prevBtn:disabled {
  background: #f3f4f6;
  color: #bdbdbd;
  cursor: not-allowed;
}

.card-actions-global {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  justify-content: flex-start;
}
#prevBtn {
  padding: 1rem 2.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  background: #e5e7eb;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}
#prevBtn:hover:not(:disabled) {
  background: #cbd5e1;
}
#prevBtn:disabled {
  background: #f3f4f6;
  color: #bdbdbd;
  cursor: not-allowed;
}

.plate-btn.fade-in {
  animation: fadeInScale 0.25s cubic-bezier(0.4,0,0.2,1);
}
.plate-btn.fade-exit {
  animation: fadeOutScale 0.2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeOutScale {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.85); }
}
.plate-btn:focus, .site-btn:focus, .busno-btn:focus, button:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  z-index: 2;
}
.plate-btn, .site-btn, .busno-btn, button {
  touch-action: manipulation;
  min-height: 64px;
}
input[type="text"], input[type="file"] {
  min-height: 56px;
}

.plate-btn {
  min-height: 64px;
  height: 64px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}
#plate-grid > div {
  min-height: 64px;
  height: 64px;
} 