/* DANZFLO — Classes Earning Management */

.earn-page {
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(37, 99, 235, 0.06), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(249, 115, 22, 0.05), transparent 50%),
    #f8fafc;
}

.earn-page > * {
  position: relative;
}

.earn-page-header {
  margin-bottom: 1.5rem;
}

.earn-page-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ea580c;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.18);
  border-radius: 9999px;
}

.earn-page-title {
  margin: 0.625rem 0 0;
  font-size: clamp(1.5rem, 2.5vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.earn-page-subtitle {
  margin: 0.375rem 0 0;
  font-size: 0.875rem;
  color: #64748b;
  max-width: 36rem;
}

/* Tabs */
.earn-tabs {
  display: inline-flex;
  gap: 0.375rem;
  padding: 0.375rem;
  margin-bottom: 1.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.earn-tab {
  min-width: 7.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.earn-tab:hover {
  color: #0f172a;
  background: #f8fafc;
}

.earn-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

/* Filters */
.earn-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.125rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  position: relative;
  z-index: 2;
}

.earn-filters.is-picker-open {
  z-index: 30;
}

.earn-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 11rem;
}

.earn-filter-field--range {
  flex: 1 1 20rem;
  min-width: 18rem;
  max-width: 26rem;
}

.earn-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.earn-filter-field:not(.earn-filter-field--range) {
  flex: 1 1 16rem;
  min-width: 14rem;
  max-width: 22rem;
}

.earn-filter-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 0.875rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.earn-filter-search:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.earn-filter-search-icon {
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.earn-filter-input {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: #0f172a;
  background: transparent;
  border: none;
  outline: none;
}

.earn-filter-input::placeholder {
  color: #94a3b8;
}

.earn-range {
  position: relative;
}

.earn-range-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.earn-range-trigger.has-value {
  color: #0f172a;
}

.earn-range-trigger:hover {
  background: #fff;
  border-color: #cbd5e1;
}

.earn-range-trigger[aria-expanded='true'] {
  background: #fff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.earn-range-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.earn-range-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: #64748b;
  flex-shrink: 0;
}

.earn-range-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.875rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.earn-range-popover[hidden] {
  display: none;
}

.earn-range-selected {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.earn-range-chip {
  min-width: 0;
  padding: 0.5rem 0.625rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
}

.earn-range-chip.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.earn-range-chip__label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.earn-range-chip__value {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.earn-range-sep {
  color: #94a3b8;
  font-size: 0.875rem;
}

.earn-range-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.earn-cal-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.earn-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
}

.earn-cal-nav:hover {
  color: #2563eb;
  border-color: #93c5fd;
}

.earn-cal-nav svg {
  width: 1rem;
  height: 1rem;
}

.earn-cal-weekdays,
.earn-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.earn-cal-weekdays {
  margin-bottom: 0.375rem;
}

.earn-cal-weekdays span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.earn-cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.earn-cal-day:hover:not(:disabled) {
  background: #eff6ff;
  color: #2563eb;
}

.earn-cal-day:disabled {
  color: #cbd5e1;
  cursor: default;
}

.earn-cal-day.is-outside {
  color: #cbd5e1;
}

.earn-cal-day.is-in-range {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-radius: 0;
}

.earn-cal-day.is-start,
.earn-cal-day.is-end {
  color: #fff !important;
  background: #2563eb !important;
  border-radius: 0.5rem;
  font-weight: 700;
}

.earn-cal-day.is-preview {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.earn-cal-day.is-start.is-in-range {
  border-radius: 0.5rem 0 0 0.5rem;
}

.earn-cal-day.is-end.is-in-range {
  border-radius: 0 0.5rem 0.5rem 0;
}

.earn-cal-day.is-start.is-end {
  border-radius: 0.5rem;
}

.earn-range-popover-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eef2f7;
}

.earn-range-hint {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: #64748b;
}

.earn-range-actions {
  display: flex;
  gap: 0.5rem;
}

.earn-range-clear,
.earn-range-apply {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
}

.earn-range-clear {
  color: #64748b;
  background: #f1f5f9;
}

.earn-range-clear:hover {
  background: #e2e8f0;
}

.earn-range-apply {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.earn-range-apply:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.earn-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.earn-search-btn svg {
  width: 1rem;
  height: 1rem;
}

.earn-search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.3);
}

/* Stats */
.earn-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.earn-stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  min-height: 6.5rem;
  padding: 1.125rem 1.25rem;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.earn-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.earn-stat-card__label {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
}

.earn-stat-card__value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.2;
}

.earn-stat-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.earn-stat-card__icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

.earn-stat-card--orders .earn-stat-card__icon {
  color: #ea580c;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.06) 65%, transparent 75%);
}

.earn-stat-card--sale .earn-stat-card__icon {
  color: #f59e0b;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.06) 65%, transparent 75%);
}

.earn-stat-card--admin .earn-stat-card__icon {
  color: #d97706;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.2), rgba(217, 119, 6, 0.06) 65%, transparent 75%);
}

.earn-stat-card--instructor .earn-stat-card__icon {
  color: #16a34a;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.06) 65%, transparent 75%);
}

.earn-stat-card--merchant .earn-stat-card__icon {
  color: #ef4444;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.05) 65%, transparent 75%);
}

.earn-stat-card--extra .earn-stat-card__icon {
  color: #0ea5e9;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.06) 65%, transparent 75%);
}

.earn-stat-card--promoter .earn-stat-card__icon {
  color: #f97316;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.05) 65%, transparent 75%);
}

/* Panel / table */
.earn-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.earn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid #eef2f7;
}

.earn-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.earn-panel-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.earn-count {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.earn-table-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.earn-table-wrap--initial {
  min-height: 220px;
}

.earn-table-wrap--busy .earn-table-inner {
  opacity: 0.45;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.earn-table-busy-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.earn-table-inner {
  min-width: 960px;
}

.earn-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.earn-table th {
  padding: 0.875rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}

.earn-table th.text-right,
.earn-table td.text-right {
  text-align: right;
}

.earn-table th.text-center,
.earn-table td.text-center {
  text-align: center;
}

.earn-table td {
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}

.earn-table tbody tr {
  transition: background 0.15s ease;
  cursor: pointer;
}

.earn-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}

.earn-table tbody tr:last-child td {
  border-bottom: none;
}

.earn-video-thumb {
  display: block;
  width: 4.5rem;
  height: 2.75rem;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #e2e8f0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.earn-title-cell {
  font-weight: 600;
  color: #0f172a;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.earn-money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
  font-size: 0.8125rem;
}

.earn-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Pagination */
.earn-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #eef2f7;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.4), rgba(255, 255, 255, 0.9));
}

.earn-pagination-info {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
  text-align: center;
}

.earn-pagination-info strong {
  color: #334155;
  font-weight: 600;
}

.earn-page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.earn-page-ellipsis {
  color: #94a3b8;
  font-size: 0.8125rem;
  padding: 0 0.125rem;
}

.earn-pagination[hidden] {
  display: none;
}

.earn-page-nav,
.earn-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.earn-page-nav svg {
  width: 1rem;
  height: 1rem;
}

.earn-page-nav:hover:not(:disabled),
.earn-page-btn:hover {
  color: #2563eb;
  border-color: #93c5fd;
  background: rgba(37, 99, 235, 0.04);
}

.earn-page-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.earn-page-nums {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.earn-page-btn.active {
  color: #2563eb;
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

@media (max-width: 1280px) {
  .earn-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .earn-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .earn-filters {
    align-items: stretch;
  }

  .earn-filter-field {
    flex: 1 1 100%;
  }

  .earn-search-btn {
    width: 100%;
  }
}

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

  .earn-tabs {
    display: flex;
    width: 100%;
  }

  .earn-tab {
    flex: 1;
    min-width: 0;
  }
}
