/* Admin styles for Performance Tweaks settings */

/* Header Styling */
.rhptp-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0 -20px 30px -20px;
  padding: 32px 20px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}

.rhptp-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></svg>') repeat;
  background-size: 60px 60px;
  opacity: 0.3;
}

.rhptp-header-main {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.rhptp-header-icon {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.rhptp-header-icon .dashicons {
  font-size: 32px;
  width: 32px;
  height: 32px;
  color: #ffffff;
}

.rhptp-header-content {
  flex: 1;
}

.rhptp-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rhptp-subtitle {
  margin: 0;
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

.rhptp-header-meta {
  display: flex;
  align-items: center;
}

.rhptp-badge {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  color: #ffffff;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rhptp-page-intro {
  margin: 24px 0 0 0;
  position: relative;
  z-index: 1;
}

.rhptp-page-intro p {
  margin: 0;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  line-height: 1.5;
  max-width: 800px;
}

/* Legacy header styles - remove/update */
.rhptp-settings h1 {
  display: none; /* Hide old header */
}

.rhptp-settings .form-table th {
  vertical-align: middle;
}

.rhptp-section-intro {
  margin: 0 0 20px 0;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.6;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.rhptp-settings .form-table th { vertical-align: top; }
.rhptp-settings .form-table .description { margin-top: 8px; color: #6b7280; font-size: 13px; line-height: 1.5; }
.rhptp-settings code { 
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', monospace;
  font-size: 12px;
  color: #475569;
}

.rhptp-save-top { 
  margin: 20px 0 24px 0;
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}

.rhptp-save-top .button-primary {
  margin: 0;
}

/* Tabs */
.rhptp-tabs {
  margin: 20px 0 0 0;
  border-bottom: none;
  background: #ffffff;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rhptp-tabs .nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
  min-height: 44px;
  box-sizing: border-box;
}

.rhptp-tabs .nav-tab:hover {
  background: #f3f4f6;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.rhptp-tabs .nav-tab:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6, 0 2px 8px rgba(0,0,0,0.08);
  background: #f3f4f6;
  color: #374151;
}

.rhptp-tabs .nav-tab.nav-tab-active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.rhptp-tabs .nav-tab .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  color: inherit;
  transition: transform 0.2s ease;
}

.rhptp-tabs .nav-tab:hover .dashicons,
.rhptp-tabs .nav-tab.nav-tab-active .dashicons {
  transform: scale(1.1);
}

.rhptp-tabs .nav-tab span:last-child {
  transition: transform 0.2s ease;
}

.rhptp-tabs .nav-tab:hover span:last-child {
  transform: translateX(1px);
}

.rhptp-tab-panel {
  display: none;
  margin-top: 24px;
  animation: fadeIn 0.3s ease-in-out;
}

.rhptp-tab-panel.active {
  display: block;
}

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

/* Enhanced table and card layout */
.rhptp-settings .form-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.rhptp-settings .form-table tbody { display: grid; grid-template-columns: 1fr; gap: 16px; }
.rhptp-settings .form-table tr { 
  display: block;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
  margin: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
}

.rhptp-settings .form-table tr:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.03);
  transform: translateY(-1px);
  border-color: #d1d5db;
}

.rhptp-settings .form-table tr::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.rhptp-settings .form-table tr:hover::before {
  opacity: 1;
}

.rhptp-settings .form-table th,
.rhptp-settings .form-table td { 
  display: block; 
  width: auto;
  padding: 20px 24px;
  border: none;
}
.rhptp-settings .form-table th { 
  margin-bottom: 0;
  padding-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}

.rhptp-settings .form-table td {
  padding-top: 0;
}

@media (min-width: 1200px) {
  .rhptp-settings .form-table tbody { grid-template-columns: repeat(2, 1fr); }
}

.rhptp-note {
  margin: 12px 0 0 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  color: #92400e;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.rhptp-note::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: #f59e0b;
  border-radius: 10px 0 0 10px;
}

.rhptp-note strong {
  color: #78350f;
  font-weight: 600;
}

.rhptp-toggle-group {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 32px;
}

.rhptp-desc {
  color: #6b7280;
  line-height: 1.5;
  font-size: 14px;
  margin-top: 2px;
}

.rhptp-tab-panel > .rhptp-section-intro:first-child { margin-bottom: 10px; }

/* Enhanced sticky save bar */
.rhptp-sticky-save {
  position: fixed;
  left: 160px; /* accounts for admin menu width */
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: none;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.rhptp-sticky-inner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rhptp-sticky-inner:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.25);
}

.rhptp-dirty-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.rhptp-dirty-msg .dashicons { 
  color: #60a5fa;
  font-size: 16px;
  width: 16px;
  height: 16px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.rhptp-sticky-save-btn {
  margin-left: auto;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  min-width: 120px;
}

.rhptp-sticky-save-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.rhptp-sticky-save-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 2px 8px rgba(59, 130, 246, 0.3);
}

.rhptp-sticky-save-btn:active {
  transform: translateY(0);
}

/* Save progress states */
.rhptp-sticky-save-btn.saving {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  cursor: not-allowed;
  position: relative;
  overflow: hidden;
}

.rhptp-sticky-save-btn.saving::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    left: 100%;
  }
}

