/* === 司機輸入表單样式 === */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #FF6B35;
  --success: #34C759;
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --text-secondary: #8E8E93;
  --border: #E5E5EA;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app { max-width: 480px; margin: 0 auto; padding-bottom: 40px; }

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 16px 16px 14px;
  text-align: center;
  position: relative;
}
.header-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.header h1 { font-size: 20px; font-weight: 700; }
.header .subtitle { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.header .subtitle.warning-text { color: #FFD60A; font-weight: 600; }
.settings-btn { background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px; position: absolute; right: 16px; top: 16px; }
.settings-body { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
.settings-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; text-align: center; }

/* Form */
.form-section { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

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

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-group { margin-bottom: 10px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--primary); background: white; }

.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 20px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  width: 100%; margin-top: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: #e55a2b; }
.btn-success { background: var(--success); color: white; }
.btn-full { width: 100%; }

/* Modal */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex; align-items: flex-end;
  justify-content: center; z-index: 200;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card); width: 100%; max-width: 500px; max-height: 90vh;
  border-radius: 20px 20px 0 0; overflow: hidden;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 600;
}
.btn-icon-small { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }
.preview-wrapper { padding: 16px; max-height: 60vh; overflow-y: auto; background: #525252; }
.preview-wrapper img { width: 100%; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.modal-footer { padding: 16px 20px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }

/* Loading */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.95); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 300;
}
.loading-overlay.hidden { display: none; }
.loading-spinner {
  width: 44px; height: 44px; border: 3px solid #E5E5EA;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { color: var(--text-secondary); font-size: 15px; }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: #333; color: white; padding: 12px 24px;
  border-radius: 25px; font-size: 14px; z-index: 400;
  animation: fadeInUp 0.3s ease;
}
.toast.hidden { display: none; }
@keyframes fadeInUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* === 派車單圖片模板样式 === */
.dispatch-paper {
  width: 595px;
  background: white;
  font-family: 'PingFang TC', 'Microsoft JhengHei', serif;
  color: #1C1C1E;
}

.dispatch-inner {
  padding: 30px 36px;
}

.dispatch-logo {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
}

.dispatch-company {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #c44a00;
  margin-bottom: 10px;
}

.dispatch-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 11px;
}

.dispatch-table td {
  border: 1px solid #1a1a1a;
  padding: 5px 8px;
  vertical-align: middle;
}

.dispatch-table .label {
  background: #f0f0f0;
  font-weight: 600;
  color: #c44a00;
  white-space: nowrap;
  width: 110px;
}

.dispatch-table .field {
  background: white;
  min-width: 120px;
}

.dispatch-table .field.wide {
  width: auto;
}

.rent-table .field { min-width: 80px; }

.dispatch-notes {
  border: 1px solid #1a1a1a;
  margin-bottom: 10px;
  padding: 5px 8px;
  font-size: 11px;
}

.notes-label {
  font-weight: 600;
  color: #c44a00;
  margin-bottom: 4px;
}

.notes-content {
  white-space: pre-wrap;
  min-height: 30px;
}

.dispatch-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 11px;
  border-top: 1px solid #1a1a1a;
  padding-top: 10px;
}

.footer-left { line-height: 1.8; }
.footer-right { text-align: right; }
.sign-line { margin-top: 30px; border-top: 1px solid #1a1a1a; width: 120px; }
