/* ============================================
   AileBağı — UI Components
   ============================================ */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-sm);
  padding: 14px 28px;
  border-radius: var(--r-xl);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  white-space: nowrap;
  min-height: 52px;
  letter-spacing: 0.01em;
}

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

/* Primary */
.btn-primary {
  background: var(--g-brand);
  color: white;
  box-shadow: var(--shadow-button);
}
.btn-primary:hover { box-shadow: var(--glow-brand); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0) scale(0.97); }

/* Secondary (Glass) */
.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--c-text-primary);
  backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-active); }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--c-brand-400);
  border: 2px solid var(--c-brand-700);
}
.btn-ghost:hover { background: rgba(124,58,237,0.1); box-shadow: var(--glow-brand); }

/* Danger */
.btn-danger {
  background: var(--g-danger);
  color: white;
}

/* Success */
.btn-success {
  background: var(--g-success);
  color: white;
}

/* Full width */
.btn-full { width: 100%; }

/* Large */
.btn-lg { padding: 18px 36px; font-size: 1.125rem; min-height: 60px; border-radius: var(--r-xl); }

/* Small */
.btn-sm { padding: 8px 18px; font-size: 0.875rem; min-height: 38px; border-radius: var(--r-md); }

/* Icon only */
.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  min-height: unset;
}
.btn-icon.btn-sm { width: 36px; height: 36px; }

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

/* Loading state */
.btn-loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text-secondary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
  color: var(--c-text-primary);
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: all var(--t-base);
  outline: none;
  min-height: 50px;
}

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

.form-input:focus {
  border-color: var(--c-brand-600);
  background: rgba(124, 58, 237, 0.05);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), var(--glow-brand);
}

.form-input.error {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.form-input-lg {
  padding: 18px 20px;
  font-size: 1.125rem;
  min-height: 60px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--c-danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

/* Password input with toggle */
.input-password-wrapper {
  position: relative;
}
.input-password-wrapper .form-input {
  padding-right: 52px;
}
.input-password-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.input-password-toggle:hover { color: var(--c-text-primary); }

/* Textarea */
.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ===== CODE INPUT (Oda kodu) ===== */
.code-input {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.code-input input {
  width: 44px;
  height: 54px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  color: white;
  outline: none;
  transition: all var(--t-fast);
}

.code-input input:focus {
  border-color: var(--c-brand-500);
  background: rgba(124,58,237,0.1);
  box-shadow: var(--glow-brand);
}

.code-input input.filled {
  border-color: var(--c-brand-400);
  background: rgba(124,58,237,0.15);
  color: var(--c-brand-300);
}

/* ===== CARDS ===== */
.card {
  background: var(--g-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  padding: var(--s-lg);
  transition: all var(--t-base);
}

.card:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: var(--shadow-lg);
}

.card-clickable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-float);
}

.card-clickable:active { transform: translateY(-1px); }

/* Feature Card */
.feature-card {
  border-radius: var(--r-xl);
  padding: var(--s-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--g-brand-soft);
  opacity: 0;
  transition: opacity var(--t-base);
}

.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--s-md);
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-brand   { background: rgba(124,58,237,0.2); color: var(--c-brand-300); border: 1px solid rgba(124,58,237,0.3); }
.badge-pink    { background: rgba(244,114,182,0.2); color: var(--c-pink-400); border: 1px solid rgba(244,114,182,0.3); }
.badge-success { background: rgba(16,185,129,0.2); color: var(--c-success); border: 1px solid rgba(16,185,129,0.3); }
.badge-danger  { background: rgba(239,68,68,0.2); color: var(--c-danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(245,158,11,0.2); color: var(--c-warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-glass   { background: var(--glass-bg); color: var(--c-text-secondary); border: 1px solid var(--glass-border); }

/* Live dot */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 8px var(--c-success);
  animation: pulse 2s ease infinite;
}

/* ===== AVATAR ===== */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  flex-shrink: 0;
  font-size: 1.25rem;
  background: var(--glass-bg);
}

.avatar-sm { width: 36px; height: 36px; font-size: 1rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.25rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.75rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 2.25rem; }

.avatar-team-a { border-color: var(--c-team-a); box-shadow: 0 0 12px var(--c-team-a-glow); }
.avatar-team-b { border-color: var(--c-team-b); box-shadow: 0 0 12px var(--c-team-b-glow); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: var(--z-nav);
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 5, 30, 0.85);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border-top: 1px solid var(--glass-border);
}

.bottom-nav-items {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--t-base);
  color: var(--c-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 56px;
}

.nav-item i { font-size: 1.2rem; transition: transform var(--t-spring); }
.nav-item.active { color: var(--c-brand-400); }
.nav-item.active i { transform: scale(1.15); filter: drop-shadow(0 0 6px var(--c-brand-500)); }
.nav-item:hover { color: var(--c-text-secondary); }

/* ===== HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: var(--s-lg) var(--s-md);
  padding-top: calc(var(--s-lg) + env(safe-area-inset-top, 0px));
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 2, 26, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.page-header-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-base);
  color: var(--c-text-secondary);
}
.back-btn:hover { background: var(--glass-bg-hover); color: white; }

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--s-lg) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  color: var(--c-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ===== SCORE DISPLAY ===== */
.score-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--r-full);
  overflow: hidden;
  height: 8px;
  background: rgba(255,255,255,0.1);
}

