/**
 * KESTH.NET Firebase Sync UI Styles
 * 同步狀態 UI 樣式
 */

/* 同步狀態列 */
.kesth-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--kesth-sync-bg, #f5f5f5);
  border-radius: 8px;
  margin: 8px 0;
  gap: 12px;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* 深色模式 */
[data-theme="dark"] .kesth-sync-bar,
.dark .kesth-sync-bar {
  --kesth-sync-bg: #2d2d2d;
  --kesth-sync-text: #e0e0e0;
  --kesth-sync-border: #444;
}

/* 同步狀態指示 */
.kesth-sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kesth-sync-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 旋轉動畫 (syncing) */
.kesth-sync-icon.syncing {
  animation: kesth-spin 1s linear infinite;
}

@keyframes kesth-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 狀態顏色 */
.kesth-sync-text.idle { color: #888; }
.kesth-sync-text.syncing { color: #2196F3; }
.kesth-sync-text.synced { color: #4CAF50; }
.kesth-sync-text.error { color: #f44336; }
.kesth-sync-text.offline { color: #FF9800; }

/* 使用者資訊 */
.kesth-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kesth-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.kesth-user-name {
  font-size: 13px;
  color: var(--kesth-sync-text, #666);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 同步控制按鈕區 */
.kesth-sync-actions {
  display: flex;
  gap: 8px;
}

.kesth-sync-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.kesth-sync-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.kesth-sync-btn:active {
  transform: translateY(0);
}

.kesth-sync-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 登入按鈕 */
.kesth-sync-btn.login {
  background: #4285F4;
  color: white;
}

.kesth-sync-btn.login:hover {
  background: #357ABD;
}

/* 登出按鈕 */
.kesth-sync-btn.logout {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
}

[data-theme="dark"] .kesth-sync-btn.logout,
.dark .kesth-sync-btn.logout {
  background: #3d3d3d;
  color: #ccc;
  border-color: #555;
}

/* 同步按鈕 */
.kesth-sync-btn.sync {
  background: #4CAF50;
  color: white;
}

/* 上傳按鈕 */
.kesth-sync-btn.upload {
  background: #2196F3;
  color: white;
}

/* 下載按鈕 */
.kesth-sync-btn.download {
  background: #FF9800;
  color: white;
}

/* 隱藏類別 */
.kesth-hidden {
  display: none !important;
}

/* 同步時間 */
.kesth-sync-time {
  font-size: 11px;
  color: #999;
}

/* 緊湊模式 */
.kesth-sync-bar.compact {
  padding: 4px 8px;
  gap: 8px;
}

.kesth-sync-bar.compact .kesth-sync-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.kesth-sync-bar.compact .kesth-user-name {
  display: none;
}

/* 浮動同步指示器 (用於頁面角落) */
.kesth-sync-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  transition: all 0.3s ease;
}

[data-theme="dark"] .kesth-sync-indicator,
.dark .kesth-sync-indicator {
  background: #2d2d2d;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.kesth-sync-indicator.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* 遷移對話框 */
.kesth-migration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.kesth-migration-dialog {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

[data-theme="dark"] .kesth-migration-dialog,
.dark .kesth-migration-dialog {
  background: #2d2d2d;
  color: #e0e0e0;
}

.kesth-migration-dialog h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.kesth-migration-dialog p {
  margin: 8px 0;
  color: #666;
}

[data-theme="dark"] .kesth-migration-dialog p,
.dark .kesth-migration-dialog p {
  color: #aaa;
}

.kesth-migration-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.kesth-migration-options button {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.kesth-migration-options button:first-child {
  background: #4CAF50;
  color: white;
}

.kesth-migration-options button:nth-child(2) {
  background: #2196F3;
  color: white;
}

.kesth-migration-options button:nth-child(3) {
  background: #FF9800;
  color: white;
}

.kesth-migration-options button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* 響應式 */
@media (max-width: 600px) {
  .kesth-sync-bar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .kesth-sync-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .kesth-user-name {
    display: none;
  }

  .kesth-sync-indicator {
    bottom: 10px;
    right: 10px;
    padding: 6px 12px;
  }
}
