/* Styles for the [all_casino_bonuses] shortcode table.
   Self-contained - no dependencies on bonus-voting.css */

/* Container and wrapper styles */
.wpg-popular-bonus-summary {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 30px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.wpg-summary-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 20px;
}

/* Header layout */
.wpg-all-bonuses .wpg-all-bonuses-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wpg-all-bonuses .wpg-all-bonuses-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #495057;
}

/* Controls bar: filters left, sort right */
.wpg-all-bonuses .wpg-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.wpg-all-bonuses .wpg-controls-left,
.wpg-all-bonuses .wpg-controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.wpg-all-bonuses .wpg-bonus-type-filter,
.wpg-all-bonuses .wpg-verified-filter,
.wpg-all-bonuses .wpg-sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap; /* keep label and control in one line */
}

/* Sort by control */
.wpg-all-bonuses .wpg-sort-control label {
  font-weight: 500;
  color: #495057;
}
.wpg-all-bonuses .wpg-sort-control select.form-control {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  font-size: 14px;
  width:auto;
}

.wpg-all-bonuses .wpg-bonus-type-filter label {
  margin-right: 8px;
  font-weight: 500;
  color: #495057;
}

.wpg-all-bonuses .wpg-bonus-type-filter select.form-control {
  display: inline-block;
  min-width: 180px;
  padding: 6px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  font-size: 14px;
}

.wpg-all-bonuses .wpg-verified-filter input[type="checkbox"]{
  transform: translateY(1px);
}
.wpg-all-bonuses .wpg-verified-filter span{
  font-weight: 500;
  color: #495057;
}

/* 5-column table layout */
.wpg-all-bonuses .wpg-summary-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wpg-all-bonuses .wpg-summary-table-header th {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  padding: 15px 20px;
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

/* Sortable headers */
.wpg-all-bonuses th.wpg-sort-header .sort-icons{ opacity: 0.5; margin-left: 6px; font-size: 11px; }
.wpg-all-bonuses th.wpg-sort-header.sorted-asc .sort-icons::after{ content: ' ↑'; opacity: 1; }
.wpg-all-bonuses th.wpg-sort-header.sorted-desc .sort-icons::after{ content: ' ↓'; opacity: 1; }

.wpg-all-bonuses .wpg-summary-row td {
  padding: 15px 20px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
  transition: background-color 0.2s ease;
}

.wpg-all-bonuses .wpg-summary-row:hover td {
  background: #f8f9fa;
}

.wpg-all-bonuses .wpg-summary-row:last-child td {
  border-bottom: none;
}




/* Define column widths and alignment for the 5 columns */
.wpg-all-bonuses .wpg-summary-col-casino {
  width: 20%;
  text-align: left;
}
.wpg-all-bonuses .wpg-summary-col-bonus {
  width: 30%;
  text-align: left;
}
.wpg-all-bonuses .wpg-summary-col-code {
  width: 16%;
  text-align: center;
}
.wpg-all-bonuses .wpg-summary-col-voting {
  width: 19%;
  text-align: center;
}
.wpg-all-bonuses .wpg-summary-col-visits {
  width: 15%;
  text-align: center;
}

/* Bonus info and content styling */
.wpg-all-bonuses .wpg-summary-bonus-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start; 
}

.wpg-all-bonuses .wpg-summary-bonus-name {
  font-size: 16px;
  font-weight: 600;
  color: #2c5aa0;
  line-height: 1.3;
}

.wpg-all-bonuses .wpg-summary-casino-name {
  color: #2c5aa0;
  text-decoration: none;
  font-weight: 500;
}

.wpg-all-bonuses .wpg-summary-casino-name:hover {
  color: #1e3f73;
  text-decoration: none;
}

.wpg-all-bonuses .wpg-summary-no-code {
  font-size: 13px;
  color: #6c757d;
  font-style: italic;
}

.wpg-all-bonuses .wpg-summary-claim-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

.wpg-all-bonuses .wpg-summary-claim-count i {
  color: #6c757d;
  font-size: 16px;
}

