/* ============================================
   Football Doctors KZ — Global Styles
   Dark theme, mobile-first
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  /* Background layers */
  --bg-deep: #060d1b;
  --bg-base: #0b1628;
  --bg-card: #111e35;
  --bg-card-hover: #162844;
  --bg-input: #0d1a2e;
  --bg-input-focus: #101f38;

  /* Brand colors */
  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-glow: rgba(34, 197, 94, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --telegram-blue: #2AABEE;
  --telegram-hover: #229ED9;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;

  /* Borders */
  --border-subtle: rgba(148, 163, 184, 0.1);
  --border-input: rgba(148, 163, 184, 0.15);
  --border-input-focus: rgba(59, 130, 246, 0.5);

  /* Status */
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-button: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-glow-primary: 0 0 20px var(--primary-glow);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Manrope', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

html {
  overflow-x: hidden;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-blue-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Background Pattern (reusable) --- */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  width: 100%;
  max-width: 100vw;
}

.bg-pattern::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
}

.bg-pattern::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(34, 197, 94, 0.04) 0%, transparent 70%);
}

/* --- Layout Containers --- */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-md);
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Card Component --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.card--compact {
  padding: var(--space-lg);
}

/* --- Auth Page (fullscreen mobile, card on desktop) --- */
.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-card);
}

.auth-page .bg-pattern {
  display: none;
}

.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
  max-width: 100%;
}

.auth-footer {
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Tablet+ : card style */
@media (min-width: 480px) {
  .auth-page {
    background: var(--bg-deep);
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
  }

  .auth-page .bg-pattern {
    display: block;
  }

  .auth-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    max-width: 420px;
    padding: var(--space-2xl);
    position: relative;
    overflow: hidden;
  }

  .auth-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  }
}

/* --- Logo --- */
.logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.logo img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 4px 16px rgba(59, 130, 246, 0.15));
}

/* --- Typography --- */
.heading-lg {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

.heading-md {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-primary);
}

.heading-sm {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.text-center {
  text-align: center;
}

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

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

.text-sm {
  font-size: 0.8125rem;
}

.text-xs {
  font-size: 0.75rem;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
  outline: none;
}

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

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:focus {
  background-color: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select option {
  background: #1e1e2e;
  color: #e2e8f0;
}

/* Phone input with country code */
.phone-input-wrapper {
  display: flex;
  gap: var(--space-sm);
}

.phone-prefix {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.phone-prefix .flag {
  font-size: 1.125rem;
  line-height: 1;
}

.phone-input-wrapper .form-input {
  flex: 1;
  min-width: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  height: 48px;
  padding: 0 var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  outline: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary — green */
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-button), var(--shadow-glow-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-button), 0 0 28px var(--primary-glow);
}

/* Secondary — outline */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-input);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(148, 163, 184, 0.25);
}

/* Telegram */
.btn-telegram {
  background: var(--telegram-blue);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-button);
}

.btn-telegram:hover {
  background: var(--telegram-hover);
}

.btn-telegram svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Button icon */
.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.divider span {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Links & Footer --- */
.form-footer {
  margin-top: var(--space-lg);
  text-align: center;
}

.form-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.form-footer a {
  color: var(--accent-blue);
  font-weight: 500;
}

.page-footer {
  padding: var(--space-md);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.page-footer span {
  color: var(--accent-blue);
}

/* --- Toast Notifications --- */
.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0;
  transition: all var(--transition-slow);
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background: var(--success);
  color: white;
}

.toast-error {
  background: var(--error);
  color: white;
}

/* --- Utility --- */
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in {
  animation: fadeInUp 0.5s var(--transition-slow) both;
}

.animate-in-delay-1 { animation-delay: 100ms; }
.animate-in-delay-2 { animation-delay: 200ms; }
.animate-in-delay-3 { animation-delay: 300ms; }
.animate-in-delay-4 { animation-delay: 400ms; }

/* --- Site Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 22, 40, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--space-md);
  width: 100%;
  overflow: hidden;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 960px;
  margin: 0 auto;
  gap: var(--space-sm);
}

.site-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.site-header-logo img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.site-header-logo span {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.site-header-back {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

.site-header-back svg {
  width: 20px;
  height: 20px;
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Small buttons (header) */
.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-sm-primary {
  background: var(--primary);
  color: white;
}

.btn-sm-primary:hover {
  background: var(--primary-hover);
}

.btn-sm-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-input);
}

.btn-sm-ghost:hover {
  background: rgba(255,255,255,0.04);
}

/* --- Bottom Navigation (mobile app style) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 22, 40, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.5625rem;
  font-weight: 600;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.bottom-nav-item:hover {
  color: var(--text-secondary);
}

.bottom-nav-item.active:hover {
  color: var(--primary);
}

/* Pages with bottom nav need padding */
.has-bottom-nav {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* --- Alerts --- */
.warning-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

/* --- Page Content --- */
.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

/* --- Site Footer --- */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.site-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.site-footer a {
  color: var(--accent-blue);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-active { background: rgba(34, 197, 94, 0.12); color: var(--primary); }
.badge-upcoming { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.badge-finished { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --- Filter Pills --- */
.filters {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(255,255,255,0.04);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* --- Tables: horizontal scroll on mobile --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* --- Responsive (tablet+) --- */
@media (min-width: 768px) {
  .card {
    padding: var(--space-2xl);
  }

  .logo img {
    width: 112px;
    height: 112px;
  }

  /* Hide bottom nav on desktop */
  .bottom-nav {
    display: none;
  }

  .has-bottom-nav {
    padding-bottom: 0;
  }
}
