@import url('/assets/css/variables.css');

* { box-sizing: border-box; }

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--dark-bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(124, 92, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(56, 211, 159, 0.08) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  margin: 0;
}

/* ---- Auth ---- */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-stack {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-heavy), var(--glow);
}

.auth-logo { text-align: center; font-size: 2.5rem; margin-bottom: 8px; }

.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.4);
}
.btn-primary:disabled,
.btn-primary.is-loading {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }

.btn-google {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #fff;
  color: #1f1f1f;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 4px;
}
.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.alert-error { color: var(--danger); font-size: 0.9rem; margin-bottom: 12px; text-align: center; }
.alert-success { color: var(--secondary); font-size: 0.9rem; margin-bottom: 12px; text-align: center; }

/* ---- Toast ---- */
.app-toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-heavy);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
}
.app-toast--show { opacity: 1; transform: translateY(0); }
.app-toast--hide { opacity: 0; transform: translateY(-8px); }
.app-toast__icon { font-size: 1.2rem; flex-shrink: 0; }
.app-toast__text { flex: 1; font-size: 0.95rem; line-height: 1.5; }
.app-toast__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
}
.app-toast--success { border-color: rgba(56, 211, 159, 0.45); }
.app-toast--success .app-toast__icon { color: var(--secondary); }
.app-toast--error { border-color: rgba(255, 92, 124, 0.45); }
.app-toast--error .app-toast__icon { color: var(--danger); }
.app-toast--warning { border-color: rgba(255, 204, 0, 0.45); }
.app-toast--warning .app-toast__icon { color: var(--accent); }
.app-toast--info .app-toast__icon { color: var(--primary); }

/* ---- Loading / Skeleton ---- */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton-host { display: flex; flex-direction: column; gap: 10px; padding: 8px; }
.skeleton-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Header actions (game) ---- */
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-actions__wrap { position: relative; z-index: 2100; }
.notif-bell {
  position: relative;
  background: rgba(124, 92, 255, 0.15);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: all 0.2s;
}
.notif-bell--avatar { font-size: 1.4rem; }
.notif-bell:hover { background: rgba(124, 92, 255, 0.25); }
.notif-badge {
  position: absolute;
  top: -4px;
  inset-inline-start: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: min(320px, calc(100vw - 24px));
  max-height: min(400px, 60vh);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-heavy);
  z-index: 3000;
  display: none;
}
.notif-dropdown.active { display: block; }
.notif-item {
  width: 100%;
  text-align: start;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  color: inherit;
  font: inherit;
}
.notif-item:hover { background: rgba(124, 92, 255, 0.1); }
.notif-item.unread { border-inline-start: 3px solid var(--primary); }
.notif-item-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.notif-item-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.85;
}
.notif-item--empty { cursor: default; }

/* ---- Chat ---- */
.chat-fab {
  position: fixed;
  bottom: 90px;
  inset-inline-start: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(124, 92, 255, 0.5);
  z-index: 900;
  transition: transform 0.2s;
}
.chat-fab:hover { transform: scale(1.08); }

.chat-panel {
  position: fixed;
  bottom: 160px;
  inset-inline-start: 20px;
  width: min(360px, calc(100vw - 40px));
  height: 480px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-heavy);
  display: none;
  flex-direction: column;
  z-index: 950;
  overflow: hidden;
}
.chat-panel.active { display: flex; }
.chat-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(124, 92, 255, 0.1);
}
.chat-tabs { display: flex; gap: 4px; }
.chat-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.chat-tab.active { background: var(--primary); color: #fff; }
.chat-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.4;
}
.chat-msg.user { align-self: flex-start; background: rgba(255,255,255,0.08); }
.chat-msg.other { align-self: flex-end; background: var(--gradient-primary); }
.chat-msg.mine { align-self: flex-end; background: var(--gradient-primary); }
.chat-msg.theirs { align-self: flex-start; background: rgba(255,255,255,0.08); }
.chat-msg .chat-meta { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 4px; }
.chat-msg .chat-time {
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.85;
  margin-top: 6px;
}
.chat-msg.mine .chat-time { text-align: end; }
.chat-msg.theirs .chat-time { text-align: start; }
.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text-primary);
  font-family: inherit;
}
.notif-actions { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.notif-actions--footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--card-bg, rgba(18, 20, 35, 0.98));
}
.notif-mark-all {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, rgba(56, 211, 159, 0.2), rgba(124, 92, 255, 0.2));
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.notif-mark-all:hover { filter: brightness(1.08); }
.notif-item-time {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.wallet-history-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  font-size: 0.85rem;
}
.wallet-history-item small { grid-column: 1 / -1; color: var(--text-secondary); font-size: 0.75rem; }
.wallet-history-empty { color: var(--text-secondary); font-size: 0.85rem; padding: 8px 0; }
.status-pending { color: var(--accent); }
.status-approved, .status-success { color: var(--secondary); }
.status-rejected, .status-failed { color: var(--danger); }
.chat-send-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--secondary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Timer claim (compact bright free-ticket bar) ---- */
.timer-claim-box {
  background: linear-gradient(135deg, rgba(124,92,255,0.15), rgba(56,211,159,0.1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.timer-claim-box--compact { margin-bottom: 12px; }
.timer-claim-box--timer-only {
  padding: 10px 16px;
  margin-bottom: 12px;
}
.timer-claim-box--timer-only .timer-display--sm {
  margin: 0;
  font-size: 1.45rem;
}
.timer-claim-box--mini {
  padding: 8px 12px;
  margin: 0 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 204, 0, 0.35);
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.18), rgba(124, 92, 255, 0.14));
  box-shadow: 0 0 18px rgba(255, 204, 0, 0.12);
}
.timer-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.timer-mini-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.timer-mini-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffe066;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.timer-mini-hint {
  font-size: 0.68rem;
  color: #d8dbe8;
  line-height: 1.3;
}
.timer-mini-hint strong {
  color: #38d39f;
  font-weight: 800;
}
.timer-claim-box--ready {
  border-color: rgba(56, 211, 159, 0.55);
  background: linear-gradient(135deg, rgba(56, 211, 159, 0.22), rgba(255, 204, 0, 0.14));
}
.timer-claim-box--claimed {
  animation: balanceUpPop 0.85s ease;
  box-shadow: 0 0 20px rgba(56, 211, 159, 0.4);
}
.timer-claim-label { font-size: 0.85rem; color: var(--text-secondary); }
.timer-display {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 12px 0;
}
.timer-display--sm { font-size: 1.6rem; margin: 8px 0; }
.claim-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  background: var(--gradient-success);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, opacity 0.15s;
}
.claim-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.claim-btn:not(:disabled):hover { transform: translateY(-2px); }