/* Compact inline voting styles inside table cell */
.wpg-all-bonuses .wpg-summary-col-voting .bonus-voting {
  display: flex;
  flex-direction: column; /* stack message below buttons */
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wpg-all-bonuses .wpg-summary-col-voting .voting-horizontal {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.wpg-all-bonuses .wpg-summary-col-voting .voting-question-display {
  display: none; /* hidden in table context */
}
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn-group {
  display: inline-flex;
  gap: 6px;
}
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn {
  background: #fff;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1;
  color: #495057;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  /* Make buttons a consistent width whether counts are present or not */
  width: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn i {
  margin-right: 4px;
}
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn:hover,
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Match worked/failed colors from bonus-voting.css */
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.worked { color: #28a745; border-color: #28a745; }
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.failed { color: #dc3545; border-color: #dc3545; }

.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.worked:hover,
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.worked.hover {
  background: #28a745;
  color: #ffffff;
}

.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.failed:hover,
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.failed.hover {
  background: #dc3545;
  color: #ffffff;
}

/* Disabled / voting states */
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn:disabled,
.wpg-all-bonuses .wpg-summary-col-voting .vote-btn.voting {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.wpg-all-bonuses .wpg-summary-col-voting .voting-message {
  display: block; /* allow JS to show status text */
  margin-top: 6px; /* space under buttons */
  font-size: 12px;
  font-weight: 500;
  color: #495057;
  text-align: center;
}

.wpg-all-bonuses .wpg-summary-col-voting .voting-percentage{
  width: 4ch; /* reserve space for values like 100% */
  text-align: right;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.wpg-all-bonuses .wpg-summary-col-voting .voting-percentage-wrap{
  display: inline-block;
}
.wpg-all-bonuses .wpg-summary-col-voting .voting-info-icon{
  color: #6c757d;
  opacity: 0.75;
  font-size: 0.8em; /* slightly smaller for superscript */
  cursor: pointer;
}
.wpg-all-bonuses .wpg-summary-col-voting .voting-info-icon:hover{ opacity: 1; color:#495057; }

/* Optional success/error styling to mirror sitewide voting styles */
.wpg-all-bonuses .wpg-summary-col-voting .voting-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
  padding: 6px 8px;
  display: inline-block;
}

.wpg-all-bonuses .wpg-summary-col-voting .voting-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 6px 8px;
  display: inline-block;
}

/* Bonus type pill */
.wpg-all-bonuses .wpg-summary-bonus-type {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  background: #eef3ff;
  color: #1a73e8;
  font-size: 12px;
  vertical-align: middle;
}

/* Bonus code cell */
.wpg-all-bonuses .wpg-summary-bonus-code {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #e3f2fd;
  border: 1px dashed #2196f3;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 600;
  color: #1976d2;
  transition: all 0.2s ease;
}

/* Remove gray tap highlight on mobile for rows and interactive elements */
.wpg-all-bonuses .wpg-summary-row,
.wpg-all-bonuses .wpg-summary-row a,
.wpg-all-bonuses .wpg-summary-row button,
.wpg-all-bonuses .wpg-summary-bonus-code {
  -webkit-tap-highlight-color: transparent;
}

.wpg-all-bonuses .wpg-summary-bonus-code:hover {
  background: #bbdefb;
}

.wpg-all-bonuses .wpg-summary-bonus-code .fa-copy {
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: 6px;
}

/* Lightweight tooltip used for ticket tap on mobile */
.wpg-all-bonuses-tooltip {
  position: absolute;
  z-index: 9999;
  background: rgba(33, 37, 41, 0.95);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  /* On mobile, allow long codes to wrap and be fully visible */
  .wpg-all-bonuses .wpg-summary-bonus-code {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    justify-content: center;
    gap: 8px;
  }
  /* Header responsive adjustments */
  .wpg-all-bonuses .wpg-all-bonuses-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .wpg-all-bonuses .wpg-controls-bar{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .wpg-all-bonuses .wpg-controls-left,
  .wpg-all-bonuses .wpg-controls-right{
    justify-content: center;
    flex-wrap: wrap;
  }

  .wpg-all-bonuses .wpg-summary-row:hover td {
    background:none;
  }

  .wpg-all-bonuses .wpg-summary-col-code {
    width: 100%;
  }

  .wpg-all-bonuses .wpg-summary-col-bonus
  {
    width: 100%;
  }

  .wpg-all-bonuses .wpg-summary-col-casino {
    width: 100%;
}
  
  .wpg-all-bonuses .wpg-all-bonuses-title {
    text-align: center;
    font-size: 18px;
  }
  
  .wpg-all-bonuses .wpg-bonus-type-filter {
    margin-left: 0;
    text-align: center;
  }
  .wpg-all-bonuses .wpg-sort-control { width: 100%; justify-content: center; }
  .wpg-all-bonuses .wpg-verified-filter { width: 100%; justify-content: center; }
  
  .wpg-all-bonuses .wpg-bonus-type-filter select.form-control {
    width: 100%;
    max-width: 300px;
  }
  
  /* Stack table on mobile for better readability */
  .wpg-all-bonuses .wpg-summary-table,
  .wpg-all-bonuses .wpg-summary-table thead,
  .wpg-all-bonuses .wpg-summary-table tbody,
  .wpg-all-bonuses .wpg-summary-table th,
  .wpg-all-bonuses .wpg-summary-table td,
  .wpg-all-bonuses .wpg-summary-table tr {
    display: block;
  }
  
  .wpg-all-bonuses .wpg-summary-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .wpg-all-bonuses .wpg-summary-row {
    border: 1px solid #e9ecef;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .wpg-all-bonuses .wpg-summary-row:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  }
  
  .wpg-all-bonuses .wpg-summary-row td {
    border: none;
    border-bottom: 1px solid #f1f3f4;
    position: relative;
    padding: 12px 15px;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin:0 auto;
  }
  
  .wpg-all-bonuses .wpg-summary-row td:last-child {
    border-bottom: none;
    width:100%;
  }
  
  /* Mobile-specific content adjustments */
  .wpg-all-bonuses .wpg-summary-bonus-info {
    gap: 8px;
    text-align: center;
    align-items: center;
  }
  
  .wpg-all-bonuses .wpg-summary-bonus-name {
    font-size: 30px;
    line-height: 1.2;
    text-align: center;
  }
  
  .wpg-all-bonuses .wpg-summary-bonus-type {
    display: block;
    margin-left: 0;
    margin-top: 4px;
    text-align: center;
  }
  
  .wpg-all-bonuses .wpg-summary-bonus-code {
    padding: 6px 10px;
    font-size: 13px;
    margin: 0 auto;
  }
  
  .wpg-all-bonuses .wpg-summary-claim-count {
    justify-content: center;
    font-size: 13px;
    /* Hide icon on mobile - we'll show full text */
  }

  .wpg-all-bonuses .wpg-summary-claim-count .claim-number {
    display: none;
  }
  .wpg-all-bonuses .wpg-summary-claim-count::after {
    content: attr(data-count) " users have claimed this bonus";
    font-size: 13px;
    color: #495057;
  }

  .wpg-all-bonuses .wpg-summary-col-voting .vote-btn-group {
    gap: 10px;
  }
  .wpg-all-bonuses .wpg-summary-col-voting .vote-btn {
    padding: 8px 10px;
    font-size: 14px;
    width: 120px; /* Slightly wider on mobile for larger tap targets */
  }

  /* Show the question above the buttons on mobile */
  .wpg-all-bonuses .wpg-summary-col-voting .voting-horizontal {
    flex-direction: column;
    gap: 6px;
  }
  .wpg-all-bonuses .wpg-summary-col-voting .voting-question-display {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    text-align: center;
    margin-bottom: 2px;
  }
  /* On mobile, allow percentage to size naturally */
  .wpg-all-bonuses .wpg-summary-col-voting .voting-percentage{
    width: auto;
    text-align: center;
    margin-left: 0;
  }
  .wpg-all-bonuses .wpg-summary-col-voting .voting-percentage-wrap{
    text-align: center; /* center percentage + superscript icon */
  }
  
  .wpg-all-bonuses .wpg-summary-casino-name {
    font-size: 23px;
    font-weight: 600;
    text-align: center;
  }
}
