/* Authentication & Cloud Sync Styles */

/* Auth button in settings drawer */
.auth-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--viewer-divider, rgba(15, 23, 42, 0.12));
}

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.auth-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--viewer-accent-tint, rgba(0, 119, 204, 0.12));
  overflow: hidden;
  flex-shrink: 0;
}

.auth-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--viewer-accent, #0077cc);
  font-weight: 600;
}

.auth-user-details {
  flex: 1;
  min-width: 0;
}

.auth-user-name {
  font-weight: 600;
  color: var(--viewer-text, #0f172a);
  font-size: 0.95em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-email {
  font-size: 0.8em;
  color: var(--viewer-text-muted, #5b6b7c);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth buttons */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--viewer-dialog-btn-border, rgba(0, 119, 204, 0.5));
  border-radius: 8px;
  background: var(--viewer-dialog-btn-bg, rgba(0, 119, 204, 0.08));
  color: var(--viewer-text, #0f172a);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.auth-btn:hover {
  background: var(--viewer-accent-tint, rgba(0, 119, 204, 0.15));
  border-color: var(--viewer-accent, #0077cc);
}

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

.auth-btn-google {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #1f1f1f;
}

.auth-btn-google:hover {
  background: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.25);
}

.auth-btn-google svg {
  width: 18px;
  height: 18px;
}


.auth-btn-signout {
  background: transparent;
  border-color: var(--viewer-dialog-cancel-border, rgba(214, 69, 69, 0.5));
  color: var(--viewer-dialog-cancel-bg, #d64545);
}

.auth-btn-signout:hover {
  background: rgba(214, 69, 69, 0.08);
  border-color: var(--viewer-dialog-cancel-bg, #d64545);
}

/* Sync status indicator */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 6px;
  background: var(--viewer-stats-item-bg, rgba(15, 23, 42, 0.05));
  font-size: 0.85em;
  color: var(--viewer-text-muted, #5b6b7c);
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--viewer-text-soft, #7c8a99);
  flex-shrink: 0;
}

.sync-status[data-status="synced"] .sync-status-dot {
  background: #22c55e;
}

.sync-status[data-status="syncing"] .sync-status-dot {
  background: var(--viewer-accent, #0077cc);
  animation: pulse 1.5s ease-in-out infinite;
}

.sync-status[data-status="error"] .sync-status-dot {
  background: #ef4444;
}

.sync-status[data-status="offline"] .sync-status-dot {
  background: var(--viewer-text-soft, #7c8a99);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

.sync-status-text {
  flex: 1;
}

.sync-status-retry {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: var(--viewer-accent, #0077cc);
  color: #fff;
  font-size: 0.8em;
  cursor: pointer;
  transition: background 0.2s;
}

.sync-status-retry:hover {
  background: var(--viewer-accent-strong, #00a7cc);
}

.sync-status-manual {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: var(--viewer-accent, #0077cc);
  color: #fff;
  font-size: 0.8em;
  cursor: pointer;
  transition: background 0.2s;
}

.sync-status-manual:hover {
  background: var(--viewer-accent-strong, #00a7cc);
}

.sync-status-manual:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Login Dialog */
.login-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--viewer-backdrop-bg, rgba(15, 23, 42, 0.5));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.login-dialog-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.login-dialog {
  background: var(--viewer-dialog-bg, rgba(255, 255, 255, 0.95));
  border: 1px solid var(--viewer-dialog-border, rgba(0, 119, 204, 0.25));
  border-radius: 16px;
  box-shadow: var(--viewer-dialog-shadow, 0 20px 40px rgba(15, 23, 42, 0.2));
  padding: 24px;
  width: 90%;
  max-width: 360px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.login-dialog-backdrop.show .login-dialog {
  transform: scale(1);
}

.login-dialog-title {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--viewer-text, #0f172a);
  margin-bottom: 8px;
  text-align: center;
}

.login-dialog-desc {
  font-size: 0.9em;
  color: var(--viewer-text-muted, #5b6b7c);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.5;
}

.login-dialog-warn {
  font-size: 0.8em;
  color: #ef4444;
  margin: -12px 0 16px;
  text-align: center;
  line-height: 1.4;
}

.login-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-dialog-cancel {
  margin-top: 8px;
  padding: 8px 12px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.2s;
  display: block;
  margin-left: auto;
  border-radius: 6px;
}

.login-dialog-cancel:hover {
  background: #dc2626;
}

/* Migration Dialog */
.migration-dialog {
  max-width: 420px;
}

.migration-dialog-profiles {
  background: var(--viewer-stats-item-bg, rgba(15, 23, 42, 0.05));
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.migration-profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--viewer-divider, rgba(15, 23, 42, 0.08));
}

.migration-profile-item:last-child {
  border-bottom: none;
}

.migration-profile-name {
  font-weight: 500;
  color: var(--viewer-text, #0f172a);
}

.migration-profile-count {
  font-size: 0.85em;
  color: var(--viewer-text-muted, #5b6b7c);
}

.migration-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.migration-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: 1px solid transparent;
}

.migration-btn-upload {
  background: var(--viewer-accent, #0077cc);
  color: #fff;
  border-color: var(--viewer-accent, #0077cc);
}

.migration-btn-upload:hover {
  background: var(--viewer-accent-strong, #00a7cc);
  border-color: var(--viewer-accent-strong, #00a7cc);
}

.migration-btn-local {
  background: var(--viewer-dialog-btn-bg, rgba(0, 119, 204, 0.08));
  color: var(--viewer-text, #0f172a);
  border-color: var(--viewer-dialog-btn-border, rgba(0, 119, 204, 0.5));
}

.migration-btn-local:hover {
  background: var(--viewer-accent-tint, rgba(0, 119, 204, 0.15));
}

.migration-btn-later {
  background: transparent;
  color: var(--viewer-text-muted, #5b6b7c);
  border: none;
  padding: 8px;
}

.migration-btn-later:hover {
  color: var(--viewer-text, #0f172a);
}

/* Header sync indicator (compact) */
.header-sync-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--viewer-stats-item-bg, rgba(15, 23, 42, 0.05));
  font-size: 0.75em;
  color: var(--viewer-text-muted, #5b6b7c);
}

.header-sync-indicator[data-status="synced"] {
  color: #22c55e;
}

.header-sync-indicator[data-status="syncing"] {
  color: var(--viewer-accent, #0077cc);
}

.header-sync-indicator[data-status="error"] {
  color: #ef4444;
}

.header-sync-indicator .sync-status-dot {
  width: 6px;
  height: 6px;
}

/* Google icon */
.google-icon {
  display: inline-flex;
}

/* Dark theme adjustments */
html[data-theme="dark"] .auth-btn-google {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--viewer-text, #e2e8f0);
}

html[data-theme="dark"] .auth-btn-google:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 480px) {

  .login-dialog,
  .migration-dialog {
    width: 95%;
    padding: 20px;
  }

  .login-dialog-title {
    font-size: 1.1em;
  }

  .login-dialog-desc {
    font-size: 0.85em;
  }
}