/* ---- Profile modal ---- */
.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.profile-modal-overlay.active { display: flex; }
.profile-modal-card {
  background: var(--card-bg);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  padding: 24px;
}
.profile-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.profile-modal-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.profile-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
}
.profile-avatar-display { text-align: center; font-size: 3rem; margin-bottom: 16px; }
.profile-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.avatar-option {
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  transition: all 0.15s;
}
.avatar-option.selected,
.avatar-option:hover {
  border-color: var(--primary);
  background: rgba(124, 92, 255, 0.2);
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  text-align: center;
}
.stat-card { padding: 12px; border-radius: 12px; }
.stat-card--win { background: rgba(56,211,159,0.1); }
.stat-card--loss { background: rgba(255,92,124,0.1); }
.stat-card--profit { background: rgba(255,204,0,0.1); }
.stat-card__value { font-size: 1.4rem; font-weight: 700; }
.stat-card__value--win { color: var(--secondary); }
.stat-card__value--loss { color: var(--danger); }
.stat-card__value--profit { color: var(--accent); }

/* ---- Utilities ---- */
.flex-row-wrap { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-flex-1 { flex: 1; min-width: 120px; }
.btn-flex-half { flex: 1; }
.reward-box--relative { position: relative; overflow: visible; }
.prize-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gradient-warning);
  color: #1a1a1a;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(255,204,0,0.35);
  border: 2px solid rgba(0,0,0,0.12);
  animation: prizeBlink 1.3s infinite alternate;
  white-space: nowrap;
  max-width: 100%;
}
.prize-banner--inline {
  position: static;
  transform: none;
  margin: 0.75rem auto 0.5rem;
  left: auto;
  top: auto;
}
.prize-banner__icon { margin-inline-end: 0; color: #c06d00; }
.form-label-icon { margin-inline-end: 6px; }
.form-label-icon--accent { color: var(--accent-color); }
.form-label-icon--secondary { color: var(--secondary-color); }
.wallet-hint { color: var(--text-secondary); font-size: 0.85rem; margin-top: -0.25rem; }
.wallet-hint__amount { color: var(--secondary-color); font-weight: 600; }
.logout-link { text-decoration: none; }

.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .auth-card { padding: 32px 24px; }
}

@media (max-width: 768px) {
  .chat-panel { inset-inline-start: 10px; bottom: 140px; height: 420px; }
  .chat-fab { inset-inline-start: 16px; bottom: 80px; }
  .notif-dropdown {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
  .app-toast-container { top: 72px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 18px; border-radius: 18px; }
  .auth-title { font-size: 1.25rem; }
  .timer-display { font-size: 1.5rem; }
  .profile-stats-grid { grid-template-columns: 1fr 1fr; }
  .chat-panel { width: calc(100vw - 20px); height: 380px; }
  .notif-dropdown {
    top: 62px;
    right: 10px;
    left: 10px;
  }
}

/* ---- Payment result page ---- */
.pay-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
}
.pay-box {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-heavy);
}
.pay-box h2 { color: var(--text-primary); margin-bottom: 16px; }
.pay-box p { color: var(--text-secondary); margin-bottom: 24px; }
.tickets-badge { font-size: 1.4rem; color: var(--secondary); font-weight: 700; margin: 16px 0; }
.pay-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
