* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #fff;
  min-height: 100vh;
}

.container {
  margin: 0 auto;
  background: white;
  overflow: hidden;
}

.content,
.header {
  max-width: 800px;
  margin: 0 auto;
}

.header-fullwidth-wrapper {
  width: 100%;
  background: linear-gradient(135deg, #232526 0%, #414345 100%);
  padding: 0;
}

.header {
  color: white;
  padding: 8px;
  gap: 8px;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.header p {
  opacity: 0.9;
}

h1 {
  flex-shrink: 0;
}

.header .league-selector {
  margin: 0;
  flex-shrink: 2;
}

.header .league-selector label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: white;
}

.header .league-selector select {
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  width: 100%;
}

.error {
  background: #fee;
  color: #c33;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid #c33;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 8px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.85rem;
}

.stat-badge .badge-emoji {
  font-size: 1rem;
  line-height: 1;
}

.stat-badge .badge-value {
  font-weight: 600;
  color: #333;
}

.stat-badge .badge-value.positive {
  color: #4caf50;
}

.stat-badge.balance-badge {
  background: #e8f5e9;
  border-color: #4caf50;
  padding: 4px 10px;
}

.balance-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  line-height: 1.2;
}

.player-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.balance-stack .badge-value.projected {
  font-size: 0.65rem;
  color: #4caf50;
  font-weight: 500;
  line-height: 1.1;
}

.balance-stack .badge-value.current {
  font-size: 0.8rem;
  line-height: 1.1;
}

.stat-badge.invalid {
  background: #ffebee;
  border-color: #f44336;
}

.stat-badge.invalid .badge-value {
  color: #c62828;
}

.stat-badge.error-badge {
  background: #ffebee;
  border-color: #f44336;
  color: #c62828;
}

.stat-badge.error-badge .badge-value {
  color: #c62828;
}

.balance-stack .badge-value.projected {
  font-size: 0.7rem;
  color: #4caf50;
  font-weight: 500;
}

.balance-stack .badge-value.current {
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-badge.value-badge {
  background: #f5f5f5;
  border-color: #e0e0e0;
  padding: 4px 10px;
}

.value-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  line-height: 1.2;
}

.value-stack .badge-value.diff {
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.1;
}

.value-stack .badge-value.diff.positive {
  color: #4caf50;
}

.value-stack .badge-value.diff.negative {
  color: #f44336;
}

.value-stack .badge-value.current {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.stat-label {
  font-size: 0.65rem;
  opacity: 0.9;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
}

.stat-subvalue {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 4px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.stat-subvalue {
  font-size: 1rem;
  opacity: 0.8;
  margin-top: 8px;
  font-weight: 400;
}

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

.checkbox-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.checkbox-cell.s11-cell input[type="checkbox"] {
  accent-color: #11998e;
}

.value-cell .diff-value,
.value-cell .market-value {
  font-size: 0.85rem;
}

.diff-value {
  margin-bottom: 4px;
}

.info-box {
  background: #e3f2fd;
  color: #1565c0;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #1565c0;
}

.data-grid {
  display: grid;
  grid-template-columns: 60px min-content min-content fit-content(0) 1fr 120px;
}

.grid-header,
.grid-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}

.grid-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f5f5f5;
  font-weight: 600;
  color: #333;
}

.grid-cell {
  font-size: 0.85rem;
  padding: 8px 5px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
}

.grid-row:hover {
  background: #f9f9f9;
}

.currency {
  justify-content: flex-end;
}

.value-cell {
  flex-direction: column;
  align-items: flex-end;
  flex-direction: column;
  display: flex;
  justify-content: center;
}

.positive {
  color: #4caf50;
}

.negative {
  color: #f44336;
}

.separator-row {
  background: #e0e0e0 !important;
  font-weight: bold;
}

.separator-row .grid-cell {
  border-top: 2px solid #999;
  border-bottom: 2px solid #999;
}

.cell-pos {
  max-width: 32px;
  padding: 0;
}

.cell-s11,
.cell-sell,
.cell-pos,
.cell-image {
  justify-content: center;
}

.img-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
}

.cell-image {
  padding: 0;
}

.cell-image img {
  height: 80px;
  object-fit: cover;
  vertical-align: middle;
}

.grid-cell:first-child {
  padding-left: 8px;
}

.grid-cell:last-child {
  padding-right: 8px;
}

/* Probability pills */
.player-pills {
  display: inline-flex;
  flex-direction: row;
  gap: 4px;
}

.prob-pill {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.2;
  min-width: 24px;
  text-align: center;
}

/* Loading skeleton animation for LI pill */
.prob-pill.loading {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1s ease-in-out infinite;
  color: rgba(100, 100, 100, 0.5);
  pointer-events: none;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Popover Overlay */
.transfer-popover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 1000;
  backdrop-filter: blur(2px);
  padding-top: 10vh;
  padding-bottom: 10vh;
}

.popover-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #232526 0%, #414345 100%);
}

.popover-header h3 {
  margin: 0;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.popover-body {
  padding: 20px;
}

/* Search Input */
.player-search-input {
  width: 100%;
  padding: 12px 16px;
}

/* Search Results */
.search-results {
  margin-top: 12px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

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

.search-result-item:hover {
  background: #f5f5f5;
}

.result-image-wrapper {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-name {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.result-position {
  color: #333;
  font-weight: 600;
}

.result-owner {
  color: #666;
}

.result-owner::before {
  content: "👤 ";
}

.result-value {
  margin-left: auto;
  font-weight: 600;
}

.no-results,
.search-error {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

.search-error {
  color: #dc3545;
}

/* Price Input */
.price-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.9rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  text-align: right;
  font-family: inherit;
  color: #495057;
}

.price-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Delete Button */
.delete-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
  opacity: 0.7;
}

.delete-btn:hover {
  background: #ffebee;
  opacity: 1;
}

/* Planned transfer row styles - light grey background */
.planned-transfer-row {
  background-color: #f5f5f5 !important;
}

.planned-transfer-row:hover {
  background-color: #e8e8e8 !important;
}

/* Cell adjustments for planned transfers */
.planned-transfers-grid {
  grid-template-columns: 60px min-content min-content 1fr min-content !important;
}

.planned-transfers-grid .cell-value {
  padding-left: 16px;
}

.planned-transfer-row .cell-value {
  display: flex;
  align-items: center;
}

.planned-transfer-row .player-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.planned-transfer-row .player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planned-transfer-row .price-input {
  width: auto;
  min-width: 80px;
}

.plan-transfer-btn {
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
}

.cell-value > input {
  max-width: 90px;
}

.planned-transfer-row .cell-value {
  align-items: flex-end;
}

.remove-planned-transfer-button {
  margin-left: 0.5rem;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  border-radius: 12px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
