/**
 * RewardHub visual polish. Tokens + components. No business rules.
 */

.rh-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.rh-icon-btn,
.rh-more__summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 1px solid var(--rh-color-border, #e2e8f0);
  border-radius: var(--rh-radius-sm, 8px);
  background: var(--rh-color-surface, #fff);
  color: var(--rh-color-text, #0f172a);
  cursor: pointer;
}

.rh-icon-btn:hover,
.rh-more__summary:hover {
  background: var(--rh-color-surface-soft, #f8fafc);
}

.rh-actions,
.cell-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rh-space-2, 8px);
}

.rh-more,
details.admin-more {
  position: relative;
  display: inline-block;
}

.rh-more__menu,
.admin-more .rh-more__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 160px;
  padding: var(--rh-space-2, 8px);
  background: var(--rh-color-surface, #fff);
  border: 1px solid var(--rh-color-border, #e2e8f0);
  border-radius: var(--rh-radius-md, 12px);
  box-shadow: var(--rh-shadow-md, 0 8px 24px rgba(15, 23, 42, 0.08));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rh-more:not([open]) .rh-more__menu,
.admin-more:not([open]) .rh-more__menu {
  display: none;
}

.rh-more__menu .btn,
.admin-more .btn {
  width: 100%;
  justify-content: flex-start;
}

.rh-more summary,
.admin-more summary {
  list-style: none;
}

.rh-more summary::-webkit-details-marker,
.admin-more summary::-webkit-details-marker {
  display: none;
}

.rh-btn,
.btn {
  min-height: var(--rh-control-h, 40px);
}

.btn--sm {
  min-height: var(--rh-control-h-sm, 36px);
  height: auto;
}

.btn--danger {
  background: var(--rh-color-danger, #e11d48);
  color: #fff;
  border: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

h1,
.page-title {
  font-weight: 700;
}

h2,
.section__head h2 {
  font-weight: 650;
  font-weight: 700;
}

.card h3,
.task-card h3,
.reward-card h3 {
  font-weight: 600;
}

.muted,
.stat-label,
.page-lead {
  font-weight: 400;
  color: var(--rh-color-text-muted, #64748b);
}

.card {
  border-radius: var(--rh-radius-lg, 16px);
}

body.rh-user-app .card,
body.rh-user-app .stat-card,
body.rh-user-app .summary-card {
  padding: var(--rh-space-5, 20px);
}

.form-field {
  margin-bottom: var(--rh-space-4, 16px);
}

.form-field label {
  margin-bottom: var(--rh-space-2, 8px);
}

.form-field input,
.form-field select,
.form-field textarea,
.admin-list-bar input,
.admin-list-bar select,
.toolbar input,
.toolbar select {
  min-height: var(--rh-control-h-sm, 36px);
  border: 1px solid var(--rh-color-border, #e2e8f0);
  border-radius: var(--rh-radius-sm, 8px);
  background: var(--rh-color-surface, #fff);
  color: var(--rh-color-text, #0f172a);
  padding: 8px 12px;
}

.admin-list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rh-space-3, 12px);
  margin-bottom: var(--rh-space-4, 16px);
}

.admin-list-bar input[type="search"] {
  min-width: 14rem;
  flex: 1 1 14rem;
}

.admin-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--rh-color-text-muted, #64748b);
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.admin-body .stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rh-space-3, 12px);
}

body.admin-body .stat-card {
  padding: 16px;
}

body.admin-body .stat-card__value {
  font-size: 1.45rem;
  font-weight: 700;
}

body.admin-body #economyForm,
body.admin-body #withdrawalForm {
  padding: 20px 24px 24px;
}

body.admin-body #economyForm h2,
body.admin-body #withdrawalForm h2,
body.admin-body #economyForm h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

body.admin-body #economyForm h3 {
  margin-top: 20px;
}

body.admin-body .form-grid {
  gap: 16px 20px;
}

body.admin-body .form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rh-color-border, #e2e8f0);
}

.wd-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 24px;
  align-items: start;
}

.wd-hero__copy .stat-label {
  margin-bottom: 8px;
}

.wd-hero__min {
  display: block;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--rh-color-text-muted, #64748b);
}

.wd-hero__eur:empty {
  display: none;
}

.wd-methods {
  display: grid;
  gap: 8px;
}

.wd-method {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--rh-color-border, #e2e8f0);
  border-radius: var(--rh-radius-md, 12px);
  cursor: pointer;
}

.wd-method:has(input:checked) {
  border-color: var(--rh-color-primary, #0d9488);
  background: #f0fdfa;
}

.wd-method input {
  margin: 0 8px 0 0;
}

.stat-card.summary-card--highlight .stat-value {
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 24px 16px;
  max-width: 28rem;
  margin-inline: auto;
}

.empty-state__icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
}

.toast {
  border-radius: var(--rh-radius-md, 12px);
  padding: 12px 16px;
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--rh-radius-sm, 8px);
  font-size: 0;
  background: transparent;
  border: 1px solid var(--rh-color-border, #e2e8f0);
  color: var(--rh-color-text, #0f172a);
}

.modal__close .rh-icon {
  font-size: 0;
}

:focus-visible {
  outline: 2px solid var(--rh-color-primary, #0d9488);
  outline-offset: 2px;
}

.adv-switcher select:focus-visible {
  outline: 2px solid var(--rh-color-primary, #0d9488);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  .btn,
  .btn--sm {
    min-height: 44px;
  }

  .rh-icon-btn,
  .rh-more__summary {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  body.rh-user-app .card,
  body.rh-user-app .stat-card {
    padding: 16px;
  }
}

@media (max-width: 960px) {
  body.admin-body .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.admin-body .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body.admin-body .stat-grid {
    grid-template-columns: 1fr;
  }
}

.reward-card__footer .points-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.task-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.admin-nav__group {
  margin-top: 16px;
}

.admin-content {
  max-width: 1280px;
}

.page-header {
  margin-bottom: 16px;
}

.page-lead {
  margin-top: 8px;
}

@media (min-width: 1440px) {
  body.admin-body .admin-content {
    max-width: 1280px;
  }
}
