/* 全局樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

/* 容器樣式 */
.container {
  max-width: 680px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* 標題樣式 */
h1 {
  text-align: center;
  color: #1a1a2e;
  margin-bottom: 24px;
  font-size: 24px;
}

h2 {
  color: #1a1a2e;
  margin-bottom: 20px;
  font-size: 18px;
}

h3 {
  color: #555;
  margin: 20px 0 12px;
  font-size: 16px;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

/* 分頁標籤 */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: #f5f5f5;
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.3s;
  color: #666;
}

.tab-btn.active {
  background: white;
  color: #1a1a2e;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 表單樣式 */
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.3s;
}

input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #1a1a2e;
}

input[type="number"] {
  width: 70px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
}

/* 商品列表 */
.items-list {
  margin-bottom: 20px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-name {
  font-size: 15px;
  color: #444;
}

.item-price {
  font-size: 14px;
  color: #0f3460;
  font-weight: bold;
}

/* 總額區塊 */
.total-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin: 16px 0;
  border-top: 2px solid #1a1a2e;
  border-bottom: 1px solid #ddd;
}

.total-label {
  font-size: 16px;
  color: #555;
}

.total-price {
  font-size: 24px;
  font-weight: bold;
  color: #1a1a2e;
}

/* 按鈕樣式 */
button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 16px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(26,26,46,0.3);
}

button:active {
  transform: translateY(0);
}

/* 錯誤訊息 */
.error-msg {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
  min-height: 20px;
}

/* 訂單卡片 */
.order-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

/* 狀態標籤 */
.status-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 16px;
}

.status-badge[data-status="處理中"] {
  background: #fff3cd;
  color: #856404;
}

.status-badge[data-status="已訂購"] {
  background: #d1ecf1;
  color: #0c5460;
}

.status-badge[data-status="已到貨"] {
  background: #d4edda;
  color: #155724;
}

/* 訂單表格 */
.order-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.order-table th,
.order-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.order-table th {
  color: #666;
  font-weight: normal;
  font-size: 14px;
}

.order-table td {
  font-size: 15px;
}

.order-table tfoot {
  border-top: 2px solid #1a1a2e;
}

.total-row td {
  padding-top: 12px;
  font-size: 16px;
  color: #1a1a2e;
}

/* 訂單資訊 */
.order-info {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

.order-info p {
  color: #666;
  font-size: 13px;
  margin-bottom: 4px;
}

.order-info span {
  color: #333;
}

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

/* 訂單列表頁面 */
.user-info {
  text-align: center;
  color: #666;
  margin-bottom: 20px;
  font-size: 14px;
}

.orders-count {
  display: inline-block;
  background: #0f3460;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  margin-left: 8px;
}

.orders-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.order-list-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border-left: 4px solid #0f3460;
}

.order-list-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.order-list-num {
  font-weight: bold;
  color: #1a1a2e;
  font-size: 15px;
}

.order-list-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.status-processing {
  background: #fff3cd;
  color: #856404;
}

.status-ordered {
  background: #d1ecf1;
  color: #0c5460;
}

.status-arrived {
  background: #d4edda;
  color: #155724;
}

.order-list-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
}

.order-list-pickup {
  font-size: 13px;
  color: #0f3460;
  margin-bottom: 6px;
  font-weight: 500;
}

/* 詳情頁面標題 */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-header h1 {
  margin: 0;
  text-align: left;
}

.btn-back {
  background: #f0f0f0 !important;
  color: #555 !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  width: auto !important;
  flex-shrink: 0;
}

.btn-back:hover {
  background: #e0e0e0 !important;
}

/* 動作按鈕區 */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.btn-primary {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.btn-secondary {
  background: #6c757d !important;
}

/* 管理員面板樣式 */
.admin-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: white;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  opacity: 0.9;
}

.admin-orders {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.admin-order-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid #0f3460;
}

.admin-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-order-email {
  font-weight: bold;
  color: #1a1a2e;
  font-size: 14px;
}

.admin-order-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.admin-order-items {
  font-size: 13px;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.6;
}

.admin-order-detail-items {
  margin-bottom: 10px;
}

.detail-item {
  font-size: 13px;
  color: #444;
  padding: 6px 10px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 6px;
  border-left: 3px solid #0f3460;
}

.admin-order-price {
  font-size: 12px;
  color: #0f3460;
  background: #e8f4f8;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: bold;
  line-height: 1.5;
}

.admin-order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-order-actions button {
  flex: 1;
  min-width: 70px;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 12px;
}

.btn-status {
  background: #6c757d;
}

.btn-copy {
  background: #28a745;
}

.btn-delete {
  background: #dc3545;
}

.btn-edit {
  background: #ffc107 !important;
  color: #333 !important;
}

.btn-save {
  background: #28a745 !important;
}

.btn-cancel {
  background: #6c757d !important;
}

.admin-order-contact {
  font-size: 12px;
  color: #666;
  display: block;
  margin-top: 2px;
}

/* 編輯表單樣式 */
.edit-form {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  border: 1px solid #dee2e6;
}

.edit-section {
  margin-bottom: 12px;
}

.edit-section label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
  font-weight: 500;
}

.edit-section input,
.edit-section select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.edit-qty-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.edit-qty-row span {
  font-size: 13px;
  color: #444;
}

.edit-qty-row input {
  width: 70px;
  text-align: center;
  padding: 6px;
}

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

.edit-actions button {
  flex: 1;
  margin-top: 0;
  padding: 10px;
  font-size: 14px;
}

.empty-msg {
  text-align: center;
  color: #888;
  padding: 40px;
  font-size: 14px;
}

/* 動畫效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  animation: fadeIn 0.4s ease-out;
}

/* 表單群組樣式 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}

.pickup-select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

.pickup-select:focus {
  outline: none;
  border-color: #1a1a2e;
}

/* RWD 適配 */
@media (max-width: 720px) {
  body {
    padding: 10px;
  }
  
  .container {
    padding: 20px;
    max-width: 100%;
  }
  
  h1 {
    font-size: 20px;
  }
}
