/* ============================================================
   TennisBama Design System — tb-common.css
   Minimal · Mobile-first · Dark/Light mode
   Primary: #ccff00
   ============================================================ */

/* ---- Dark/Light Tokens ---- */
:root {
  --tb-primary:       #ccff00;
  --tb-primary-hover: #b3e600;
  --tb-primary-dim:   rgba(204, 255, 0, 0.12);
  --tb-accent:        #5c7cba;
  --tb-radius:        12px;
  --tb-radius-sm:     8px;
  --tb-font:          'Vazirmatn', 'IRANSans', system-ui, -apple-system, sans-serif;
  --tb-mono:          'SF Mono', 'Fira Code', monospace;
  --tb-transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}





/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- .tb-app ---- */
.tb-app {
  font-family: var(--tb-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--tb-text);
  background: var(--tb-bg);
  min-height: 100dvh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tb-app *:focus-visible {
  outline: 2px solid var(--tb-primary);
  outline-offset: 2px;
}

/* ---- .tb-card ---- */
.tb-card {
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  padding: 20px;
  box-shadow: var(--tb-shadow-sm);
  transition: box-shadow var(--tb-transition), border-color var(--tb-transition);
}

.tb-card:hover {
  box-shadow: var(--tb-shadow-md);
}

.tb-card + .tb-card {
  margin-top: 12px;
}

/* ---- .tb-btn ---- */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--tb-font);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 24px;
  border: none;
  border-radius: var(--tb-radius-sm);
  cursor: pointer;
  transition: all var(--tb-transition);
  text-decoration: none;
  line-height: 1.4;
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.tb-btn:active {
  transform: scale(0.97);
}

.tb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Primary */
.tb-btn {
  background: var(--tb-primary);
  color: #0d1117;
}

.tb-btn:hover:not(:disabled) {
  background: var(--tb-primary-hover);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.25);
}

/* Secondary */
.tb-btn-secondary {
  background: transparent;
  color: var(--tb-text);
  border: 1.5px solid var(--tb-border);
}

.tb-btn-secondary:hover:not(:disabled) {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
  background: var(--tb-primary-dim);
}

/* Ghost variant (via both classes) */
.tb-btn-secondary.tb-btn--ghost {
  border-color: transparent;
}

.tb-btn-secondary.tb-btn--ghost:hover:not(:disabled) {
  background: var(--tb-surface-hover);
  border-color: transparent;
  color: var(--tb-text);
}

/* Sizes */
.tb-btn--sm {
  font-size: 13px;
  padding: 6px 16px;
}

.tb-btn--lg {
  font-size: 17px;
  padding: 14px 32px;
}

/* Loading state */
.tb-btn--loading {
  pointer-events: none;
}

.tb-btn--loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: tb-spin 0.5s linear infinite;
}

/* ---- .tb-input ---- */
.tb-input {
  display: block;
  width: 100%;
  font-family: var(--tb-font);
  font-size: 15px;
  padding: 10px 14px;
  border: 1.5px solid var(--tb-border);
  border-radius: var(--tb-radius-sm);
  background: var(--tb-surface);
  color: var(--tb-text);
  transition: border-color var(--tb-transition), box-shadow var(--tb-transition);
  line-height: 1.5;
}

.tb-input:focus {
  outline: none;
  border-color: var(--tb-border-focus);
  box-shadow: 0 0 0 3px var(--tb-primary-dim);
}

.tb-input::placeholder {
  color: var(--tb-text-muted);
}

.tb-input--error {
  border-color: var(--tb-error-text);
}

.tb-input--error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* ---- .tb-step ---- */
.tb-step {
  display: none;
  animation: tb-fade-in 0.3s ease;
}

.tb-step--active {
  display: block;
}

.tb-step__header {
  margin-bottom: 20px;
}

.tb-step__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--tb-text);
}

.tb-step__subtitle {
  font-size: 14px;
  color: var(--tb-text-secondary);
}

.tb-step__body {
  margin-bottom: 20px;
}

.tb-step__footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--tb-border);
}

/* Progress dots */
.tb-step-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.tb-step-progress__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tb-border);
  transition: all var(--tb-transition);
}

.tb-step-progress__dot--active {
  background: var(--tb-primary);
  box-shadow: 0 0 6px rgba(204, 255, 0, 0.5);
  width: 24px;
  border-radius: 4px;
}

.tb-step-progress__dot--done {
  background: var(--tb-primary);
  opacity: 0.5;
}

/* ---- .tb-result ---- */
.tb-result {
  text-align: center;
  padding: 32px 16px;
}

.tb-result__icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.tb-result__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--tb-text);
}

