/* Transactions page styles */
.transactions-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.filter-group label {
  font-weight: bold;
  margin-bottom: 5px;
}

.filter-group select,
.filter-group input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Transaction page card styles */
.transaction-card {
  background-color: #1b1a1a;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 15px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.transaction-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  background-color: #2c2b2b;
  border-bottom: 1px solid #eee;
}

.transaction-type {
  font-weight: bold;
}

.transaction-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-complete {
  background-color: #e6f7e6;
  color: #2e7d32;
}

.status-failed {
  background-color: #ffeaea;
  color: #d32f2f;
}

.transaction-content {
  padding: 15px;
}

.adds-section, .drops-section, .faab-section {
  margin-bottom: 15px;
}

.adds-section h4, .drops-section h4, .faab-section h4 {
  margin-bottom: 8px;
  color: #555;
}

.adds-section ul, .drops-section ul, .faab-section ul {
  list-style: none;
  padding: 0;
}

.adds-section li, .drops-section li, .faab-section li {
  padding: 5px 0;
  display: flex;
  align-items: center;
}

.faab-section {
  margin-top: 15px;
  padding: 10px;
  background-color: #2a2929;
  border-radius: 4px;
  border-left: 3px solid #ffc107; /* Yellow highlight for FAAB transfers */
}

.faab-section h4 {
  color: #ffc107;
  margin-bottom: 8px;
}

.faab-section li {
  padding: 5px 0;
}

.faab-amount {
  font-weight: bold;
  color: #ffc107;
}

/* Ensure the section is visible for all transaction types */
.transaction-card.trade .faab-section,
.transaction-card.waiver .faab-section,
.transaction-card.free_agent .faab-section {
  display: block !important;
}

.transaction-symbol {
  font-weight: bold;
  margin-right: 8px;
  display: inline-block;
  width: 16px;
  text-align: center;
}

.add-symbol {
  color: #28a745;
}

.drop-symbol {
  color: #dc3545;
}

.player-transaction {
  margin-bottom: 10px;
  padding: 5px 0;
}

.position {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  margin-right: 5px;
  font-size: 0.85rem;
  font-weight: bold;
}

.player-name {
  font-weight: normal;
  margin-right: 5px;
}

.owner {
  font-style: italic;
  color: #999;
  font-size: 0.9rem;
  margin-top: 3px;
}

.faab-amount-positive {
  font-weight: bold;
  color: #28a745;
  margin-left: 5px;
}

.faab-amount-zero {
  font-weight: bold;
  color: #6c757d;
  margin-left: 5px;
}

.trade-section {
  padding: 5px 0;
}

.trade-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.trade-player {
  flex: 1;
}

.trade-exchange {
  font-weight: bold;
  font-size: 1.3rem;
  margin: 0 10px;
  color: #9cb1c0;
}

.faab-transfer {
  margin-top: 8px;
  font-style: italic;
}

.faab-amount {
  font-weight: bold;
  color: #ffc107;
}

.position-PICK {
  background-color: #e8eaf6;
  color: #3f51b5;
}

.faab-transfer {
  margin-top: 8px;
  font-style: italic;
}

.faab-sender, .faab-receiver {
  font-weight: 500;
}

.draft-picks {
  margin-top: 10px;
}



.position {
  display: inline-block;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  margin-right: 6px;
  position: relative;
  z-index: 1;
}

/* Remove all the connected position styling */
.transaction-card li .position + .position,
.transaction-card li .position:not(:last-of-type),
.transaction-card li .position:last-of-type {
  border-radius: 4px;
  margin-right: 6px;
  margin-left: 0;
}

/* create a wrapper for multi-positions */
.transaction-card li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Ensure consistent spacing between elements */
.transaction-card li .player-name {
  margin-left: 4px;
}

.player-name {
  font-weight: 500;
  margin-right: 8px;
}

.owner {
  color: #666;
  font-size: 14px;
}

.notes {
  margin-top: 15px;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
  font-style: italic;
}

.transaction-footer {
  padding: 10px 15px;
  border-top: 1px solid #eee;
  background-color: #2c2b2b;
  display: flex;
  justify-content: space-between;
}

.transaction-id {
  color: #999;
  font-size: 12px;
}

/* Transaction type-specific styling */
.transaction-card.waiver {
  border-left: 4px solid #4285f4;
}

.transaction-card.free_agent {
  border-left: 4px solid #34a853;
}

.transaction-card.trade {
  border-left: 4px solid #fbbc05;
}

.loading, .no-transactions {
  padding: 30px;
  text-align: center;
  color: #666;
}

