/* dashboard.css */

/* =================================== */
/* =====     BASE STYLES         ===== */
/* =================================== */

table {
  margin-top: 0px;
}

/* Main Container */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1a2851;
}

.dashboard-filter {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  background-color: #fff;
  cursor: pointer;
  width: auto;
  min-width: 180px;
}

/* Performance Overview - KPI Cards */
.performance-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background-color: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 160px;
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: #667085;
  margin-bottom: 8px;
  display: block;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #1a2851;
  line-height: 1.2;
  margin-bottom: 20px;
}

/* Remove margin-bottom from last kpi-value in a card */
.kpi-card .kpi-value:last-child {
  margin-bottom: 0;
}

.kpi-value.positive {
  color: #10b981;
}

.kpi-value.negative {
  color: #ef4444;
}

/* KPI Cards with Dual Stats */
.kpi-dual {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.kpi-item {
  flex: 1;
}

.kpi-item .kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #667085;
  margin-bottom: 8px;
  display: block;
  text-transform: uppercase;
}

.kpi-item .kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #1a2851;
  line-height: 1.2;
}

.kpi-item .kpi-value.secondary {
  font-size: 20px;
  color: #667085;
}

/* Outcomes Pie Chart Card */
.outcomes-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.pie-chart-container {
  height: 160px;
  width: 160px;
  margin: 0 auto;
  position: relative;
}

.outcomes-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  font-size: 11px;
  color: #667085;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-value {
  font-weight: 600;
  color: #1a2851;
  margin-left: auto;
}

/* Profit Card with Sparkline */
.profit-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
}

.profit-card .kpi-content {
  width: 100%;
}

.profit-card .kpi-label,
.profit-card .kpi-value {
  text-align: left;
  margin-bottom: 8px;
}

.sparkline-container {
  height: 50px;
  margin-top: 10px;
}

/* Recent Form (Results Strip inside Profit Card) */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a2851;
  margin-bottom: 16px;
}

.results-strip {
  display: flex;
  gap: 8px;
  min-height: 32px; /* Equal to icon height */
  align-items: center;
  margin-top: 16px;
}

.result-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.no-results {
  font-size: 14px;
  color: #667085;
  padding: 0 8px;
}

.result-icon.win {
  background-color: #10b981;
}
.result-icon.loss {
  background-color: #ef4444;
}
.result-icon.half-win {
  background-color: #6ee7b7;
}
.result-icon.half-loss {
  background-color: #fca5a5;
}
.result-icon.void {
  background-color: #9ca3af;
}
.result-icon.cashout {
  background-color: #60a5fa;
}

/* Pending Bets Section */
.pending-bets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-all-link {
  font-size: 14px;
  font-weight: 600;
  color: #1a2851;
  text-decoration: none;
}

.pending-bets-content {
  background-color: #fff;
  border: 1px solid #e1e4e8;
  border-radius: 12px;
  padding: 8px;
  min-height: 200px;
}

.bets-table-minimal tbody tr:last-child {
  border-bottom: none;
}

/* Empty State for Pending Bets */
.pending-empty-state {
  display: none; /* Hidden by default */
  text-align: center;
  padding: 40px 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-state-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a2851;
  margin-bottom: 8px;
}
.empty-state-text {
  font-size: 14px;
  color: #667085;
  margin-bottom: 24px;
}
.empty-state-cta {
  display: inline-block;
  padding: 10px 20px;
  background-color: #1a2851;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 0.2s;
}
.empty-state-cta:hover {
  background-color: #2e4b8f;
}

/* ======================================================= */
/* ===== REVISED & CONSOLIDATED RESPONSIVE STYLES ===== */
/* ======================================================= */

/* For Mobile devices (850px and below) */
@media (max-width: 850px) {
  .result-icon {
    width: 24px;
    height: 24px;
  }
  /* --- Main Layout & Header --- */
  .dashboard-container {
    padding: 16px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .dashboard-title {
    display: none;
  }

  .dashboard-filter {
    width: 100%;
    margin-top: 64px;
  }

  /* --- KPI Cards Fix (Single Column Layout) --- */
  .performance-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .performance-overview .profit-card,
  .performance-overview .outcomes-card {
    grid-column: span 2;
  }

  .kpi-card {
    padding: 16px;
  }

  .kpi-value {
    font-size: 24px;
  }

  /* --- Pie chart adjustments for mobile --- */
  .pie-chart-container {
    height: 140px;
    width: 140px;
  }

  /* --- THE FIX: HIDE THE CHART ON MOBILE --- */
  .sparkline-container {
    display: none;
  }

  /* --- General Mobile Adjustments --- */
  .section-title {
    font-size: 1.25rem;
  }

  .results-strip {
    flex-wrap: wrap;
    margin-top: 0px;
  }

  .empty-state-cta {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
  }

  .profit-card {
    gap: 12px;
    justify-content: center;
  }
}

/* Fix for bets-table view on dashboard */
.bets-table-minimal .mobile-cell {
  display: none; /* Hide mobile card view on desktop */
}

/* On screens smaller than 850 */
@media (max-width: 850px) {
  .bets-table-minimal .desktop-cell {
    display: none; /* Hide all desktop cells */
  }

  .bets-table-minimal .mobile-cell {
    display: table-cell; /* Show the single mobile card cell */
  }
}

/* =================================== */
/* ===== QUICK SETTLE MODAL STYLES ===== */
/* =================================== */

.settle-modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

/* This class is added by JS to show the modal */
.settle-modal.active {
  display: flex;
}

.settle-modal-content {
  background-color: #ffffff;
  margin: auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.settle-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e1e4e8;
}

.settle-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a2851;
}

