/* ══════════════════════════════════════════════════════
   SYNC SETTINGS MODAL
══════════════════════════════════════════════════════ */

#sync-settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease-out;
}

#sync-settings-modal.open {
  display: flex;
}

.sync-modal-content {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease-out;
}

.sync-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 12px;
}

.sync-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.sync-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-modal-close:hover {
  color: #333;
}

#sync-status {
  background: #f5f5f5;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.sync-status-item {
  padding: 8px 0;
  font-size: 0.95rem;
  color: #333;
  display: flex;
  justify-content: space-between;
}

.sync-status-item code {
  background: #e0e0e0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════
   SETUP PANELS
══════════════════════════════════════════════════════ */

.sync-panel {
  margin-bottom: 20px;
}

.sync-panel h3 {
  margin: 16px 0 12px 0;
  font-size: 1.1rem;
  color: #333;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.sync-section-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.sync-tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.sync-tab-btn.active {
  color: #3a9c3a;
  border-bottom-color: #3a9c3a;
}

.sync-tab-btn:hover {
  color: #333;
}

#sync-setup-panel,
#sync-connected-panel {
  display: none;
}

/* ══════════════════════════════════════════════════════
   FORM FIELDS
══════════════════════════════════════════════════════ */

.sync-form-group {
  margin-bottom: 16px;
}

.sync-form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
  font-size: 0.95rem;
}

.sync-form-group input,
.sync-form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
}

.sync-form-group input:focus,
.sync-form-group textarea:focus {
  outline: none;
  border-color: #3a9c3a;
  box-shadow: 0 0 0 2px rgba(58, 156, 58, 0.1);
}

.sync-form-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════
   KEY DISPLAY
══════════════════════════════════════════════════════ */

#sync-generated-keys {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.sync-key-display {
  margin-bottom: 16px;
}

.sync-key-display:last-child {
  margin-bottom: 0;
}

.sync-key-display label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
  font-size: 0.95rem;
}

.sync-key-box {
  display: flex;
  gap: 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  align-items: center;
}

.sync-key-box code {
  flex: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  word-break: break-all;
  color: #333;
}

.copy-btn {
  background: #3a9c3a;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.copy-btn:hover {
  background: #2e7d2e;
}

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

/* ══════════════════════════════════════════════════════
   INSTRUCTIONS
══════════════════════════════════════════════════════ */

.sync-instructions {
  background: #e8f5e9;
  padding: 12px;
  border-left: 4px solid #3a9c3a;
  border-radius: 4px;
  margin-top: 16px;
}

.sync-instructions p {
  margin: 8px 0;
  color: #333;
  font-size: 0.95rem;
}

.sync-instructions ol {
  margin: 8px 0;
  padding-left: 20px;
  color: #333;
}

.sync-instructions li {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */

.sync-button-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.sync-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.sync-btn-primary {
  background: #3a9c3a;
  color: white;
  flex: 1;
  min-width: 120px;
}

.sync-btn-primary:hover {
  background: #2e7d2e;
}

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

.sync-btn-secondary {
  background: #e0e0e0;
  color: #333;
  flex: 1;
  min-width: 120px;
}

.sync-btn-secondary:hover {
  background: #d0d0d0;
}

.sync-btn-secondary:disabled {
  background: #f0f0f0;
  cursor: not-allowed;
}

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

.sync-btn-danger:hover {
  background: #c82333;
}

/* ══════════════════════════════════════════════════════
   MESSAGES
══════════════════════════════════════════════════════ */

.sync-message {
  display: none;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  animation: slideDown 0.2s ease-out;
}

.sync-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.sync-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ══════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .sync-modal-content {
    max-width: 95%;
    padding: 16px;
  }

  .sync-button-group {
    flex-direction: column;
  }

  .sync-btn {
    width: 100%;
  }
}