.transaction-card {
    transition: all 0.2s ease;
    border-left: 5px solid #ccc;
}

.transaction-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.transaction-card.trade {
    border-left-color: #007bff;
}

.transaction-card.waiver {
    border-left-color: #28a745;
}

.transaction-card.free_agent {
    border-left-color: #6c757d;
}

.transaction-card.commissioner {
    border-left-color: #dc3545;
}

.badge.transaction-type {
    font-size: 0.9rem;
}

.badge.transaction-status.complete {
    background-color: #28a745;
}

.badge.transaction-status.failed {
    background-color: #dc3545;
}

.player-item {
    display: flex;
    align-items: center;
}

.player-position {
    flex: 0 0 40px;
    text-align: center;
    padding: 0.2rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    font-weight: bold;
    background: #e9ecef; /* Default fallback background */
}

/* Position-specific colors */
.position-WR, .position[data-position="WR"] {
    background-color: #c5e8ff; /* Light Blue */
    color: #0056b3;
}

.position-QB, .position[data-position="QB"] {
    background-color: #ffcccb; /* Light Red */
    color: #c62828;
}

.position-RB, .position[data-position="RB"] {
    background-color: #c8e6c9; /* Light Green */
    color: #2e7d32;
}

.position-TE, .position[data-position="TE"],
.position-DL, .position[data-position="DL"] {
    background-color: #ffe0b2; /* Light Orange */
    color: #e65100;
}

.position-LB, .position[data-position="LB"] {
    background-color: #bbdefb; /* Light Blue */
    color: #1565c0;
}

.position-DB, .position[data-position="DB"] {
    background-color: #f8bbd0; /* Light Pink */
    color: #c2185b;
}

.player-name {
    flex: 1;
}

.player-owner {
    flex: 0 0 auto;
    font-style: italic;
    color: #6c757d;
}

#toggle-filters:focus {
    box-shadow: none;
}

/* Notes tooltip styling */
.notes-icon {
  position: relative;
  display: inline-block;
  margin-left: 8px;
  width: 16px;
  height: 16px;
  background: #ffc107;
  color: #000;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-weight: bold;
  font-size: 12px;
  font-style: italic;
  cursor: pointer;
}

.notes-tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: #333;
  color: white;
  text-align: left;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 10000;
  bottom: 160%; /* Position above the icon */
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  font-weight: normal;
  font-style: normal;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

/* Add a triangle pointer */
.notes-tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.notes-icon:hover .notes-tooltip-text {
  visibility: visible;
}

/* Remove any overflow constraints in parent containers */
.transaction-footer,
.transaction-status-container,
.transaction-card,
.transaction-status {
  overflow: visible !important;
}

/* Button container responsive styling */
@media (max-width: 767px) {
  /* On small screens, stack buttons vertically */
  #transaction-search .d-flex.justify-content-between {
    flex-direction: column;
    gap: 10px;
  }

  /* Make buttons full width on small screens */
  #transaction-search .d-flex.justify-content-between button {
    width: 100%;
  }
}

/* Add some margin between stacked buttons */
#transaction-search .btn {
  margin: 2px 0;
}

/* Ensure proper spacing between button icon and text */
#transaction-search .btn i {
  margin-right: 8px;
}

/* Improve button appearance */
#transaction-search .d-flex.justify-content-between {
  margin-top: 15px;
}

/* No search message */
.no-search-message {
  padding: 30px;
  text-align: center;
  color: #666;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-top: 20px;
}

.no-search-message p {
  font-size: 16px;
  margin-bottom: 0;
}

/* Add loading state optimization for mobile */
@media (max-width: 768px) {
  .loading, .no-transactions, .no-search-message {
    padding: 15px;
    font-size: 14px;
  }
}

/* Make cards full-width on mobile */
@media (max-width: 768px) {
  .transaction-card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Stack content vertically on mobile */
  .transaction-content .row {
    flex-direction: column;
  }

  .adds-section, .drops-section {
    width: 100%;
    margin-bottom: 20px;
  }

  /* Improve spacing on mobile */
  .transaction-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .transaction-date {
    margin-top: 5px;
  }
}

@media (max-width: 768px) {
  /* Larger touch targets on mobile */
  .transaction-card li,
  .transaction-header,
  .transaction-footer {
    padding: 12px;
  }

  /* More space between elements */
  .transaction-card .position {
    margin-bottom: 5px;
  }

  /* Better readability on small screens */
  .transaction-card .player-name,
  .transaction-card .owner {
    display: block;
    width: 100%;
  }

  /* Improve FAAB section readability */
  .faab-section li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* Adjust buttons and interactive elements */
  .notes-icon {
    width: 24px;
    height: 24px;
    line-height: 24px;
  }

  /* Prevent tooltip overflow issues on mobile */
  .notes-tooltip-text {
    width: 80vw;
    left: 0;
    transform: none;
  }
}