.rhptp-sticky-save-btn.saved {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: saveSuccess 0.6s ease-out;
}

@keyframes saveSuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Progress indicator */
.rhptp-save-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.rhptp-progress-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #60a5fa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Reset button enhancement */
.rhptp-reset-section {
  margin-top: 40px;
  padding: 20px;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fca5a5;
  border-radius: 12px;
  text-align: center;
}

.rhptp-reset-section h3 {
  margin: 0 0 12px 0;
  color: #dc2626;
  font-size: 16px;
  font-weight: 600;
}

.rhptp-reset-section p {
  margin: 0 0 16px 0;
  color: #7f1d1d;
  font-size: 14px;
}

.rhptp-reset-btn {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  display: inline-block;
}

.rhptp-reset-btn:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  color: white;
}

.rhptp-reset-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3);
}

/* Enhanced tooltips */
.rhptp-tip {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  position: relative;
  cursor: help;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.rhptp-tip:hover {
  transform: scale(1.1);
}

.rhptp-tip .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 16px;
  color: #9ca3af;
  transition: color 0.2s ease;
  padding: 2px;
  border-radius: 50%;
  background: rgba(156, 163, 175, 0.1);
}

.rhptp-tip:hover .dashicons {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.rhptp-tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 1000;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 10px;
  white-space: nowrap;
  max-width: 300px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}

.rhptp-tip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.rhptp-tip:hover .rhptp-tip-text,
.rhptp-tip:focus .rhptp-tip-text {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.rhptp-tip:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  border-radius: 50%;
}

/* Improved tooltip positioning for edge cases */
.rhptp-tip-text.tooltip-left {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(4px);
}

.rhptp-tip:hover .rhptp-tip-text.tooltip-left,
.rhptp-tip:focus .rhptp-tip-text.tooltip-left {
  transform: translateX(0) translateY(-4px);
}

/* Enhanced Toggle Switch */
.rhptp-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.rhptp-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.rhptp-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 28px;
  border: 2px solid #f3f4f6;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.rhptp-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.05);
}

.rhptp-switch input:checked + .rhptp-slider {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rhptp-switch input:focus + .rhptp-slider {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 2px 4px rgba(0,0,0,0.06);
}

.rhptp-switch input:checked + .rhptp-slider:before {
  transform: translateX(24px);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
}

/* Improved toggle group layout */
.rhptp-toggle-group {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 32px;
}

.rhptp-desc {
  color: #6b7280;
  line-height: 1.5;
  font-size: 14px;
  margin-top: 2px;
}

/* Enhanced button styling */
.rhptp-settings .button-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: none;
}

.rhptp-settings .button-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.rhptp-settings .button-primary:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 2px 8px rgba(59, 130, 246, 0.25);
  outline: none;
}

.rhptp-settings .button-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Enhanced input styling */
.rhptp-settings input[type="text"],
.rhptp-settings input[type="number"],
.rhptp-settings textarea {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.rhptp-settings input[type="text"]:focus,
.rhptp-settings input[type="number"]:focus,
.rhptp-settings textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 3px rgba(0,0,0,0.05);
  outline: none;
}

.rhptp-settings textarea {
  min-height: 100px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', monospace;
}



/* Comprehensive Dark Mode Support */

