/* ============================================
   Unified Settings Design System
   Consistent styling for all ProRank settings pages
   ============================================ */

/* Settings Container - Use for all settings pages */
.prorank-settings-container,
.prorank-performance-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Settings Cards - Consistent card styling */
.prorank-settings-container .prorank-card,
.prorank-performance-container .prorank-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  overflow: visible;
}

/* Card Headers - Always grey background */
.prorank-settings-container .prorank-card-header,
.prorank-performance-container .prorank-card-header {
  background-color: #f5f5f5 !important;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}

.prorank-settings-container .prorank-card-header h3,
.prorank-performance-container .prorank-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prorank-settings-container .prorank-card-header .dashicons,
.prorank-performance-container .prorank-card-header .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #6b7280;
}

/* Card Body - Consistent padding */
.prorank-settings-container .prorank-card-body,
.prorank-performance-container .prorank-card-body {
  padding: 20px;
  overflow: visible !important;
}

/* Toggle Rows - Universal toggle styling */
.prorank-toggle-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px !important;
  margin: 0 0 12px 0 !important;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  gap: 16px;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible !important;
}

.prorank-toggle-row:hover {
  background-color: #f9fafb;
}

.prorank-toggle-row:last-child {
  border-bottom: none;
}

.prorank-toggle-row:first-child {
  padding-top: 20px;
}

/* Toggle Content */
.prorank-toggle-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 60px);
}

.prorank-toggle-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prorank-toggle-header strong {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}

.prorank-toggle-description {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin-top: 2px;
}

/* Control Groups - For form elements */
.prorank-control-group {
  margin: 16px 0;
}

/* Control groups inside card body - no nested boxing */
.prorank-card-body .prorank-control-group {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

/* Standalone control groups outside cards */
.prorank-control-group:not(.prorank-card-body .prorank-control-group) {
  padding: 20px 24px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.prorank-control-group label,
.prorank-control-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.prorank-control-group .description,
.prorank-control-group p.description {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

/* Nested control groups (for dependent settings like quality sliders) */
.prorank-toggle-row + .prorank-control-group {
  margin: 12px 0 16px 0;
}

/* Standard control groups in card body */
.prorank-card-body > .prorank-control-group:last-child {
  margin-bottom: 0;
}

/* Radio Groups - Horizontal layout */
.prorank-radio-group-horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.prorank-radio-option {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 180px;
}

.prorank-radio-option:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.prorank-radio-option input[type="radio"] {
  margin-right: 10px;
  margin-top: 2px;
  flex-shrink: 0;
}

.prorank-radio-option input[type="radio"]:checked + .prorank-radio-label {
  color: #1f2937;
}

.prorank-radio-option input[type="radio"]:checked {
  accent-color: #ff6b35;
}

.prorank-radio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prorank-radio-label strong {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: block;
}

.prorank-radio-label small {
  font-size: 12px;
  color: #6b7280;
  display: block;
  line-height: 1.4;
}

/* Input Fields */
.prorank-input[type="url"],
.prorank-input[type="text"],
.prorank-input[type="number"],
.prorank-input[type="email"] {
  width: 100%;
  max-width: 400px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #ffffff;
}

.prorank-input:focus {
  outline: none;
  border-color: #ff6b35;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* WordPress Range Controls - Remove nested boxing */
.prorank-card-body .components-base-control {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Avoid WordPress backdrop overlay covering values */
.prorank-card-body .components-input-control__backdrop {
  display: none !important;
}

/* Ensure number inputs show value and look consistent */
.prorank-card-body .components-input-control__input,
.prorank-card-body input.components-input-control__input,
.prorank-card-body .components-range-control__number input,
.prorank-card-body input[type="number"] {
  color: #111827 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  -webkit-text-fill-color: #111827 !important;
  opacity: 1 !important;
  position: relative;
  z-index: 1;
  width: 72px !important;
  max-width: 72px !important;
  text-align: center !important;
}

/* Keep number control container compact */
.prorank-card-body .components-number-control {
  max-width: 100px;
  display: inline-block;
}

.prorank-card-body .components-number-control .components-input-control__container {
  max-width: 100px;
}

.prorank-control-group .components-range-control {
  margin: 0;
}

.prorank-control-group .components-base-control__field {
  margin-bottom: 0;
}

.prorank-control-group .components-range-control__wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.prorank-control-group .components-range-control__track {
  flex: 1;
  height: 6px !important;
  background: #e5e7eb !important;
  border-radius: 3px !important;
}

.prorank-control-group .components-range-control__thumb {
  width: 20px !important;
  height: 20px !important;
  background: #ff6b35 !important;
  border: 3px solid #fff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.prorank-control-group .components-range-control__number {
  width: 70px !important;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.prorank-control-group .components-base-control__help {
  margin-top: 12px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

/* Badges */
.prorank-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

.prorank-badge-success {
  background: #d1fae5;
  color: #065f46;
}

.prorank-badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.prorank-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.prorank-badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Notices */
.prorank-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
  border: 1px solid;
}

.prorank-notice .dashicons {
  flex-shrink: 0;
  font-size: 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.prorank-notice div {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.prorank-notice-info {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1e40af;
}

.prorank-notice-warning {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}

.prorank-notice-success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.prorank-notice-error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* Actions Container */
.prorank-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.prorank-actions-center {
  justify-content: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .prorank-toggle-row {
    padding: 16px !important;
    margin: 0 -24px !important;
  }

  .prorank-toggle-content {
    max-width: calc(100% - 50px);
  }

  .prorank-radio-group-horizontal {
    flex-direction: column;
  }

  .prorank-radio-option {
    min-width: 100%;
  }

  .prorank-card-body {
    padding: 16px !important;
  }
}

@media (max-width: 480px) {
  .prorank-settings-container,
  .prorank-performance-container {
    padding: 12px;
  }

  .prorank-toggle-row {
    padding: 12px !important;
    gap: 12px;
  }

  .prorank-toggle-content {
    width: 100%;
    max-width: 100%;
  }
}