@media (max-width: 576px) {
  /* More compact header on very small screens */
  .transaction-status, .transaction-type {
    font-size: 0.8rem;
    padding: 3px 6px;
  }

  /* Stack footer elements on very small screens */
  .transaction-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .transaction-id {
    margin-top: 5px;
  }
}

/* General container fix for all screen sizes */
.container {
  width: 100% !important;
  max-width: 1170px;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}

/* Ensure transaction cards are responsive on all screen sizes */
.transaction-card {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* Improve content flow on mobile */
@media (max-width: 768px) {
  /* Ensure content wraps properly */
  .transaction-content {
    display: flex;
    flex-direction: column;
  }

  /* Make all text elements wrap properly */
  .transaction-card li,
  .transaction-header,
  .player-name,
  .owner,
  .transaction-id,
  .transaction-date {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  /* Prevent position badges from overflowing */
  .position {
    display: inline-block;
    margin: 2px;
  }

  /* Stack elements in trade section */
  .trade-section {
    flex-direction: column;
  }

  .trade-teams {
    flex-direction: column;
  }

  .trade-exchange {
    transform: rotate(90deg);
    margin: 10px auto;
  }

  /* Fix footer layout */
  .transaction-footer {
    flex-wrap: wrap;
    gap: 5px;
  }
}

/* Add text truncation for long player names */
.player-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Fix tooltips on mobile */
@media (max-width: 768px) {
  .notes-tooltip-text {
    width: 80vw;
    max-width: 100%;
    left: auto;
    right: 0;
  }
}

/* Fix specifically for very small screens */
@media (max-width: 576px) {
  /* Ensure the content area doesn't overflow */
  .transactions-content {
    width: 100%;
    overflow-x: hidden;
  }

  /* Better handling of data in transaction cards */
  .transaction-content {
    padding: 10px;
  }

  /* Allow player names to wrap when needed */
  .player-name {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  /* Fix notes tooltip position that may be causing overflow */
  .notes-tooltip-text {
    width: 200px;
    max-width: 80vw;
    right: -10px;
    left: auto;
  }

  /* Fix the row display in transaction footers */
  .transaction-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Make trade sections stack better on small screens */
  .trade-section {
    flex-direction: column;
  }

  .trade-teams {
    flex-direction: column;
  }

  .trade-exchange {
    transform: rotate(90deg);
    margin: 10px 0;
  }
}

/* Improve pagination appearance on small screens */
@media (max-width: 576px) {
  .pagination-controls {
    flex-direction: column;
    align-items: center;
  }

  .pagination {
    margin-top: 10px;
  }
}

/* Fix tooltip positioning on all mobile screens */
@media (max-width: 768px) {
  .notes-tooltip-text {
    width: 200px;
    max-width: 200px;
    left: auto;
    right: 0;
  }
}

/* Additional fixes for very small screens */
@media (max-width: 768px) {
  .notes-tooltip-text {
    width: 200px;
    max-width: 200px;
    left: auto;
    right: -30px; /* Move tooltip more to the right */
    transform: translateX(0); /* Remove any centering transform */
  }

  /* Ensure the arrow points to the icon */
  .notes-tooltip-text::after {
    left: 90%; /* Move arrow further right */
    right: auto;
  }

  /* Make sure the tooltip container has correct positioning context */
  .notes-icon {
    position: relative;
  }
}

@media (max-width: 576px) {
  .notes-tooltip-text {
    right: -80px; /* Move even further right on the smallest screens */
  }

  .notes-tooltip-text::after {
    left: 95%; /* Position arrow at far right of tooltip */
  }
}

/* Improve trade layout on smaller screens */
@media (max-width: 768px) {
  /* Make trade teams stack vertically */
  .trade-teams {
    display: flex;
    flex-direction: column;
  }

  /* Fix the exchange arrow positioning */
  .trade-exchange {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 10px 0;
    transform: rotate(90deg); /* Change horizontal arrows to vertical */
    font-size: 20px; /* Make arrows more visible */
  }

  /* Ensure proper spacing between team assets */
  .team-assets {
    margin-bottom: 5px;
    width: 100%;
  }

  /* Adjust team name positioning */
  .team-name {
    font-weight: bold;
    margin-bottom: 5px;
  }
}