/* WordPress admin color scheme: midnight */
[data-wp-admin-color-scheme="midnight"] .rhptp-settings,
.admin-color-midnight .rhptp-settings {
  --rhptp-bg-primary: #1e1e1e;
  --rhptp-bg-secondary: #2d2d2d;
  --rhptp-bg-card: #2d2d2d;
  --rhptp-border: #404040;
  --rhptp-text-primary: #e4e4e7;
  --rhptp-text-secondary: #a1a1aa;
  --rhptp-accent: #60a5fa;
}

/* WordPress admin color scheme: ectoplasm */
[data-wp-admin-color-scheme="ectoplasm"] .rhptp-settings,
.admin-color-ectoplasm .rhptp-settings {
  --rhptp-bg-primary: #1a2e1a;
  --rhptp-bg-secondary: #263826;
  --rhptp-bg-card: #263826;
  --rhptp-border: #3d4a3d;
  --rhptp-text-primary: #e4e7e4;
  --rhptp-text-secondary: #a8b5a8;
  --rhptp-accent: #5fb85f;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  .rhptp-settings {
    --rhptp-bg-primary: #1f2937;
    --rhptp-bg-secondary: #374151;
    --rhptp-bg-card: #374151;
    --rhptp-border: #4b5563;
    --rhptp-text-primary: #f9fafb;
    --rhptp-text-secondary: #d1d5db;
    --rhptp-accent: #60a5fa;
  }

  /* Dark mode header */
  .rhptp-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: var(--rhptp-border);
  }

  .rhptp-header-icon {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
  }

  .rhptp-badge {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
  }

  /* Dark mode tabs */
  .rhptp-tabs {
    background: var(--rhptp-bg-card);
    border-color: var(--rhptp-border);
  }

  .rhptp-tabs .nav-tab {
    color: var(--rhptp-text-secondary);
  }

  .rhptp-tabs .nav-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--rhptp-text-primary);
  }

  .rhptp-tabs .nav-tab:focus {
    background: rgba(255,255,255,0.05);
    color: var(--rhptp-text-primary);
    box-shadow: 0 0 0 2px var(--rhptp-accent);
  }

  .rhptp-tabs .nav-tab.nav-tab-active {
    background: linear-gradient(135deg, var(--rhptp-accent) 0%, #3b82f6 100%);
    color: #ffffff;
  }

  /* Dark mode section intro */
  .rhptp-section-intro {
    background: linear-gradient(135deg, var(--rhptp-bg-secondary) 0%, #2d3748 100%);
    border-color: var(--rhptp-border);
    color: var(--rhptp-text-secondary);
  }

  /* Dark mode cards */
  .rhptp-settings .form-table tr {
    background: var(--rhptp-bg-card);
    border-color: var(--rhptp-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
  }

  .rhptp-settings .form-table tr:hover {
    border-color: #6b7280;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  }

  .rhptp-settings .form-table th {
    color: var(--rhptp-text-primary);
  }

  .rhptp-settings .form-table .description {
    color: var(--rhptp-text-secondary);
  }

  .rhptp-desc {
    color: var(--rhptp-text-secondary);
  }

  /* Dark mode toggles */
  .rhptp-slider {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    border-color: var(--rhptp-border);
  }

  .rhptp-switch input:checked + .rhptp-slider {
    background: linear-gradient(135deg, var(--rhptp-accent) 0%, #3b82f6 100%);
    border-color: var(--rhptp-accent);
  }

  /* Dark mode buttons */
  .rhptp-settings .button-primary {
    background: linear-gradient(135deg, var(--rhptp-accent) 0%, #3b82f6 100%);
  }

  .rhptp-settings .button-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  }

  /* Dark mode inputs */
  .rhptp-settings input[type="text"],
  .rhptp-settings input[type="number"],
  .rhptp-settings textarea {
    background: var(--rhptp-bg-secondary);
    border-color: var(--rhptp-border);
    color: var(--rhptp-text-primary);
  }

  .rhptp-settings input[type="text"]:focus,
  .rhptp-settings input[type="number"]:focus,
  .rhptp-settings textarea:focus {
    border-color: var(--rhptp-accent);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    background: var(--rhptp-bg-card);
  }

  /* Dark mode code blocks */
  .rhptp-settings code {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: var(--rhptp-border);
    color: #9ca3af;
  }

  /* Dark mode notes */
  .rhptp-note {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: #f59e0b;
    color: #fbbf24;
  }

  .rhptp-note strong {
    color: #fcd34d;
  }

  /* Dark mode tooltips */
  .rhptp-tip .dashicons {
    color: var(--rhptp-text-secondary);
    background: rgba(156, 163, 175, 0.05);
  }

  .rhptp-tip:hover .dashicons {
    color: var(--rhptp-accent);
    background: rgba(96, 165, 250, 0.1);
  }

  .rhptp-tip-text {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: rgba(255,255,255,0.1);
    color: var(--rhptp-text-primary);
  }

  .rhptp-tip-text::after {
    border-top-color: #0f172a;
  }

  /* Dark mode sticky save bar */
  .rhptp-sticky-inner {
    background: var(--rhptp-bg-primary);
    color: var(--rhptp-text-primary);
    border: 1px solid var(--rhptp-border);
  }

  .rhptp-dirty-msg .dashicons {
    color: var(--rhptp-accent);
  }
}

/* Legacy dark mode support */
@media (prefers-color-scheme: dark) {
  .rhptp-desc {
    color: #d1d5db;
  }
  
  .rhptp-slider {
    background-color: #4b5563;
  }
  
  .rhptp-switch input:checked + .rhptp-slider {
    background-color: #60a5fa;
  }
}

/* Comprehensive responsive design */

/* Large screens (1200px+) */
@media (min-width: 1200px) {
  .rhptp-settings .form-table tbody { grid-template-columns: repeat(2, 1fr); }
  .rhptp-header {
    margin: 0 -20px 30px -20px;
  }
}

/* Medium screens (768px - 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
  .rhptp-settings .form-table tbody { grid-template-columns: 1fr; }
  .rhptp-tabs {
    padding: 6px;
    gap: 2px;
  }
  .rhptp-tabs .nav-tab {
    padding: 10px 16px;
    font-size: 13px;
    gap: 6px;
  }
}

/* Mobile and tablet screens (max-width: 782px) */
@media (max-width: 782px) {
  .rhptp-header {
    margin: 0 -20px 20px -20px;
    padding: 24px 20px;
    border-radius: 0 0 8px 8px;
  }
  
  .rhptp-header-main {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .rhptp-header-icon {
    align-self: center;
    padding: 12px;
  }
  
  .rhptp-header-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
  }
  
  .rhptp-title {
    font-size: 24px;
    margin-bottom: 6px;
  }
  
  .rhptp-subtitle {
    font-size: 15px;
  }
  
  .rhptp-header-meta {
    order: -1;
  }
  
  .rhptp-page-intro {
    margin-top: 16px;
    text-align: left;
  }
  
  .rhptp-tabs {
    flex-direction: column;
    padding: 8px;
    gap: 4px;
  }
  
  .rhptp-tabs .nav-tab {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 14px;
    min-height: 48px;
  }
  
  .rhptp-settings .form-table tbody {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .rhptp-settings .form-table th,
  .rhptp-settings .form-table td {
    padding: 16px 20px;
  }
  
  .rhptp-settings .form-table th {
    font-size: 14px;
    padding-bottom: 6px;
  }
  
  .rhptp-toggle-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .rhptp-switch {
    align-self: flex-start;
  }
  
  .rhptp-desc {
    font-size: 13px;
    margin-top: 0;
  }
  
  .rhptp-section-intro {
    padding: 14px 16px;
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  .rhptp-note {
    padding: 14px 16px;
    font-size: 13px;
  }
  
  .rhptp-save-top {
    margin: 16px 0 20px 0;
    padding: 12px 0;
  }
  
  .rhptp-save-top .button-primary {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 15px;
  }
  
  .rhptp-settings input[type="text"],
  .rhptp-settings input[type="number"],
  .rhptp-settings textarea {
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 6px;
  }
  
  .rhptp-settings textarea {
    min-height: 80px;
  }
  
  /* Enhanced mobile tooltip behavior */
  .rhptp-tip-text {
    max-width: 250px;
    font-size: 12px;
    padding: 10px 12px;
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
  }
  
  .rhptp-tip:hover .rhptp-tip-text,
  .rhptp-tip:focus .rhptp-tip-text {
    transform: translateX(0) translateY(-4px);
  }
  
  .rhptp-tip-text::after {
    left: auto;
    right: 16px;
    transform: translateX(0);
  }
  
  /* Sticky save bar mobile adjustments */
  .rhptp-sticky-save { 
    left: 20px; 
    right: 20px; 
    bottom: 20px;
  }
  
  .rhptp-sticky-inner {
    padding: 12px 16px;
    border-radius: 6px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .rhptp-sticky-save-btn {
    margin-left: 0;
    width: 100%;
  }
}

/* Small mobile screens (max-width: 480px) */
@media (max-width: 480px) {
  .rhptp-header {
    padding: 20px 16px;
  }
  
  .rhptp-title {
    font-size: 22px;
  }
  
  .rhptp-subtitle {
    font-size: 14px;
  }
  
  .rhptp-tabs {
    margin: 16px -20px 0 -20px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .rhptp-tab-panel {
    margin-top: 20px;
  }
  
  .rhptp-settings .form-table th,
  .rhptp-settings .form-table td {
    padding: 14px 16px;
  }
  
  .rhptp-section-intro {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .rhptp-tabs .nav-tab {
    min-height: 48px;
    padding: 12px 20px;
  }
  
  .rhptp-switch {
    width: 56px;
    height: 32px;
  }
  
  .rhptp-slider:before {
    height: 24px;
    width: 24px;
    left: 2px;
    top: 2px;
  }
  
  .rhptp-switch input:checked + .rhptp-slider:before {
    transform: translateX(26px);
  }
  
  .rhptp-tip {
    padding: 8px;
    margin-left: 4px;
  }
  
  .rhptp-tip .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
  }
}

/* Final polish and accessibility enhancements */

/* Smooth transitions for loaded state */
.rhptp-loaded * {
  transition-property: color, background-color, border-color, box-shadow, transform;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Screen reader only class */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Enhanced focus indicators */
.rhptp-settings *:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.rhptp-settings input:focus,
.rhptp-settings button:focus,
.rhptp-settings a:focus {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #3b82f6;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .rhptp-settings *,
  .rhptp-settings *::before,
  .rhptp-settings *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .rhptp-progress-spinner {
    animation: none;
  }
  
  .rhptp-dirty-msg .dashicons {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .rhptp-settings .form-table tr {
    border-width: 2px;
    border-color: #000000;
  }
  
  .rhptp-tabs {
    border-width: 2px;
    border-color: #000000;
  }
  
  .rhptp-tabs .nav-tab.nav-tab-active {
    background: #000000;
    color: #ffffff;
  }
  
  .rhptp-switch input:checked + .rhptp-slider {
    background: #000000;
    border-color: #000000;
  }
}

/* Print styles */
@media print {
  .rhptp-header {
    background: none !important;
    color: #000000 !important;
    box-shadow: none !important;
  }
  
  .rhptp-tabs,
  .rhptp-sticky-save,
  .rhptp-reset-section {
    display: none !important;
  }
  
  .rhptp-tab-panel {
    display: block !important;
  }
  
  .rhptp-settings .form-table tr {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
  }
}

/* Loading state */
.rhptp-settings.loading {
  opacity: 0.7;
  pointer-events: none;
}

.rhptp-settings.loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Performance optimizations */
.rhptp-settings {
  contain: layout style;
}

.rhptp-tab-panel {
  contain: layout;
}

.rhptp-settings .form-table tr {
  will-change: transform, box-shadow;
}

/* Browser-specific fixes */
/* Firefox */
@-moz-document url-prefix() {
  .rhptp-switch {
    margin-top: 1px;
  }
}

/* Safari */
@supports (-webkit-appearance: none) {
  .rhptp-settings input[type="text"],
  .rhptp-settings input[type="number"],
  .rhptp-settings textarea {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Edge */
@supports (-ms-overflow-style: none) {
  .rhptp-settings textarea {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
}

/* Additional polish */
.rhptp-settings .form-table tr:first-child {
  margin-top: 0;
}

.rhptp-settings .form-table tr:last-child {
  margin-bottom: 0;
}

/* Success states */
.rhptp-settings.saved .rhptp-tab-panel.active {
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { background-color: transparent; }
  50% { background-color: rgba(16, 185, 129, 0.05); }
  100% { background-color: transparent; }
}