.score-bar-a {
  background: var(--g-team-a);
  transition: width 0.6s var(--t-spring);
}

.score-bar-b {
  background: var(--g-team-b);
  transition: width 0.6s var(--t-spring);
}

.score-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg);
  border-radius: var(--r-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.score-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-points {
  font-size: 2rem;
  font-weight: 900;
  animation: score-pop 0.4s var(--t-bounce);
}

.score-team-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.score-vs {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-text-muted);
}

/* ===== TEAM CHIP ===== */
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.team-chip-a { background: rgba(124,58,237,0.2); border: 1.5px solid var(--c-team-a); color: var(--c-brand-300); }
.team-chip-b { background: rgba(244,114,182,0.2); border: 1.5px solid var(--c-team-b); color: var(--c-pink-400); }

/* ===== PLAYER LIST ITEM ===== */
.player-item {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: 12px var(--s-md);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: all var(--t-fast);
}

.player-item:hover { background: var(--glass-bg-hover); }

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 0.75rem;
  color: var(--c-text-muted);
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  padding: 0 var(--s-md);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: rgba(20, 10, 50, 0.95);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--t-spring);
  pointer-events: all;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast.removing { animation: toast-out 0.3s ease forwards; }
.toast-success { border-color: rgba(16,185,129,0.4); }
.toast-success .toast-icon { color: var(--c-success); }
.toast-error   { border-color: rgba(239,68,68,0.4); }
.toast-error .toast-icon   { color: var(--c-danger); }
.toast-info    { border-color: rgba(124,58,237,0.4); }
.toast-info .toast-icon    { color: var(--c-brand-400); }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-msg { flex: 1; color: var(--c-text-primary); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  padding: 0;
  animation: fadeIn 0.25s ease;
}

.modal-overlay.centered { align-items: center; padding: var(--s-md); }

.modal-sheet {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: linear-gradient(180deg, #1a0f40, #130835);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: var(--s-lg);
  padding-bottom: calc(var(--s-lg) + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--glass-border);
  border-bottom: none;
  animation: slideUp 0.35s var(--t-spring);
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-sheet.centered {
  border-radius: var(--r-2xl);
  border-bottom: 1px solid var(--glass-border);
  animation: scaleIn 0.35s var(--t-spring);
  max-height: 80dvh;
}

.modal-drag-indicator {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--r-full);
  margin: 0 auto var(--s-lg);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: var(--s-lg);
}

/* ===== EMOJI PICKER ===== */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.emoji-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t-base);
}

.emoji-btn:hover { background: var(--glass-bg-hover); transform: scale(1.1); }
.emoji-btn.selected {
  border-color: var(--c-brand-500);
  background: rgba(124,58,237,0.2);
  box-shadow: var(--glow-brand);
  transform: scale(1.1);
}

/* ===== QR CODE ===== */
.qr-container {
  background: white;
  border-radius: var(--r-lg);
  padding: var(--s-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-md);
  padding: var(--s-3xl) var(--s-xl);
  text-align: center;
  color: var(--c-text-muted);
}

.empty-state-emoji { font-size: 3.5rem; animation: float 3s ease-in-out infinite; }
.empty-state-title { font-size: 1.1rem; font-weight: 700; color: var(--c-text-secondary); }
.empty-state-sub { font-size: 0.875rem; }

/* ===== DIFFICULTY BADGE ===== */
.difficulty-easy   { background: rgba(16,185,129,0.15); color: var(--c-success); border: 1px solid rgba(16,185,129,0.25); }
.difficulty-medium { background: rgba(245,158,11,0.15); color: var(--c-warning); border: 1px solid rgba(245,158,11,0.25); }
.difficulty-hard   { background: rgba(239,68,68,0.15);  color: var(--c-danger);  border: 1px solid rgba(239,68,68,0.25); }

/* ===== STATUS BADGE ===== */
.status-waiting  { background: rgba(245,158,11,0.2); color: var(--c-warning); }
.status-active   { background: rgba(16,185,129,0.2); color: var(--c-success); }
.status-finished { background: rgba(100,100,120,0.2); color: var(--c-text-muted); }

/* ===== PROGRESS RING ===== */
.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring circle {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

/* ===== VOICE ANSWER MODAL (Yüz yüze konuş) ===== */
.voice-modal-content {
  text-align: center;
  padding: var(--s-xl) var(--s-lg);
}

.voice-modal-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05));
  border: 2px solid rgba(16,185,129,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto var(--s-xl);
  animation: pulse 2s ease infinite;
}

.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: var(--s-lg) 0;
  height: 40px;
}

.voice-wave span {
  width: 4px;
  background: linear-gradient(180deg, var(--c-success), var(--c-brand-500));
  border-radius: 2px;
  height: 100%;
  transform-origin: bottom;
  animation: wave 1.2s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { animation-delay: 0s; height: 30%; }
.voice-wave span:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; height: 70%; }
.voice-wave span:nth-child(5) { animation-delay: 0.4s; height: 30%; }
.voice-wave span:nth-child(6) { animation-delay: 0.3s; height: 60%; }
.voice-wave span:nth-child(7) { animation-delay: 0.2s; height: 90%; }
.voice-wave span:nth-child(8) { animation-delay: 0.1s; height: 50%; }
