/* === 全域設定 === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2a9d8f;
  --primary-dark: #21867a;
  --accent: #e76f51;
  --accent-light: #ff6b4a;
  --yellow: #e9c46a;
  --bg: #f5f0e8;
  --card: #ffffff;
  --text: #2a2a2a;
  --text-secondary: #8a8a8a;
  --danger: #c94c4c;
  --success: #4a7c59;
  --border: #e0d8cc;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(231, 111, 81, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(42, 157, 143, 0.03) 0%, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* === 頁面切換 === */
.page {
  display: none;
  min-height: 100vh;
}
.page.active {
  display: block;
}

.view {
  display: none;
  padding: 16px;
  padding-bottom: 80px;
}
.view.active {
  display: block;
}

/* === 登入頁 === */
#loginPage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  text-align: center;
  width: 100%;
  max-width: 360px;
}

.login-icon {
  margin-bottom: 20px;
}

.login-container h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.login-card input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus {
  border-color: var(--primary);
}

.login-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

/* === 按鈕 === */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.btn-outline-sm {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-block { width: 100%; }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* === 頂部導航 === */
.app-header {
  background: var(--card);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

/* === 返回按鈕 === */
.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 12px;
}

/* === 日期橫幅 === */
.date-banner {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* === 區塊標題 === */
.section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* === 展館列表 === */
.venue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.venue-card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.1s;
}

.venue-card:active {
  transform: scale(0.98);
}

.venue-card-name {
  font-size: 16px;
  font-weight: 600;
}

.venue-card-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.venue-arrow {
  color: var(--text-secondary);
  font-size: 18px;
}

/* === 同事列表 === */
.staff-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.staff-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.1s;
}

.staff-card:active {
  transform: scale(0.96);
}

.staff-card-name {
  font-size: 15px;
  font-weight: 600;
}

/* === 個人更表 === */
.personal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.personal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.current-time-card {
  background: var(--accent);
  color: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
}

.ct-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.ct-time {
  font-size: 20px;
  font-weight: 700;
}

.ct-location {
  font-size: 16px;
  margin-top: 4px;
  opacity: 0.95;
}

.next-time-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--yellow);
}

.nt-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.nt-time {
  font-size: 15px;
  font-weight: 600;
}

.nt-location {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === 時間軸 === */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 10px;
  margin-bottom: 6px;
}

.tl-time {
  width: 90px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tl-location {
  flex: 1;
  font-size: 15px;
}

.tl-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.tag-rest { background: #fff3cd; color: #856404; }
.tag-lunch { background: #d4edda; color: #155724; }
.tag-event { background: #f8d7da; color: #721c24; }
.tag-work { background: #e2e3e5; color: #383d41; }
.tag-office { background: #e2e3e5; color: #adb5bd; }

/* === 原圖查看 === */
.original-image-container {
  background: var(--card);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.original-image-container img {
  max-width: 100%;
  border-radius: 8px;
}

/* === 管理後台 === */
.admin-section {
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.admin-section h3 {
  font-size: 16px;
  margin-bottom: 14px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
}

.input-field:focus { border-color: var(--primary); }

.msg-msg {
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

/* === OCR === */
.ocr-status {
  margin-top: 14px;
  text-align: center;
}

.progress-bar {
  background: var(--border);
  height: 6px;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}

.ocr-preview {
  margin-top: 14px;
}

.ocr-preview h4 {
  font-size: 14px;
  margin-bottom: 10px;
}

.ocr-preview-content {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  max-height: 300px;
  overflow-y: auto;
}

/* === 資料資訊 === */
.data-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

/* === 空狀態 === */
.empty-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-msg .small {
  font-size: 13px;
  margin-top: 8px;
}

/* === 響應式 === */
@media (min-width: 480px) {
  .view {
    max-width: 480px;
    margin: 0 auto;
  }
}

/* === 管理員彈窗 === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 320px;
}

.modal-card h3 {
  margin-bottom: 16px;
  text-align: center;
}

.modal-card .input-field {
  margin-bottom: 12px;
}

.modal-card .btn-outline {
  margin-top: 10px;
  width: 100%;
}

/* === 平台狀態顯示 === */
.status-display {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* === 手動編輯 === */
.venue-edit-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.venue-edit-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.venue-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.staff-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-edit-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.staff-edit-item input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.btn-danger-sm {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.btn-outline-sm {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
