/* Settings Page Styles */

.settings-container {
  max-width: var(--content-max-width, 1600px);
  margin: 0 auto;
  padding: 0 0 32px;
}

.settings-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: #1c1e21;
  margin: 0 0 12px 0;
}

.section-description {
  font-size: 14px;
  color: #65676b;
  line-height: 1.6;
  margin: 0 0 32px 0;
}

/* Form Styles */

.form-group {
  margin-bottom: 24px;
}

.form-group:last-of-type {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1c1e21;
  margin-bottom: 8px;
}

.form-label input[type="checkbox"] {
  margin-right: 8px;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  vertical-align: middle;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #1877f2;
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #8a8d91;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  font-size: 12px;
  color: #65676b;
  margin: 6px 0 0 0;
  line-height: 1.4;
}

.grid-weights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #1c1e21;
}

.form-help a {
  color: #1877f2;
  text-decoration: none;
}

.form-help a:hover {
  text-decoration: underline;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e4e6eb;
}

.floating-save-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  min-width: 210px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.floating-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.4);
}

.floating-save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.floating-save-btn:focus {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.floating-save-btn .spinner {
  font-size: 16px;
  line-height: 1;
}

.floating-save-btn.is-saving {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.floating-save-btn .spin {
  animation: spin 1s linear infinite;
}

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

@media (max-width: 640px) {
  .floating-save-btn {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    justify-content: center;
  }
}

/* Credentials List */

.credentials-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.credential-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: move;
}

.credential-item:hover {
  border-color: #1877f2;
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.1);
}

.credential-item.drag-over {
  border-color: #42b72a;
  background: #f0fdf4;
  box-shadow: 0 2px 8px rgba(66, 183, 42, 0.2);
}

.credential-item__drag-handle {
  font-size: 20px;
  color: #65676b;
  margin-right: 12px;
  cursor: grab;
  user-select: none;
  line-height: 1;
}

.credential-item__drag-handle:active {
  cursor: grabbing;
}

.credential-item__info {
  flex: 1;
}

.credential-item__name {
  font-size: 15px;
  font-weight: 600;
  color: #1c1e21;
  margin-bottom: 4px;
}

.credential-item__provider {
  font-size: 13px;
  color: #65676b;
}

.credential-item__status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.credential-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f0f2f5;
  color: #1c1e21;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.credential-status.status-badge--success {
  background: rgba(66, 183, 42, 0.12);
  color: #2d7a32;
  border-color: rgba(66, 183, 42, 0.2);
}

.credential-status.status-badge--warning {
  background: rgba(252, 160, 0, 0.12);
  color: #9f580a;
  border-color: rgba(252, 160, 0, 0.2);
}

.credential-status.status-badge--danger {
  background: rgba(231, 76, 60, 0.12);
  color: #a5281b;
  border-color: rgba(231, 76, 60, 0.2);
}

.credential-status.status-badge--info {
  background: rgba(24, 119, 242, 0.1);
  color: #1659c7;
  border-color: rgba(24, 119, 242, 0.2);
}

.credential-status.status-badge--neutral {
  background: rgba(101, 103, 107, 0.12);
  color: #42464b;
  border-color: rgba(101, 103, 107, 0.2);
}

.credential-status.status-badge--muted {
  background: rgba(148, 153, 160, 0.12);
  color: #4b4f56;
  border-color: rgba(148, 153, 160, 0.2);
}

.credential-item__meta {
  margin-top: 6px;
  font-size: 12px;
  color: #65676b;
  line-height: 1.4;
}

.credential-item__actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.btn-icon:hover {
  background: #f0f2f5;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #65676b;
  font-size: 14px;
}

/* Messages */

.success {
  background: #d4edda;
  color: #155724;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #c3e6cb;
}

/* Test Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f2f5;
  color: #65676b;
  font-size: 24px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__close:hover {
  background: #e4e6eb;
  color: #1c1e21;
}

.modal__title {
  font-size: 20px;
  font-weight: 700;
  color: #1c1e21;
  margin: 0 0 24px 0;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.test-loading {
  padding: 20px;
  text-align: center;
  color: #65676b;
  font-size: 14px;
  background: #f0f2f5;
  border-radius: 8px;
}

.test-result {
  background: #f0f2f5;
  border-radius: 8px;
  padding: 20px;
}

.test-result h3 {
  font-size: 14px;
  font-weight: 600;
  color: #1c1e21;
  margin: 0 0 12px 0;
}

.test-comment {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  line-height: 1.6;
  color: #1c1e21;
  white-space: pre-wrap;
}

.test-error {
  background: #f8d7da;
  color: #721c24;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid #f5c6cb;
}

/* Responsive */

@media (max-width: 768px) {
  .settings-section {
    padding: 20px;
  }

  .form-actions {
    flex-direction: column;
  }

  .modal__content {
    padding: 24px;
  }
}
