/* ============================================
   Image Optimization Page Styles
   Premium Unified Design
   ============================================ */

/* Page Container */
.prorank-performance-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Card Styling */
.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: hidden;
}

/* Card Header Override for Grey Background */
.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-performance-container .prorank-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Card Body */
.prorank-performance-container .prorank-card-body {
  padding: 24px;
}

/* Statistics Grid */
.prorank-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
}

.prorank-stat-item {
  text-align: center;
  padding: 15px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: transform 0.2s, box-shadow 0.2s;
}

.prorank-stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.prorank-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
  line-height: 1;
}

.prorank-stat-label {
  font-size: 13px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Toggle Rows - Unified Design with Proper Spacing */
.prorank-toggle-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 20px 24px !important;
  margin: 0 -24px !important;
  border-bottom: 1px solid #e5e7eb;
  gap: 24px;
  transition: background-color 0.2s ease;
}

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

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

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

.prorank-toggle-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.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;
}

/* Legacy support for old toggle class */
.prorank-toggle {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 12px 0 !important;
  border-bottom: 1px solid #f3f4f6;
}

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

.prorank-toggle-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prorank-toggle-label strong {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  display: block;
}

.prorank-toggle-label span {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  display: block;
}

/* Control Groups - defer to unified-settings for boxing */
.prorank-image-optimization .prorank-control-group {
  margin: 16px 0;
}

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

/* Nested control groups (for quality sliders) */
.prorank-image-optimization .prorank-toggle-row + .prorank-control-group {
  margin: 12px 0 16px 0;
  padding-left: 16px;
  border-left: 3px solid #ff6b35;
}

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

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

/* Radio Controls - Custom Horizontal Layout */
.prorank-control-label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.prorank-radio-group-horizontal {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.prorank-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  flex: 1;
  min-width: 160px;
  padding: 12px;
  background: white;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.prorank-radio-option:hover {
  border-color: #dbeafe;
  background: #f0f9ff;
}

.prorank-radio-option input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

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

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

.prorank-radio-option:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}

.prorank-radio-option:has(input:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

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

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

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

/* Range Controls */
.components-range-control {
  margin: 16px 0;
}

.components-range-control__wrapper {
  margin-top: 12px;
}

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

.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;
}

.components-range-control__number {
  width: 60px !important;
  margin-left: 12px !important;
}

/* Textarea Controls */
.prorank-performance-container .components-textarea-control__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  line-height: 1.6;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #ffffff;
}

.prorank-performance-container .components-textarea-control__input:focus {
  outline: none;
  border-color: #ff6b35;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
  background-color: #ffffff;
}

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

/* 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-info .dashicons {
  color: #2563eb;
}

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

.prorank-notice-warning .dashicons {
  color: #d97706;
}

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

.prorank-notice-success .dashicons {
  color: #16a34a;
}

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

.prorank-notice-error .dashicons {
  color: #dc2626;
}

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

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

/* Loading State */
.prorank-flex-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.prorank-text-center {
  text-align: center;
}

/* Utility Classes */
.prorank-mt-32 {
  margin-top: 32px;
}

/* Badge Styles */
.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;
}

/* Responsive Design */
@media (max-width: 768px) {
  .prorank-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .prorank-stat-item {
    padding: 12px;
  }

  .prorank-stat-value {
    font-size: 24px;
  }

  .prorank-toggle {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .prorank-toggle-label {
    width: 100%;
    margin-bottom: 8px;
  }

  .prorank-input[type="url"],
  .prorank-input[type="text"],
  .prorank-input[type="number"] {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .prorank-stats-grid {
    grid-template-columns: 1fr;
  }

  .prorank-performance-container {
    padding: 12px;
  }
}

/* Override WordPress Default Styles */
.prorank-performance-container .components-base-control {
  margin-bottom: 16px;
}

.prorank-performance-container .components-base-control__label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.prorank-performance-container .components-base-control__help {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}