/* ============================================================
   SPORTSPLAY — COMPONENTS
   All reusable UI components
   ============================================================ */

/* ════════════════════════════
   BUTTONS
   ════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  padding: 14px var(--space-5);
  border-radius: var(--radius-lg);
  border: 1.5px solid transparent;
  cursor: pointer;
  width: 100%;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast),
    box-shadow var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Primary */
.btn--primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 1px 2px rgba(34,197,94,0.20);
}
.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(34,197,94,0.30);
}

/* Secondary */
.btn--secondary {
  background: var(--bg-chip);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
}

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Danger */
.btn--danger {
  background: var(--color-danger);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  background: #DC2626;
}

/* Google */
.btn--google {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-input);
  box-shadow: var(--shadow-btn);
}
.btn--google:hover:not(:disabled) {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card-hover);
}

/* Sizes */
.btn--sm {
  font-size: var(--text-sm);
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
}
.btn--lg {
  font-size: var(--text-md);
  padding: 16px var(--space-6);
}

/* Auto width */
.btn--auto {
  width: auto;
}

/* Disabled / Loading */
.btn:disabled,
.btn--loading {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--loading .btn__text {
  visibility: hidden;
}

.btn--loading::after {
  content: '';
  position: absolute;
  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;
}

.btn--google.btn--loading::after {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text-primary);
}

/* Icon inside button */
.btn__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Google icon */
.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ════════════════════════════
   FORM ELEMENTS
   ════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.form-label--required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 13px var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-input-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.form-input--error {
  border-color: var(--border-input-error);
  box-shadow: 0 0 0 3px var(--color-danger-muted);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Input with icon */
.input-wrapper {
  position: relative;
}

.input-wrapper .form-input {
  padding-right: 44px;
}

.input-wrapper__action {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.input-wrapper__action:hover {
  color: var(--text-secondary);
}

/* Error message */
.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Hint */
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Password strength */
.password-strength {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.password-strength__bar {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  transition: background var(--transition-base);
}

.password-strength__bar--filled-1 { background: var(--color-danger); }
.password-strength__bar--filled-2 { background: var(--color-warning); }
.password-strength__bar--filled-3 { background: var(--color-success); }

/* ════════════════════════════
   CARDS
   ════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.card--interactive {
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}
.card--interactive:active {
  transform: scale(0.98);
  background: var(--bg-card-hover);
}

/* Match Card */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}
.match-card:active {
  transform: scale(0.98);
}

.match-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.match-card__sport {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  background: var(--color-primary-muted);
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.match-card__time {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

.match-card__location {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.match-card__teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.match-card__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

.match-card__team-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-chip);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  color: var(--text-primary);
  overflow: hidden;
}

.match-card__team-name {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  text-align: center;
}

.match-card__vs {
  font-family: var(--font-display);
  font-weight: var(--font-black);
  font-size: var(--text-lg);
  color: var(--text-tertiary);
}

.match-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ════════════════════════════
   CHIPS / FILTERS
   ════════════════════════════ */

.chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
  padding: 7px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  background: var(--bg-chip);
  color: var(--text-secondary);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
  flex-shrink: 0;
}
.chip:hover {
  background: var(--bg-chip-active);
  color: var(--color-primary);
}
.chip--active {
  background: var(--color-primary-muted);
  color: var(--color-primary);
  border-color: rgba(34,197,94,0.3);
}

/* ════════════════════════════
   AVATARS
   ════════════════════════════ */

.avatar {
  border-radius: var(--radius-full);
  background: var(--bg-chip);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  color: var(--text-secondary);
}

.avatar--xs  { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar--sm  { width: 36px; height: 36px; font-size: var(--text-sm); }
.avatar--md  { width: 48px; height: 48px; font-size: var(--text-md); }
.avatar--lg  { width: 64px; height: 64px; font-size: var(--text-xl); }
.avatar--xl  { width: 80px; height: 80px; font-size: var(--text-2xl); }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar group */
.avatar-stack {
  display: flex;
}
.avatar-stack .avatar {
  border: 2px solid var(--bg-app);
  margin-left: -8px;
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}

/* ════════════════════════════
   STATUS BADGES
   ════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--pending    { background: rgba(245,158,11,0.12); color: var(--status-pending); }
.badge--confirmed  { background: rgba(34,197,94,0.12);  color: var(--status-confirmed); }
.badge--cancelled  { background: rgba(239,68,68,0.12);  color: var(--status-cancelled); }
.badge--declined   { background: rgba(148,163,184,0.12); color: var(--status-declined); }
.badge--pro        { background: rgba(245,158,11,0.12); color: var(--color-accent); }

/* ════════════════════════════
   HEADER
   ════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
}

.header__logo {
  font-family: var(--font-display);
  font-weight: var(--font-black);
  font-size: var(--text-xl);
  color: var(--color-primary);
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.header__title {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  flex: 1;
}

.header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.header__back:hover {
  background: var(--bg-chip);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* ════════════════════════════
   BOTTOM NAV
   ════════════════════════════ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  z-index: var(--z-sticky);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-2);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.bottom-nav__item--active {
  color: var(--color-primary);
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
}

/* ════════════════════════════
   AUTH LAYOUT
   ════════════════════════════ */

.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-6) var(--space-5);
  max-width: var(--max-width);
  margin: 0 auto;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo__mark {
  font-family: var(--font-display);
  font-weight: var(--font-black);
  font-size: var(--text-4xl);
  color: var(--color-primary);
  letter-spacing: -0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.auth-logo__tagline {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-form__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.auth-form__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

.auth-alert {
  background: var(--color-danger-muted);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-danger);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.auth-alert--success {
  background: var(--color-primary-muted);
  border-color: rgba(34,197,94,0.25);
  color: var(--color-primary);
}

/* ════════════════════════════
   AD COMPONENTS
   ════════════════════════════ */

.ad-label {
  font-size: 10px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ad-label);
  text-align: center;
  margin-bottom: var(--space-1);
}

.ad-banner {
  width: 100%;
  min-height: 90px;
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-inline {
  width: 100%;
  min-height: 120px;
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ════════════════════════════
   NOTIFICATIONS
   ════════════════════════════ */

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item--unread { background: var(--color-primary-dim); }

.notif-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-item__content { flex: 1; }

.notif-item__text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-snug);
}

.notif-item__time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ════════════════════════════
   SECTION HEADERS
   ════════════════════════════ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0 var(--space-3);
}

.section-header__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.section-header__action {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

/* ════════════════════════════
   PLAN / PRO BADGE
   ════════════════════════════ */

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plan-badge--pro {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
}

.plan-badge--free {
  background: var(--bg-chip);
  color: var(--text-tertiary);
}

/* ════════════════════════════
   MODAL / BOTTOM SHEET
   ════════════════════════════ */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: var(--bg-card);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-4) var(--space-5) calc(var(--space-5) + var(--safe-bottom));
  z-index: var(--z-modal);
  animation: sheet-up 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-up {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}

.bottom-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  margin: 0 auto var(--space-4);
}

/* ════════════════════════════
   MEMBER LIST ITEM
   ════════════════════════════ */

.member-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.member-item:last-child {
  border-bottom: none;
}

.member-item__info { flex: 1; }

.member-item__name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.member-item__username {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ════════════════════════════
   LOADING SCREEN
   ════════════════════════════ */

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: var(--z-modal);
}

.loading-screen__logo {
  font-family: var(--font-display);
  font-weight: var(--font-black);
  font-size: var(--text-4xl);
  color: var(--color-primary);
  letter-spacing: -0.04em;
  text-transform: uppercase;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
