/* 達丁接駁司機 App - 自定義樣式 */

/* ==================== 基礎設定 ==================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ==================== 手機容器 ==================== */
.mobile-container {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: #F5F5F5;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* ==================== 自定義顏色變數 ==================== */
:root {
  /* Primary Colors */
  --color-primary-400: #42A5F5;
  --color-primary-500: #1976D2;
  --color-primary-600: #1565C0;

  /* Secondary Colors */
  --color-secondary-400: #FF9800;
  --color-secondary-500: #FF6F00;
  --color-secondary-600: #E65100;

  /* Neutral Colors */
  --color-grey-900: #212121;
  --color-grey-700: #616161;
  --color-grey-400: #BDBDBD;
  --color-grey-100: #F5F5F5;

  /* Functional Colors */
  --color-success: #4CAF50;
  --color-warning: #FFC107;
  --color-error: #F44336;
  --color-info: #2196F3;
}

/* ==================== 漸變背景 ==================== */
.gradient-primary {
  background: linear-gradient(135deg, #1976D2 0%, #42A5F5 100%);
}

.gradient-success {
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
}

.gradient-warning {
  background: linear-gradient(135deg, #FFC107 0%, #FFD54F 100%);
}

/* ==================== 陰影等級 ==================== */
.elevation-1 {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.elevation-2 {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.elevation-3 {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
}

.elevation-4 {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

/* ==================== 按鈕特效 ==================== */
.btn-ripple {
  position: relative;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
}

.btn-ripple:active {
  transform: scale(0.98);
}

.btn-ripple::after {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.btn-ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* ==================== 輸入框樣式 ==================== */
.input-field {
  transition: all 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* ==================== 驗證碼輸入框 ==================== */
.verification-input {
  width: 64px;
  height: 64px;
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  border: 2px solid var(--color-grey-400);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.verification-input:focus {
  border-color: var(--color-primary-500);
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.2);
}

.verification-input.filled {
  border-color: var(--color-success);
  background-color: #E8F5E9;
}

.verification-input.error {
  border-color: var(--color-error);
  animation: shake 0.5s;
}

/* ==================== 動畫 ==================== */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-10px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(10px);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-slideUp {
  animation: slideUp 0.3s ease-out;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-in;
}

/* ==================== 倒數計時器 ==================== */
.countdown-timer {
  font-size: 48px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.countdown-timer.warning {
  color: var(--color-warning);
}

.countdown-timer.danger {
  color: var(--color-error);
  animation: pulse 1s infinite;
}

/* ==================== 進度條 ==================== */
.progress-bar {
  height: 4px;
  background-color: var(--color-grey-400);
  border-radius: 2px;
  overflow: hidden;
}

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

.progress-fill.success {
  background-color: var(--color-success);
}

/* ==================== 狀態徽章 ==================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.pending {
  background-color: #FFF3E0;
  color: #E65100;
}

.status-badge.in-progress {
  background-color: #E3F2FD;
  color: #1565C0;
}

.status-badge.completed {
  background-color: #E8F5E9;
  color: #2E7D32;
}

.status-badge.cancelled {
  background-color: #FFEBEE;
  color: #C62828;
}

/* ==================== 站點時間軸 ==================== */
.timeline-item {
  position: relative;
  padding-left: 48px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: -16px;
  width: 2px;
  background-color: var(--color-grey-400);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid;
}

.timeline-marker.pickup {
  background-color: #E8F5E9;
  border-color: var(--color-success);
  color: var(--color-success);
}

.timeline-marker.dropoff {
  background-color: #FFEBEE;
  border-color: var(--color-error);
  color: var(--color-error);
}

.timeline-marker.completed {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.timeline-marker.active {
  background-color: var(--color-primary-500);
  border-color: var(--color-primary-500);
  color: white;
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.2);
}

/* ==================== 底部導航欄 ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #E0E0E0;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  color: var(--color-grey-400);
  transition: color 0.3s ease;
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--color-primary-500);
  font-weight: 600;
}

.bottom-nav-item span {
  font-size: 11px;
  margin-top: 4px;
}

/* ==================== Modal 覆蓋層 ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

/* ==================== 底部抽屜 ==================== */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2000;
  animation: slideUp 0.3s ease-out;
}

.bottom-sheet-handle {
  width: 32px;
  height: 4px;
  background-color: var(--color-grey-400);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ==================== 浮動按鈕 ==================== */
.fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.fab.pulse {
  animation: pulse 2s infinite;
}

/* ==================== 卡片樣式 ==================== */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.card-elevated {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
}

/* ==================== 響應式調整 ==================== */
@media (max-width: 375px) {
  .verification-input {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .countdown-timer {
    font-size: 40px;
  }
}

@media (min-width: 768px) {
  .mobile-container {
    border-radius: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
    min-height: calc(100vh - 40px);
  }
}

/* ==================== 安全區域 ==================== */
.safe-top {
  padding-top: env(safe-area-inset-top);
}

.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ==================== 工具類別 ==================== */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==================== 載入動畫 ==================== */
.spinner {
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 隱藏捲軸 ==================== */
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ==================== Driver Friendly Animations ==================== */
@keyframes pulse-shadow-primary {
  0% {
    box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(25, 118, 210, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(25, 118, 210, 0);
  }
}

@keyframes pulse-shadow-success {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

.btn-pulse-primary {
  animation: pulse-shadow-primary 2s infinite;
}

.btn-pulse-success {
  animation: pulse-shadow-success 2s infinite;
}