/* 全局樣式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  background: #f5f5f5;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* 容器 */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* 頂部欄 */
.header {
  background: #FF5B00;
  color: white;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
}

.header-sub {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

/* 卡片 */
.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
}

/* 表單 */
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #FF5B00;
}

/* 按鈕 */
button, .btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: #FF5B00;
  color: white;
}

.btn-primary:hover {
  background: #3367d6;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f1f3f4;
  color: #333;
}

.btn-secondary:hover {
  background: #e8eaed;
}

.btn-success {
  background: #34a853;
  color: white;
}

.btn-danger {
  background: #FF5B00;
  color: white;
}

.btn-block {
  width: 100%;
  display: block;
}

/* 上傳區域 */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 16px;
}

.upload-area:hover {
  border-color: #FF5B00;
  background: #f8f9ff;
}

.upload-area.has-file {
  border-color: #34a853;
  background: #f0fff4;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 12px;
}

/* 載入動畫 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* 結果顯示 */
.result {
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.result.success {
  background: #e6f4ea;
  color: #1e7e34;
  border: 1px solid #34a853;
}

.result.error {
  background: #fce8e6;
  color: #CC4900;
  border: 1px solid #FF5B00;
}

.result.warning {
  background: #fef7e0;
  color: #f9ab00;
  border: 1px solid #fbbc04;
}

/* 列表 */
.receipt-list {
  list-style: none;
}

.receipt-item {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid #FF5B00;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}

.receipt-item:hover {
  transform: translateX(4px);
}

.receipt-item.pending {
  border-left-color: #fbbc04;
}

.receipt-item.auto-imported {
  border-left-color: #34a853;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.receipt-merchant {
  font-weight: 600;
  font-size: 16px;
  color: #333;
}

.receipt-amount {
  font-size: 18px;
  font-weight: 700;
  color: #FF5B00;
}

.receipt-meta {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.receipt-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.receipt-actions button {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #e6f4ea;
  color: #34a853;
}

.badge-warning {
  background: #fef7e0;
  color: #f9ab00;
}

.badge-info {
  background: #e8f0fe;
  color: #FF5B00;
}

/* 底部導航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  z-index: 100;
}

.nav-item {
  flex: 1;
  text-align: center;
  padding: 8px;
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-item.active {
  color: #FF5B00;
}

.nav-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 12px;
}

/* 統計卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #FF5B00;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #666;
}

/* 隱藏元素 */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
