/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--bg-hover);
}
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---------- Form fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
}
.input:disabled {
  opacity: 0.5;
}
.input-group {
  position: relative;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: background-color 0.15s ease;
}
.switch .track::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.switch input:checked + .track {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .track::before {
  transform: translateX(16px);
  background: var(--accent-ink);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  overflow: hidden;
}
.stepper button {
  width: 32px;
  height: 36px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 16px;
}
.stepper button:hover {
  background: var(--bg-hover);
}
.stepper input {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: transparent;
  height: 36px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.badge-positive {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent);
}
.badge-negative {
  background: rgba(246, 70, 93, 0.15);
  color: var(--danger);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.card-pad {
  padding: 16px;
}

/* ---------- Support page ---------- */
.support-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.support-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.support-action-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.support-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  color: var(--accent);
}
.support-action-title {
  font-weight: 700;
  font-size: 14px;
}
.support-action-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 24px;
}
.tabs button {
  padding: 14px 0;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- Empty state ---------- */
.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.modal-close:hover {
  background: var(--bg-hover);
}

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  font-size: 13px;
  font-weight: 600;
  max-width: 320px;
  animation: toast-in 0.2s ease;
}
.toast.success {
  border-left: 3px solid var(--accent);
}
.toast.error {
  border-left: 3px solid var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Data table ---------- */
.table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.table-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Language switcher ---------- */
.lang-select-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}
.lang-select-summary:hover {
  background: var(--bg-hover);
}
.lang-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.dropdown {
  position: relative;
}
.dropdown-menu {
  /* Anchored to its .dropdown parent so it always drops down below the
     trigger, docked to the right edge — without this, the menu was a
     normal-flow flex sibling of the trigger button, which got vertically
     centered by the topbar's align-items:center and rendered half above,
     half below the header (visibly bleeding off the top of the page). */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  flex-direction: column;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 120;
}
.dropdown-menu.open {
  display: flex;
}
.dropdown-menu a,
.dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: var(--bg-hover);
}

/* ---------- Country select (Signup form) ---------- */
.country-select {
  position: relative;
}
.country-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  min-height: 44px;
}
.country-select-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-select-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 8px;
  z-index: 120;
}
.country-select-menu.open {
  display: block;
}
.country-select-menu .input {
  margin-bottom: 6px;
}
.country-select-list {
  max-height: 240px;
  overflow-y: auto;
}
.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  min-height: 44px;
}
.country-option-flag,
.country-select-flag-img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.country-option:hover {
  background: var(--bg-hover);
}
.country-option-dial {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Phone input (Signup form) ---------- */
.phone-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.phone-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  min-width: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
}
.phone-input-row .input {
  flex: 1;
  min-width: 0;
}

/* ---------- Password visibility toggle ---------- */
.password-input-wrap {
  position: relative;
}
.password-input-wrap .input {
  padding-right: 42px;
}
.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.password-toggle-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* ---------- Checkbox row (Signup terms/age) ---------- */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}
.checkbox-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--accent);
}
.checkbox-row a {
  color: var(--accent);
  font-weight: 700;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 18px;
}
