/**
 * ScoreBirdie - Component Styles
 * Badminton Brand Consistent
 */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-icon {
  font-size: var(--font-size-lg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(18, 182, 166, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: var(--white);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  color: var(--white);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-large,
.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
}

.btn-small,
.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
}

.btn-block {
  width: 100%;
}

/* Google Sign-in Button */
.btn-google {
  background: white;
  color: #333;
  border: 1px solid var(--border);
}

.btn-google:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn-google img {
  width: 18px;
  height: 18px;
}

/* Score Buttons - Large tap targets for scoring */
.btn-score {
  min-width: 120px;
  min-height: 80px;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-lg);
  flex-direction: column;
  gap: var(--space-xs);
}

.btn-score-team {
  flex: 1;
  min-height: 100px;
  font-size: var(--font-size-3xl);
}

.btn-score-team-1 {
  background: linear-gradient(135deg, var(--team-1) 0%, #2563eb 100%);
}

.btn-score-team-2 {
  background: linear-gradient(135deg, var(--team-2) 0%, #db2777 100%);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label,
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea,
.form-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 182, 166, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--danger);
  margin-top: var(--space-xs);
}

select,
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.hint,
.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Checkboxes & Radios */
.checkbox-label,
.radio-label,
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"],
.form-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

/* Match Cards */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.match-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

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

/* Live Indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ===== MODALS ===== */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--navy-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s ease;
  z-index: var(--z-modal);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-lg {
  max-width: 700px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  background: var(--primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-titlebar-heading {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--navy-dark);
  margin: 0;
}

.modal-titlebar-spacer {
  flex: 1;
}

.modal-titlebar-close {
  background: transparent;
  border: none;
  color: var(--navy-dark);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.modal-titlebar-close:hover {
  opacity: 1;
}

.modal--custom {
  overflow: hidden;
}

.modal-body--custom {
  max-height: 70vh;
}

.modal-body-footer-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.modal-body-footer-row--end {
  justify-content: flex-end;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
  scrollbar-width: none;
}

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

.tab {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-lg);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

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

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--navy-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  min-width: 280px;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

/* ===== LOADING STATES ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  overflow: hidden;
}

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

.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--font-size-xl); }

/* ===== DIVIDER ===== */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin: var(--space-lg) 0;
}

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

/* ===== SCORING UI SPECIFIC ===== */

/* Score Display */
.score-display {
  text-align: center;
  padding: var(--space-xl);
}

.score-games {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.score-points {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-extrabold);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.score-points .team-1 {
  color: var(--team-1);
}

.score-points .team-2 {
  color: var(--team-2);
}

.score-separator {
  color: var(--text-muted);
  margin: 0 var(--space-md);
}

/* Service Indicator */
.service-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--warning-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--warning);
}

.service-indicator .shuttlecock {
  font-size: var(--font-size-lg);
}

.service-indicator .court-side {
  text-transform: uppercase;
  font-weight: var(--font-weight-bold);
}

/* Court View (for doubles) */
.court-view {
  background: var(--bg-court);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin: var(--space-md) 0;
}

.court-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: var(--space-sm);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
}

.court-half:last-child {
  margin-bottom: 0;
}

.court-position {
  padding: var(--space-md);
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--white);
}

.court-position.serving {
  background: var(--warning);
  color: var(--text-inverse);
  font-weight: var(--font-weight-bold);
}

.court-position.receiving {
  border: 2px dashed var(--warning);
}

/* Rally History */
.rally-history {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.rally-point {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}

.rally-point.team-1 {
  background: var(--team-1);
  color: var(--white);
}

.rally-point.team-2 {
  background: var(--team-2);
  color: var(--white);
}

.rally-point.fault {
  background: var(--danger);
  color: var(--white);
}

.rally-point.let {
  background: var(--gray-500);
  color: var(--white);
}

/* Game Score Cards */
.game-scores {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-md);
}

.game-score {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

.game-score.current {
  background: var(--primary);
  color: var(--white);
  font-weight: var(--font-weight-bold);
}

.game-score.won-1 {
  border-bottom: 2px solid var(--team-1);
}

.game-score.won-2 {
  border-bottom: 2px solid var(--team-2);
}

/* Interval/Break Indicator */
.interval-banner {
  background: linear-gradient(135deg, var(--info) 0%, var(--info-dark) 100%);
  color: var(--white);
  text-align: center;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-weight: var(--font-weight-semibold);
}

/* Game Win Celebration */
.celebration-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-toast);
  cursor: pointer;
  animation: fadeIn 0.3s ease;
}

.celebration-content {
  text-align: center;
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.celebration-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.celebration-message {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

.celebration-overlay.game_win {
  background: rgba(0, 0, 0, 0.85);
}

.celebration-overlay.game_win .celebration-message {
  font-size: 2.5rem;
  color: var(--gold);
}

.celebration-overlay.match_win {
  background: rgba(0, 0, 0, 0.9);
}

.celebration-overlay.match_win .celebration-message {
  font-size: 3rem;
  background: linear-gradient(135deg, #ffd700, var(--teal), #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-pulse { animation: pulse 2s infinite; }
.animate-slide-in { animation: slideIn 0.3s ease; }
.animate-fade-in { animation: fadeIn 0.3s ease; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-md);
}

/* ===== SETTINGS MODAL ===== */
.settings-section {
  margin-bottom: var(--space-lg);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-table td {
  padding: var(--space-xs) 0;
  font-size: var(--font-size-sm);
}

.settings-label {
  color: var(--text-muted);
  width: 50%;
}

.settings-value {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  text-align: right;
}

.settings-hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
}

.settings-court-teams {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-court-team {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.settings-team-header {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

.settings-positions {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
}

.settings-position {
  color: var(--text-primary);
}

.position-label {
  color: var(--text-muted);
  margin-right: var(--space-xs);
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
