/**
 * UI State Styles
 * 錯誤橫幅、空狀態、載入指示器、最後更新時間樣式
 */

/* ===== 錯誤橫幅 ===== */
.error-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 600px;
  width: 90%;
  background-color: #fee;
  border: 2px solid #dc3545;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
  animation: slideDown 0.3s ease-out;
}

.error-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.error-icon {
  flex-shrink: 0;
  color: #dc3545;
}

.error-message {
  flex: 1;
  color: #721c24;
  font-size: 15px;
  line-height: 1.5;
}

.error-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #721c24;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.error-close:hover {
  background-color: rgba(220, 53, 69, 0.1);
}

.error-banner.fade-out {
  animation: slideUp 0.3s ease-out forwards;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
}

/* ===== 空狀態 ===== */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
}

.empty-state-content {
  text-align: center;
  max-width: 400px;
}

.empty-icon {
  color: #adb5bd;
  margin: 0 auto 20px;
  display: block;
}

.empty-message {
  color: #6c757d;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.empty-action-btn {
  background-color: var(--primary-color, #007bff);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.empty-action-btn:hover {
  background-color: var(--primary-hover, #0056b3);
  transform: translateY(-1px);
}

.empty-action-btn:active {
  transform: translateY(0);
}

/* ===== 載入指示器 ===== */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px 20px;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.spinner-dot {
  width: 12px;
  height: 12px;
  background-color: var(--primary-color, #007bff);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.spinner-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading-message {
  color: #6c757d;
  font-size: 15px;
}

/* ===== 最後更新時間 ===== */
.last-updated {
  margin-top: 32px;
  padding: 16px 20px;
  background-color: #f8f9fa;
  border-left: 4px solid #28a745;
  border-radius: 4px;
}

.last-updated.stale {
  background-color: #fff3cd;
  border-left-color: #ffc107;
}

.last-updated-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.warning-icon {
  color: #856404;
  flex-shrink: 0;
}

.update-time {
  color: #495057;
  font-size: 14px;
}

.stale-warning {
  margin: 8px 0 0;
  color: #856404;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
  .error-banner {
    width: 95%;
    max-width: none;
  }

  .error-banner-content {
    padding: 12px 16px;
  }

  .error-message {
    font-size: 14px;
  }

  .empty-state {
    min-height: 250px;
    padding: 30px 16px;
  }

  .empty-message {
    font-size: 15px;
  }

  .loading-indicator {
    min-height: 150px;
    padding: 30px 16px;
  }

  .last-updated {
    padding: 12px 16px;
  }

  .update-time,
  .stale-warning {
    font-size: 13px;
  }
}

/* ===== 列印樣式 ===== */
@media print {
  .error-banner,
  .loading-indicator {
    display: none;
  }

  .empty-state {
    background-color: white;
    border: 1px solid #dee2e6;
  }

  .last-updated {
    background-color: white;
    border: 1px solid #dee2e6;
  }
}
