/* 색상 팔레트 (5색 이내, 그라데이션 없음) */
:root {
  --navy: #1B3A5C;
  --white: #FFFFFF;
  --gray: #F2F4F7;
  --orange: #E8732A;
  --text: #222222;
}

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

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

/* 헤더 */
.header {
  background: var(--navy);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 {
  font-size: 18px;
  font-weight: 700;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.header-right span { opacity: 0.85; }

/* 버튼 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--navy); color: var(--white); }
.btn-secondary:hover { opacity: 0.9; }
.btn-outline {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--navy);
}
.btn-outline:hover { background: var(--gray); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: #c0392b; color: var(--white); }
.btn-danger:hover { opacity: 0.9; }

/* 로그인 화면 */
.login-container {
  max-width: 380px;
  margin: 80px auto;
  background: var(--white);
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.login-container h2 {
  text-align: center;
  margin-bottom: 28px;
  color: var(--navy);
  font-size: 22px;
}
.login-container .form-group { margin-bottom: 16px; }
.login-container label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.login-container input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
}
.login-container input:focus {
  outline: none;
  border-color: var(--navy);
}
.login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.login-actions .btn { text-align: center; width: 100%; padding: 12px; font-size: 15px; }
.kakao-btn {
  background: #FEE500;
  color: #3C1E1E;
  font-weight: 700;
}
.kakao-btn:hover { opacity: 0.9; }
.divider {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin: 4px 0;
}
.toggle-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
}
.toggle-link a {
  color: var(--orange);
  cursor: pointer;
  text-decoration: underline;
}
.error-msg {
  color: #c0392b;
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

/* 메인 레이아웃 */
.main {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 16px;
}

/* 카드 */
.card {
  background: var(--white);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h3 {
  font-size: 16px;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray);
}

/* 폼 */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.form-row .form-group { flex: 1; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 5px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
  background: var(--white);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--navy);
}

/* 체크박스 */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
}

/* 터미널 검색 드롭다운 */
.search-select {
  position: relative;
}
.search-select input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
}
.search-select .dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid #d0d5dd;
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 100;
}
.search-select .dropdown.open { display: block; }
.search-select .dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.search-select .dropdown-item:hover { background: var(--gray); }

/* 알람 목록 */
.alarm-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray);
}
.alarm-item:last-child { border-bottom: none; }
.alarm-info { flex: 1; }
.alarm-route {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.alarm-detail {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}
.alarm-actions { display: flex; gap: 6px; }

/* 상태 뱃지 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }

/* 알림 이력 */
.notification-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--gray);
  font-size: 13px;
}
.notification-item:last-child { border-bottom: none; }
.notification-time {
  font-size: 12px;
  color: #999;
}
.notification-msg {
  margin-top: 4px;
  white-space: pre-line;
  line-height: 1.5;
}

/* 즐겨찾기 */
.fav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray);
}
.fav-item:last-child { border-bottom: none; }
.fav-route { font-weight: 600; font-size: 14px; }
.fav-label { font-size: 12px; color: #999; }
.fav-actions { display: flex; gap: 6px; }

/* 탭 네비게이션 */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #666;
  border-bottom: 3px solid transparent;
}
.tab.active {
  color: var(--navy);
  border-bottom-color: var(--orange);
}
.tab:hover { color: var(--navy); }

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

/* 카카오 상태 */
.kakao-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}
.kakao-linked { background: #FEE500; color: #3C1E1E; }
.kakao-unlinked { background: var(--gray); color: #666; }

/* 반응형 - 모바일 최적화 */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .form-row { flex-direction: column; gap: 0; }
  .main { padding: 0 8px; margin-top: 12px; }
  .card { padding: 16px 14px; margin-bottom: 12px; border-radius: 8px; }
  .card h3 { font-size: 15px; margin-bottom: 12px; }
  .header { padding: 12px 16px; }
  .header h1 { font-size: 15px; }
  .header-right { gap: 8px; font-size: 13px; }

  /* 탭 */
  .tabs { border-radius: 8px; margin-bottom: 12px; }
  .tab { padding: 10px 4px; font-size: 13px; }

  /* 폼 요소 터치 친화 */
  .form-group input,
  .form-group select,
  .search-select input {
    padding: 12px 10px;
    font-size: 16px; /* iOS 확대 방지 */
  }
  .form-group { margin-bottom: 12px; }

  /* 드롭다운 터치 친화 */
  .search-select .dropdown { max-height: 250px; }
  .search-select .dropdown-item { padding: 12px 14px; font-size: 15px; }

  /* 버튼 터치 친화 */
  .btn { padding: 10px 16px; font-size: 15px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; }

  /* 알람 목록 */
  .alarm-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .alarm-actions { width: 100%; }
  .alarm-actions .btn { flex: 1; text-align: center; }
  .alarm-route { font-size: 14px; }

  /* 즐겨찾기 */
  .fav-item { gap: 8px; }

  /* 카카오 상태 */
  .kakao-status { flex-direction: column; gap: 10px; text-align: center; }

  /* 로그인 */
  .login-container { margin: 40px 16px; padding: 28px 20px; }
  .login-container h2 { font-size: 20px; margin-bottom: 20px; }
  .login-container input { padding: 12px; font-size: 16px; }
  .login-actions .btn { padding: 14px; font-size: 16px; }

  /* 배차 테이블 */
  table { font-size: 13px; }
  table th, table td { padding: 8px 3px; }

  /* 체크박스 */
  .checkbox-row { font-size: 14px; }
  .checkbox-row input[type="checkbox"] { width: 20px; height: 20px; }
}