.tb-result__value {
  font-size: 42px;
  font-weight: 800;
  color: var(--tb-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  font-family: var(--tb-mono);
}

.tb-result__description {
  font-size: 14px;
  color: var(--tb-text-secondary);
  max-width: 320px;
  margin: 0 auto 24px;
}

.tb-result__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- .tb-error ---- */
.tb-error {
  background: var(--tb-error-bg);
  border: 1px solid var(--tb-error-border);
  border-radius: var(--tb-radius-sm);
  padding: 12px 16px;
  color: var(--tb-error-text);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  animation: tb-fade-in 0.2s ease;
}

.tb-error::before {
  content: '⚠';
  flex-shrink: 0;
  font-size: 16px;
}

/* ---- .tb-success ---- */
.tb-success {
  background: var(--tb-success-bg);
  border: 1px solid var(--tb-success-border);
  border-radius: var(--tb-radius-sm);
  padding: 12px 16px;
  color: var(--tb-success-text);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  animation: tb-fade-in 0.2s ease;
}

.tb-success::before {
  content: '✓';
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
}

/* ---- Loading Overlay (for showLoading / hideLoading) ---- */
.tb-loading {
  position: fixed;
  inset: 0;
  background: var(--tb-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: tb-fade-in 0.15s ease;
}

.tb-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--tb-border);
  border-top-color: var(--tb-primary);
  border-radius: 50%;
  animation: tb-spin 0.6s linear infinite;
}

/* ---- Spinner (inline) ---- */
.tb-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--tb-border);
  border-top-color: var(--tb-primary);
  border-radius: 50%;
  animation: tb-spin 0.6s linear infinite;
  vertical-align: middle;
}

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

.tb-empty__text {
  font-size: 15px;
  margin-bottom: 4px;
}

/* ---- Animations ---- */
@keyframes tb-spin {
  to { transform: rotate(360deg); }
}

@keyframes tb-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive: Tablet (≥600px) ---- */
@media (min-width: 600px) {
  .tb-card {
    padding: 24px;
  }

  .tb-step__title {
    font-size: 20px;
  }

  .tb-result__value {
    font-size: 52px;
  }
}

/* ---- Responsive: Desktop (≥900px) ---- */
@media (min-width: 900px) {
  .tb-app {
    padding: 0;
  }
}


/* ============================================================
   Admin Dashboard — tb-common.css
   ============================================================ */

/* ---- Admin Wrap ---- */
.tb-admin-wrap {
  padding: 24px 0;
  direction: rtl;
  font-family: var(--tb-font);
  color: var(--tb-text, #1a1a2e);
}

.tb-admin-wrap *:focus-visible {
  outline: 2px solid var(--tb-primary, #ccff00);
  outline-offset: 2px;
}

/* ---- Admin Header ---- */
.tb-admin-header {
  margin-bottom: 28px;
}

.tb-admin-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--tb-text, #1a1a2e);
}

.tb-admin-subtitle {
  font-size: 14px;
  color: var(--tb-text-secondary, #5a5d72);
  margin: 0;
}

/* ---- Stat Cards Grid ---- */
.tb-admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* ---- Stat Card ---- */
.tb-admin-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e2e4e9;
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tb-admin-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #ccff00;
}

.tb-admin-stat-card--linked {
  cursor: pointer;
}

.tb-admin-stat-card__icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(204, 255, 0, 0.1);
  border-radius: 12px;
}

.tb-admin-stat-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tb-admin-stat-card__value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: #1a1a2e;
  font-family: var(--tb-mono, 'SF Mono', monospace);
}

.tb-admin-stat-card__label {
  font-size: 13px;
  color: #5a5d72;
  font-weight: 500;
}

/* ---- Admin Section ---- */
.tb-admin-section {
  margin-top: 8px;
}

.tb-admin-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: #1a1a2e;
}

/* ---- Quick Links ---- */
.tb-admin-quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Dark Mode Overrides ---- */
body[data-theme="dark"] .tb-admin-stat-card,
body.wp-admin[data-theme="dark"] .tb-admin-stat-card {
  background: #161b22;
  border-color: #30363d;
}

body[data-theme="dark"] .tb-admin-stat-card__value {
  color: #e6edf3;
}

body[data-theme="dark"] .tb-admin-stat-card__label {
  color: #a5b3cc;
}

body[data-theme="dark"] .tb-admin-section h2 {
  color: #e6edf3;
}

body[data-theme="dark"] .tb-admin-title {
  color: #e6edf3;
}

body[data-theme="dark"] .tb-admin-subtitle {
  color: #a5b3cc;
}

/* ---- Responsive ---- */
@media (max-width: 782px) {
  .tb-admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

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

  .tb-admin-stat-card__value {
    font-size: 22px;
  }

  .tb-admin-stat-card__icon {
    font-size: 26px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .tb-admin-stats {
    grid-template-columns: 1fr;
  }
}