.settle-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.settle-close:hover {
  color: #1a2851;
}

.settle-modal-body {
  padding: 24px;
}

.settle-match-section {
  text-align: center;
  margin-bottom: 20px;
}

.settle-match-teams {
  font-weight: 600;
  font-size: 16px;
  color: #1a2851;
}

.settle-match-selection {
  font-size: 14px;
  color: #667085;
}

.settle-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
  padding: 16px 0;
  border-top: 1px solid #e1e4e8;
  border-bottom: 1px solid #e1e4e8;
  margin-bottom: 20px;
}

.settle-info-label {
  font-size: 11px;
  color: #667085;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.settle-info-value {
  font-size: 14px;
  font-weight: 600;
  color: #1a2851;
}

.settle-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.settle-status-grid .settle-status-btn {
  padding: 10px 5px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background-color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s;
}

.settle-status-grid .settle-status-btn:hover {
  border-color: #1a2851;
  color: #1a2851;
}

.settle-status-grid .settle-status-btn.active {
  background-color: #1a2851;
  color: #fff;
  border-color: #1a2851;
}

#settle-cashout-container {
  margin-top: 16px;
}
#settle-cashout-container label {
  font-size: 12px;
  font-weight: 600;
  color: #667085;
  margin-bottom: 8px;
  display: block;
}
.settle-cashout-wrapper {
  position: relative;
}
.settle-cashout-wrapper .settle-currency-symbol {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #667085;
}
#settle-cashout-amount {
  width: 100%;
  padding: 10px 12px 10px 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.settle-profit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e1e4e8;
}

.settle-profit-label {
  font-weight: 600;
  color: #1a2851;
}

.settle-profit-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.settle-profit-value.positive {
  color: #10b981;
}
.settle-profit-value.negative {
  color: #ef4444;
}
.settle-profit-value.neutral {
  color: #667085;
}

.settle-modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  background-color: #f8f9fa;
  border-top: 1px solid #e1e4e8;
}

.settle-modal-footer button {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
}

.settle-btn-save {
  background-color: #1a2851;
  color: #fff;
  border-color: #1a2851;
}
.settle-btn-save:hover {
  background-color: #2e4b8f;
}

.settle-btn-cancel {
  background-color: #fff;
  color: #1a2851;
  border-color: #d1d5db;
}
.settle-btn-cancel:hover {
  background-color: #f9fafb;
}

.desktop-cell {
  font-size: 14px;
}

.sport-indicator {
  width: 20px;
  height: 20px;
}

.settle-btn {
  display: none;
}

/* ======================================== */
/* =====   DESKTOP-ONLY TABLE STYLING   ===== */
/* ======================================== */

@media (min-width: 851px) {
  /* 1. Apply the padding fix *only* on desktop */
  .pending-bets-content {
    padding: 0;
    overflow: hidden;
  }

  /* 2. Apply all row/cell styles *only* on desktop */

  /* Adds the border-bottom to each row */
  .pending-bets-content .bets-table-minimal tbody tr {
    border-bottom: 1px solid #e1e4e8;
    transition: background-color 0.2s ease;
  }

  /* Creates the "zebra stripe" effect */
  .pending-bets-content .bets-table-minimal tbody tr:nth-child(even) {
    background-color: #f8f9fa;
  }

  /* Creates the hover effect */
  .pending-bets-content .bets-table-minimal tbody tr:hover {
    background-color: #f0f2f5;
    cursor: pointer;
  }

  /* Stops the last row from having a border */
  .pending-bets-content .bets-table-minimal tbody tr:last-child {
    border-bottom: none;
  }

  /* Adds vertical padding to all cells */
  .pending-bets-content .bets-table-minimal tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* Adds horizontal padding ONLY to the first and last cells */
  .pending-bets-content .bets-table-minimal tbody tr td:first-child {
    padding-left: 10px;
  }

  .pending-bets-content .bets-table-minimal tbody tr td:last-child {
    padding-right: 8px;
  }
}

.mobile-outcome-stripe.status-pending {
  display: none;
}
