/* Player Image Fallback Styles */
.player-image-fallback {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    flex-shrink: 0;
}

.player-image-fallback i {
    font-size: 24px;
}

/* Ensure player image container handles both image and fallback */
.player-card .col-auto:first-child {
    position: relative;
}

.player-card .player-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
    display: block;
    max-width: 100%;
    height: auto;
}

/* Fetch Player Button Styles */
#fetchPlayerBtn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

#fetchPlayerBtn:hover {
    background-color: #0d6efd;
    color: white;
}

/* Player Selection Modal Styles */
#playerSelectionModal .list-group-item {
    border: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

#playerSelectionModal .list-group-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#playerSelectionModal .list-group-item-action:active {
    background-color: #e9ecef;
}

/* Input Group Styles */
.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Global Styles */
body {
  background-color: #f8f9fa;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding-bottom: 60px;
}

.container {
  max-width: 1400px;
}

/* Header Styles */
header {
  border-bottom: 4px solid #198754;
}

.navbar-brand {
  font-weight: bold;
  font-size: 1.5rem;
}

.user-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.user-info h4 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.user-role {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Card Styles */
.card {
  border: none;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
}

.card:hover {
  transform: translateY(-2px);
}

.card-header {
  border-radius: 15px 15px 0 0 !important;
  border-bottom: none;
  font-weight: 600;
}

/* Team Cards */
.team-card {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background-color: #fff;
}

/* Player Cards */
.player-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease-in-out;
  position: relative;
}

.player-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.15);
}

.player-card .player-image {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background-color: #f8f9fa;
  display: block;
  max-width: 100%;
  height: auto;
}

.player-card .player-role {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.player-card .btn-group {
  margin-left: auto;
}

/* Match List Table */
.table th {
  font-weight: 600;
  border-bottom-width: 2px;
}

.team-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Custom Tabs */
.nav-tabs {
  border-bottom: 2px solid #e9ecef;
}

.nav-tabs .nav-link {
  border: none;
  border-radius: 10px 10px 0 0;
  color: #6c757d;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  margin-right: 0.5rem;
}

.nav-tabs .nav-link:hover {
  color: #667eea;
  background-color: rgba(102, 126, 234, 0.1);
}

.nav-tabs .nav-link.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

/* Toast Notification */
.toast {
  border-radius: 10px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-header {
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  font-weight: 600;
}

/* Input Focus */
.form-control, .form-select {
  border-radius: 8px;
  border: 2px solid #e9ecef;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-control:focus, .form-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

/* Live Badge */
.badge-live {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

/* Loading Spinner */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
  
  .btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .player-card {
    padding: 0.75rem;
  }
  
  .player-card .player-image {
    width: 50px;
    height: 50px;
  }
  
  .player-card .stats-container {
    gap: 0.125rem;
  }
  
  .player-card .stats-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
  
  .player-card .btn-group {
    margin-top: 0.5rem;
    margin-left: 0;
  }
}

/* Player stats container and badges */
.stats-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.stats-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background-color: #e9ecef;
  white-space: nowrap;
}

.stats-badge.runs {
  background-color: #d1e7dd;
  color: #0f5132;
}

.stats-badge.wickets {
  background-color: #cfe2ff;
  color: #084298;
}

.stats-badge.overs {
  background-color: #fff3cd;
  color: #664d03;
}

/* API Integration Styles */
.api-status-alert {
  border-radius: 10px;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-group-api {
  display: flex;
  gap: 0.5rem;
}

.btn-api {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 6px;
}

/* Table Styles */
.table {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  font-weight: 600;
  padding: 1rem 0.75rem;
}

.table tbody tr {
  transition: background-color 0.2s ease-in-out;
}

.table tbody tr:hover {
  background-color: rgba(102, 126, 234, 0.05);
}

.table td {
  padding: 1rem 0.75rem;
  vertical-align: middle;
  border-color: #e9ecef;
}

/* Ensure checkbox column remains visible and centered */
td.text-center input.match-select,
td.text-center input.form-check-input {
  display: inline-block;
}

/* API Integration specific styles */
.api-integration-column {
  min-width: 120px;
}

.manual-match-indicator {
  font-size: 0.75rem;
  color: #6c757d;
  font-style: italic;
}

/* Success/Error states */
.alert-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
}

.alert-danger {
  background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
  color: white;
  border: none;
}

.alert-info {
  background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
  color: white;
  border: none;
}

.alert-warning {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  color: #212529;
  border: none;
}

/* API Integration Dropdown */
.btn-group .dropdown-menu {
  border-radius: 8px;
  border: 2px solid #e9ecef;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 2px;
}

.btn-group .dropdown-item {
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.btn-group .dropdown-item:hover {
  background-color: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.btn-group .dropdown-item:active {
  background-color: #667eea;
  color: white;
}

.btn-group .dropdown-toggle-split {
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}