/**
 * Dashboard Page Styles
 */

/* Dashboard Container */
.prorank-dashboard-page {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Dashboard Header */
.prorank-dashboard-header {
  margin-bottom: 32px;
}

.prorank-dashboard-title {
  font-size: 32px !important;
  font-weight: 700 !important;
  color: var(--pr-gray-900, #18181b) !important;
  margin: 0 0 8px !important;
  letter-spacing: -0.025em;
}

.prorank-dashboard-subtitle {
  font-size: 16px;
  color: var(--pr-gray-600, #52525b);
  margin: 0;
}

.prorank-dashboard-actions {
  display: flex;
  gap: 12px;
}

.prorank-upgrade-button {
  background: linear-gradient(
    135deg,
    var(--pr-primary, #2563eb) 0%,
    var(--pr-primary-dark, #1e3a8a) 100%
  ) !important;
  border: none !important;
  box-shadow: 0 4px 12px rgb(67 56 202 / 30%) !important;
}

.prorank-upgrade-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgb(67 56 202 / 40%) !important;
}

/* License Banner */
.prorank-license-banner {
  margin-bottom: 24px;
}

.prorank-license-card {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
  overflow: hidden;
}

.prorank-license-card--free {
  border-color: var(--pr-gray-300, #d4d4d8);
  background: linear-gradient(135deg, rgb(244 244 245 / 50%) 0%, rgb(255 255 255 / 100%) 100%);
}

.prorank-license-card--core,
.prorank-license-card--pro {
  border-color: rgb(139 92 246 / 30%);
  background: linear-gradient(135deg, rgb(139 92 246 / 5%) 0%, rgb(255 255 255 / 100%) 100%);
}

.prorank-license-card--business {
  border-color: rgb(67 56 202 / 30%);
  background: linear-gradient(135deg, rgb(67 56 202 / 5%) 0%, rgb(255 255 255 / 100%) 100%);
}

.prorank-license-card--agency {
  border-color: rgb(239 68 68 / 30%);
  background: linear-gradient(135deg, rgb(239 68 68 / 5%) 0%, rgb(255 255 255 / 100%) 100%);
}

.prorank-license-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--pr-gray-900, #18181b);
}

.prorank-license-info p {
  margin: 0;
  color: var(--pr-gray-600, #52525b);
}

/* Dashboard Tabs */
.prorank-dashboard-tabs {
  margin-bottom: 20px;
}

.prorank-dashboard-tabs .components-tab-panel__tabs {
  border-bottom: 2px solid var(--pr-gray-200, #e4e4e7);
  margin-bottom: 24px;
}

.prorank-dashboard-tabs .components-tab-panel__tabs-item {
  padding: 12px 24px;
  font-weight: 500;
  color: var(--pr-gray-600, #52525b);
  border-bottom: 3px solid transparent;
  transition: var(--pr-transition-fast, all 0.15s ease);
  margin-bottom: -2px;
}

.prorank-dashboard-tabs .components-tab-panel__tabs-item.is-active {
  color: var(--pr-primary, #2563eb);
  border-bottom-color: var(--pr-primary, #2563eb);
}

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

/* Overview Tab Styles */
.prorank-overview-tab > * + * {
  margin-top: 24px;
}

/* Stats Grid */
.prorank-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.prorank-stat-card {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
  transition: var(--pr-transition-fast, all 0.15s ease);
}

.prorank-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(0 0 0 / 8%);
}

.prorank-stat-card .components-card__body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.prorank-stat-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--pr-gray-100, #f4f4f5);
}

.prorank-stat-card--success .prorank-stat-icon {
  background: rgb(16 185 129 / 10%);
  color: var(--pr-accent-green, #10b981);
}

.prorank-stat-card--warning .prorank-stat-icon {
  background: rgb(245 158 11 / 10%);
  color: var(--pr-accent-orange, #f59e0b);
}

.prorank-stat-card--info .prorank-stat-icon {
  background: rgb(59 130 246 / 10%);
  color: var(--pr-accent-blue, #3b82f6);
}

.prorank-stat-icon .dashicons {
  font-size: 24px;
  line-height: 1;
}

.prorank-stat-content {
  flex: 1;
}

.prorank-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--pr-gray-900, #18181b);
  line-height: 1.2;
}

.prorank-stat-label {
  display: block;
  font-size: 14px;
  color: var(--pr-gray-600, #52525b);
  margin-top: 4px;
}

/* Modules Overview */
.prorank-modules-overview {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

.prorank-modules-loading {
  text-align: center;
  padding: 40px;
}

.prorank-modules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prorank-module-status {
  padding: 12px 16px;
  background: var(--pr-gray-50, #fafafa);
  border-radius: 8px;
  transition: var(--pr-transition-fast, all 0.15s ease);
}

.prorank-module-status:hover {
  background: var(--pr-gray-100, #f4f4f5);
}

.prorank-module-name {
  font-weight: 500;
  color: var(--pr-gray-900, #18181b);
}

.prorank-module-indicator {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
}

.prorank-module-indicator.is-active {
  background: rgb(16 185 129 / 10%);
  color: var(--pr-accent-green, #10b981);
}

.prorank-module-indicator.is-inactive {
  background: var(--pr-gray-200, #e4e4e7);
  color: var(--pr-gray-600, #52525b);
}

/* Quick Actions */
.prorank-quick-actions {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

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

.prorank-action-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  transition: var(--pr-transition-fast, all 0.15s ease) !important;
}

.prorank-action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
}

.prorank-action-button .dashicons {
  font-size: 18px;
  line-height: 1;
}

/* Recent Activity */
.prorank-recent-activity {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

.prorank-activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prorank-activity-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--pr-gray-100, #f4f4f5);
}

.prorank-activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.prorank-activity-icon {
  color: var(--pr-gray-500, #71717a);
  font-size: 16px;
}

.prorank-activity-text {
  font-size: 14px;
  color: var(--pr-gray-700, #3f3f46);
  margin: 0 0 4px;
}

.prorank-activity-time {
  font-size: 12px;
  color: var(--pr-gray-500, #71717a);
}

/* Health Tab Styles */
.prorank-health-tab > * + * {
  margin-top: 24px;
}

.prorank-health-loading {
  text-align: center;
  padding: 60px;
}

/* Health Score Card */
.prorank-health-score-card {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

.prorank-health-score {
  display: flex;
  gap: 48px;
  align-items: center;
}

.prorank-score-circle {
  position: relative;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.prorank-score-circle svg {
  width: 100%;
  height: 100%;
}

.prorank-score-circle--success {
  color: var(--pr-accent-green, #10b981);
}

.prorank-score-circle--warning {
  color: var(--pr-accent-orange, #f59e0b);
}

.prorank-score-circle--error {
  color: var(--pr-accent-red, #ef4444);
}

.prorank-score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.prorank-score-value {
  display: block;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: var(--pr-gray-900, #18181b);
}

.prorank-score-label {
  display: block;
  font-size: 14px;
  color: var(--pr-gray-600, #52525b);
  margin-top: 4px;
}

.prorank-health-summary {
  flex: 1;
}

.prorank-health-summary h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--pr-gray-900, #18181b);
}

.prorank-health-summary > p {
  margin: 0 0 24px;
  color: var(--pr-gray-600, #52525b);
}

.prorank-health-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
}

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

.prorank-stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.prorank-stat--success {
  color: var(--pr-accent-green, #10b981);
}

.prorank-stat--warning {
  color: var(--pr-accent-orange, #f59e0b);
}

.prorank-stat--error {
  color: var(--pr-accent-red, #ef4444);
}

/* Health Checks */
.prorank-health-checks {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

.prorank-checks-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prorank-health-check {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--pr-gray-200, #e4e4e7);
}

.prorank-health-check--pass {
  background: rgb(16 185 129 / 5%);
  border-color: rgb(16 185 129 / 20%);
}

.prorank-health-check--warning {
  background: rgb(245 158 11 / 5%);
  border-color: rgb(245 158 11 / 20%);
}

.prorank-health-check--fail {
  background: rgb(239 68 68 / 5%);
  border-color: rgb(239 68 68 / 20%);
}

.prorank-check-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.prorank-health-check--pass .prorank-check-icon {
  background: var(--pr-accent-green, #10b981);
  color: white;
}

.prorank-health-check--warning .prorank-check-icon {
  background: var(--pr-accent-orange, #f59e0b);
  color: white;
}

.prorank-health-check--fail .prorank-check-icon {
  background: var(--pr-accent-red, #ef4444);
  color: white;
}

.prorank-health-check h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--pr-gray-900, #18181b);
}

.prorank-health-check > .components-flex > .components-flex-block > p {
  margin: 0 0 8px;
  color: var(--pr-gray-700, #3f3f46);
}

.prorank-check-solution {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgb(0 0 0 / 10%);
}

.prorank-check-solution p {
  margin: 0 0 4px;
  font-size: 13px;
}

.prorank-check-status {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
}

.prorank-check-status--pass {
  background: rgb(16 185 129 / 10%);
  color: var(--pr-accent-green, #10b981);
}

.prorank-check-status--warning {
  background: rgb(245 158 11 / 10%);
  color: var(--pr-accent-orange, #f59e0b);
}

.prorank-check-status--fail {
  background: rgb(239 68 68 / 10%);
  color: var(--pr-accent-red, #ef4444);
}

/* Recommendations */
.prorank-health-recommendations {
  border: 1px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
}

.prorank-recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prorank-recommendation {
  padding: 16px;
  background: var(--pr-gray-50, #fafafa);
  border-radius: 8px;
}

.prorank-recommendation .dashicons {
  color: var(--pr-accent-orange, #f59e0b);
  font-size: 20px;
}

.prorank-recommendation p {
  margin: 0 0 4px;
}

/* Last Scan Info */
.prorank-last-scan-info {
  text-align: center;
  padding: 16px;
  color: var(--pr-gray-600, #52525b);
  font-size: 13px;
}

/* Notifications Tab */
.prorank-dashboard-notifications {
  height: calc(100vh - 280px); /* Account for header, tabs, and padding */
  overflow-y: auto;
  padding: 0 20px 20px;
}

/* Responsive */
@media (width <= 1200px) {
  .prorank-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width <= 768px) {
  .prorank-dashboard-header .components-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .prorank-dashboard-notifications {
    height: calc(100vh - 320px); /* Adjust for mobile */
  }

  .prorank-dashboard-actions {
    flex-direction: column;
  }

  .prorank-dashboard-actions .components-button {
    width: 100%;
    justify-content: center;
  }

  .prorank-stats-grid {
    grid-template-columns: 1fr;
  }

  .prorank-health-score {
    flex-direction: column;
    text-align: center;
  }

  .prorank-health-stats {
    justify-content: center;
  }

  .prorank-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* Module Manager Tab Styles */
.prorank-module-manager {
  max-width: 1200px;
}

.prorank-module-manager-header {
  margin-bottom: 32px;
}

.prorank-module-manager-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--pr-gray-900, #18181b);
}

.prorank-module-manager-header p {
  margin: 0;
  color: var(--pr-gray-600, #52525b);
}

.prorank-module-manager-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 16px;
}

/* Module Grid */
.prorank-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.prorank-module-grid.prorank-pinned-modules {
  padding: 16px;
  background: var(--pr-gray-50, #fafafa);
  border-radius: 12px;
  border: 2px solid var(--pr-primary, #2563eb);
  margin-bottom: 32px;
}

/* Module Section Title */
.prorank-module-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--pr-gray-900, #18181b);
  margin: 32px 0 16px;
}

.prorank-module-section-title:first-child {
  margin-top: 0;
}

.prorank-module-section-title svg {
  color: var(--pr-primary, #2563eb);
}

/* Module Card */
.prorank-module-card {
  position: relative;
  border: 2px solid var(--pr-gray-200, #e4e4e7);
  border-radius: 12px;
  transition: var(--pr-transition-fast, all 0.15s ease);
  background: white;
  overflow: hidden;
}

.prorank-module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgb(0 0 0 / 10%);
}

.prorank-module-card.is-active {
  border-color: var(--pr-primary, #2563eb);
}

.prorank-module-card.is-locked {
  opacity: 0.75;
}

.prorank-module-card.is-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 50%);
  pointer-events: none;
}

/* Module Header */
.prorank-module-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 20px 0;
}

.prorank-module-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--pr-gray-100, #f4f4f5);
}

.prorank-module-card.is-active .prorank-module-icon {
  background: rgb(67 56 202 / 10%);
  color: var(--pr-primary, #2563eb);
}

.prorank-emoji-icon {
  font-size: 24px;
  line-height: 1;
}

.prorank-module-info {
  flex: 1;
  min-width: 0;
}

.prorank-module-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--pr-gray-900, #18181b);
  word-wrap: break-word;
}

.prorank-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}

.prorank-module-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prorank-status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pr-gray-300, #d4d4d8);
}

.prorank-status-indicator.is-active {
  background: var(--pr-accent-green, #10b981);
}

/* Module Body */
.prorank-module-card .components-card__body {
  padding: 16px 20px 20px;
}

.prorank-module-description {
  margin: 0 0 20px;
  color: var(--pr-gray-600, #52525b);
  line-height: 1.6;
}

/* Module Controls */
.prorank-module-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.prorank-module-toggle {
  margin: 0;
}

.prorank-module-toggle .components-base-control__field {
  margin: 0;
}

/* Module Saving State */
.prorank-module-saving {
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 90%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--pr-gray-600, #52525b);
}

/* Dark Theme Support */
[data-theme='dark'] .prorank-module-card {
  background: var(--pr-gray-800, #27272a);
  border-color: var(--pr-gray-700, #3f3f46);
}

[data-theme='dark'] .prorank-module-card.is-active {
  border-color: var(--pr-primary-dark, #1e3a8a);
}

[data-theme='dark'] .prorank-module-icon {
  background: var(--pr-gray-700, #3f3f46);
}

[data-theme='dark'] .prorank-module-card.is-active .prorank-module-icon {
  background: rgb(67 56 202 / 20%);
}

[data-theme='dark'] .prorank-module-title {
  color: var(--pr-gray-100, #f4f4f5);
}

[data-theme='dark'] .prorank-module-description {
  color: var(--pr-gray-400, #a1a1aa);
}

[data-theme='dark'] .prorank-module-saving {
  background: rgb(39 39 42 / 90%);
  color: var(--pr-gray-400, #a1a1aa);
}

/* Responsive */
@media (width <= 768px) {
  .prorank-module-grid {
    grid-template-columns: 1fr;
  }

  .prorank-module-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .prorank-module-controls .components-button {
    width: 100%;
    justify-content: center;
  }
}

/* Pin Button */
.prorank-module-pin-button {
  background: transparent !important;
  border: none !important;
  padding: 8px !important;
  min-width: auto !important;
  height: auto !important;
  transition: all 0.2s ease;
}

.prorank-module-pin-button:hover {
  transform: scale(1.1);
}

.prorank-module-pin-button svg {
  width: 20px;
  height: 20px;
  fill: var(--pr-gray-400, #a1a1aa);
  transition: fill 0.2s ease;
}

.prorank-module-pin-button:hover svg {
  fill: var(--pr-primary, #2563eb);
}

.prorank-module-pin-button.is-pinned svg {
  fill: var(--pr-primary, #2563eb);
}

.prorank-module-pin-button:focus {
  outline: 2px solid var(--pr-primary, #2563eb);
  outline-offset: 2px;
}

/* Dark mode pin button */
[data-theme='dark'] .prorank-module-pin-button svg {
  fill: var(--pr-gray-600, #52525b);
}

[data-theme='dark'] .prorank-module-pin-button:hover svg,
[data-theme='dark'] .prorank-module-pin-button.is-pinned svg {
  fill: var(--pr-accent-yellow, #fbbf24);
}

[data-theme='dark'] .prorank-module-grid.prorank-pinned-modules {
  background: var(--pr-gray-800, #27272a);
  border-color: var(--pr-primary-dark, #1e3a8a);
}

/* Gamification Section */
.prorank-gamification-section {
  margin: var(--pr-spacing-xlarge, 32px) 0;
}

.prorank-gamification-section > .components-flex {
  gap: var(--pr-spacing-xlarge, 32px);
}

@media (width <= 1280px) {
  .prorank-gamification-section > .components-flex {
    flex-direction: column;
    gap: var(--pr-spacing-large, 24px);
  }
}
