/**
 * ProRank Toggle Component - Unified Design System
 *
 * Clean, single implementation following ProRank brand guidelines
 * Blue gradient when active, subtle gray when inactive
 *
 * @since 3.0.0
 */

/* ============================================
   TOGGLE BUTTON - Core Structure
   ============================================ */

.prorank-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
}

/* Track (background) */
.prorank-toggle-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background-color: #cbd5e1;
  transition: background-color 0.3s ease;
}

/* Thumb (white circle) */
.prorank-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

/* Checked state */
.prorank-toggle--checked .prorank-toggle-track {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.prorank-toggle--checked .prorank-toggle-thumb {
  transform: translateX(24px);
}

/* Hover states */
.prorank-toggle:not(.prorank-toggle--disabled):hover .prorank-toggle-track {
  background-color: #94a3b8;
}

.prorank-toggle--checked:not(.prorank-toggle--disabled):hover .prorank-toggle-track {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

/* Focus state */
.prorank-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 24px;
}

/* Disabled state */
.prorank-toggle--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   TOGGLE WITH LABEL - Layout Container
   ============================================ */

.prorank-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.prorank-toggle-wrapper {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  width: 100% !important;
  margin-bottom: 20px !important;
  position: relative !important;
  clear: both !important;
}

.prorank-toggle-content {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 16px !important;
}

.prorank-toggle-label-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--prorank-text);
  line-height: 1.4;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  flex: 1 !important;
  padding-right: 20px !important;
}

.prorank-toggle-label-text strong {
  display: block !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

.prorank-toggle-label-text span {
  display: block !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: var(--prorank-text-secondary) !important;
  line-height: 1.5 !important;
}

.prorank-toggle-help {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--prorank-text-secondary);
  line-height: 1.4;
}

/* ============================================
   TOGGLE ROW - Settings Layout
   ============================================ */

.prorank-toggle-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 16px 20px;
  margin-bottom: 20px !important;
  border: 1px solid var(--prorank-border);
  border-radius: var(--prorank-radius);
  background: var(--prorank-bg);
  transition: all 0.2s ease;
  position: relative !important;
  clear: both !important;
}

.prorank-toggle-row:hover {
  border-color: var(--prorank-border-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.prorank-toggle-row .prorank-toggle-label {
  flex: 1 !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  position: relative !important; /* NEVER absolute */
}

.prorank-toggle-row .prorank-toggle-label strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--prorank-text);
  line-height: 1.4;
}

.prorank-toggle-row .prorank-toggle-label span,
.prorank-toggle-row .prorank-toggle-label .prorank-toggle-description {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--prorank-text-secondary);
  line-height: 1.5;
}

/* Toggle slider in toggle row - positioned on the right */
.prorank-toggle-row .prorank-toggle-slider {
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

/* ============================================
   TOGGLE GROUP - Multiple Toggles Container
   ============================================ */

.prorank-toggles-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ============================================
   SIZE VARIANTS
   ============================================ */

/* Small */
.prorank-toggle--small {
  width: 40px;
  height: 20px;
}

.prorank-toggle--small .prorank-toggle-track {
  border-radius: 20px;
}

.prorank-toggle--small .prorank-toggle-thumb {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}

.prorank-toggle--small.prorank-toggle--checked .prorank-toggle-thumb {
  transform: translateX(20px);
}

/* Large */
.prorank-toggle--large {
  width: 60px;
  height: 28px;
}

.prorank-toggle--large .prorank-toggle-track {
  border-radius: 28px;
}

.prorank-toggle--large .prorank-toggle-thumb {
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
}

.prorank-toggle--large.prorank-toggle--checked .prorank-toggle-thumb {
  transform: translateX(32px);
}

/* ============================================
   STANDARD TOGGLE ROW - PREMIUM PLUGIN STANDARD
   Mandatory design for ALL toggles across the plugin
   ============================================ */

.prorank-toggle-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 16px !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 6px !important;
  margin-bottom: 12px !important;
  background: #fff !important;
  min-height: 48px !important;
  transition: all 0.2s ease !important;
}

.prorank-toggle-row:hover {
  border-color: #d1d5db !important;
  background: #f9fafb !important;
}

.prorank-toggle-row .prorank-toggle-label {
  flex: 1 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #333 !important;
  margin: 0 !important;
  padding-right: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.prorank-toggle-row .prorank-toggle-label small {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: #666 !important;
  line-height: 1.4 !important;
}

.prorank-toggle-row .prorank-toggle-slider {
  flex-shrink: 0 !important;
  margin-left: 16px !important;
}

/* Toggle group with title */
.prorank-toggle-group {
  margin-bottom: 24px !important;
}

.prorank-toggle-group .prorank-group-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #1f2937 !important;
  margin: 0 0 12px 0 !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #e5e7eb !important;
}

/* Ensure consistent spacing in panels */
.prorank-panel .prorank-toggle-row {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
}

.prorank-panel .prorank-toggle-row:last-child {
  margin-bottom: 0 !important;
}

/* ============================================
   SETTINGS PANEL INTEGRATION
   ============================================ */

.prorank-toggle-settings {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--prorank-border-light);
}

.prorank-setting-group {
  margin-bottom: 16px;
}

.prorank-setting-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--prorank-text-secondary);
  margin-bottom: 6px;
}
