/**
 * 5 Lions Megaways - History Page Styles
 * Based on MahjongWins3 design
 */

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #eee;
  overflow-x: hidden;
}

/* History Container */
.history-container {
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background: #16171b;
}

.header {
  width: 100%;
  text-align: center;
  padding: 12px 24px 0 12px;
}

.header h1 {
  font-size: 13px;
  color: #6d7179;
}

.header-info {
  display: none;
  gap: 3vmin;
  justify-content: center;
  margin: 1vmin 0 2vmin;
  font-size: clamp(0.9rem, 2.5vmin, 1.1rem);
  color: #8a8a9a;
}

/* Table Header */
.history-table-header {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1.2fr 0.8fr 1fr auto;
  gap: 1vmin;
  padding: 12px 20px;
  background: #20272b;
  border-bottom: 1px solid #16171b;
  margin-top: 2vmin;
}

.th-cell {
  font-size: 13px;
  color: #6d7179;
  font-weight: bold;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  background: #20272b;
}

.loading-message,
.empty-message {
  text-align: center;
  padding: 4vmin;
  color: #8a8a9a;
  font-size: 13px;
}

/* History Item (Row) */
.history-item {
  border-bottom: 1px solid #16171b;
}

.history-item:last-child {
  border-bottom: none;
}

/* History Row (Table Row) */
.history-row {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1.2fr 0.8fr 1fr auto;
  gap: 1vmin;
  padding: 16px 20px;
  cursor: pointer;
  align-items: center;
  background: #20272b;
  transition: opacity 0.2s ease;
  opacity: 1;
}

.history-row:hover {
  background-color: #252d31;
  cursor: pointer;
  outline: none;
}

.history-row:focus {
  background-color: #252d31;
  cursor: pointer;
  outline: none;
}

.history-row .cell {
  font-size: 13px;
  color: #ffffff;
}

.history-row .cell.session-id {
  color: #8a8a9a;
}

.history-row .cell.win {
  color: #ffffff;
  font-weight: bold;
  text-align: right;
}

.history-row .cell.loss {
  color: #8a8a9a;
  text-align: right;
}

/* History Detail (Expandable) */
.history-detail {
  display: none;
  background: #16171b;
  padding-top: 6px;
}

.history-item.expanded .history-detail {
  display: block;
}

.detail-section:last-child {
  border-bottom: none;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  background: #20272b;
  transition: opacity 0.2s ease;
  opacity: 1;
}

.section-header:hover {
  opacity: 0.7;
}

.section-header:focus {
  outline: none;
  opacity: 0.7;
}

.section-title {
  font-size: 13px;
  font-weight: 400;
  color: #ffffff;
}

.section-win-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.section-win {
  font-size: 13px;
  font-weight: 600;
}

.section-win.has-win {
  color: #ffffff;
}

.section-win.no-win {
  color: #8a8a9a;
}

.section-win-label {
  font-size: 13px;
  color: #8a8a9a;
}

.detail-section {
  padding: 0 6px 6px 6px;
}

/* Static Section Header (always open, no dropdown) */
.section-header-static {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 0 20px;
  background: #252d31;
}

/* Static Section Content (always visible) */
.section-content-static {
  display: block;
  padding: 20px;
  background: #252d31;
}

/* Section Content */
.section-content {
  display: none;
  padding: 6px 0;
  background: #16171b;
}

.detail-section.expanded .section-content {
  display: block;
}

/* Grid Display Container */
.grid-display-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

/* Slot Frame */
.slot-frame {
  position: relative;
  background: url('/assets/spins/bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  width: 394px;
  height: 230px;
}

/* Free Spin Slot Frame - different background */
.slot-frame.free-spin-bg {
  background: linear-gradient(135deg, #2a1f3e 0%, #1d0d2e 100%);
  border-color: #ff6b00;
}

/* Wrapper for slot frame with carousel controls below */
.slot-frame-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Symbol Grid - 6 reels with dynamic symbol sizing */
.symbol-grid {
  display: flex;
  flex-direction: row;
  justify-content: start;
  align-items: stretch;
  height: 212px;
  padding: 42px 0 0 26px;
  gap: 2px;
}

.reel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 54.75px;
  height: 100%;
}

.symbol-cell {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  font-weight: bold;
}

/* Symbol image styles */
.symbol-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.symbol-fallback {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

@keyframes pulse {
  from {
    box-shadow: 0 0 5px #ffd700;
  }

  to {
    box-shadow: 0 0 15px #ffd700;
  }
}

.modal-body .symbol-cell {
  opacity: 0.3;
}

.modal-body .symbol-cell.winning {
  opacity: 1;
}

/* Coin */

/* Multiplier display */
.multiplier-display {
  text-align: center;
  padding: 8px;
  background: #252d31;
  border-radius: 4px;
  margin-bottom: 8px;
}

.multiplier-value {
  font-size: 16px;
  font-weight: bold;
  color: #ffd700;
}

.multiplier-label {
  font-size: 11px;
  color: #8a8a9a;
}

.ways-value {
  font-size: 14px;
  font-weight: bold;
  color: #ffd700;
}

.ways-label {
  font-size: 10px;
  color: #8a8a9a;
}

/* Spin Section Carousel */
.spin-carousel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.carousel-slides {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.carousel-slide {
  display: none;
}

.carousel-slide.active {
  display: block;
}

/* Carousel Controls */
.carousel-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.carousel-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a3a4a;
  cursor: pointer;
  transition: opacity 0.2s ease;
  opacity: 1;
}

.carousel-dot:hover {
  opacity: 0.7;
}

.carousel-dot.active {
  background: #ffffff;
}

.carousel-arrow {
  color: #8a8a9a;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s ease;
}

.carousel-arrow:hover {
  color: #ffffff;
}

/* Win Positions Link */
.win-positions-link {
  font-size: 12px;
  color: #8a8a9a;
  text-align: center;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 0 4px;
  transition: color 0.2s ease;
}

.win-positions-link:hover {
  color: #ffffff;
}

/* Win Positions Modal */
.win-positions-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.win-positions-modal.active {
  display: flex;
}

.modal-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #20272b;
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  padding: 20px;
  border: none;
  border-radius: 8px;
}

.modal-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  margin-bottom: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 24px;
  color: #8a8a9a;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
  z-index: 1;
}

.modal-close:hover {
  color: #ffffff;
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
}

/* Modal Win Info */
.modal-win-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modal-win-amount {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.modal-win-multiplier {
  font-size: 13px;
  color: #8a8a9a;
}

/* Modal Grid */
.modal-grid {
  display: flex;
  justify-content: center;
}

/* Tumbles List */
.tumbles-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tumble Item Separate */
.tumble-item-separate {
  background: #1a1f23;
  border-radius: 8px;
  padding: 12px;
  border: none;
  margin-bottom: 8px;
}

.tumble-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #252d31;
  margin-bottom: 12px;
  border-radius: 6px;
}

.tumble-item-title {
  font-size: 13px;
  color: #ffffff;
}

.tumble-item-win {
  font-size: 13px;
  font-weight: 600;
}

.tumble-item-win.has-win {
  color: #ffffff;
}

.tumble-item-win.no-win {
  color: #6d7179;
}

/* Free Spin Badge */
.free-spin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
  color: #1a1a2e;
  padding: 2px 4px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: bold;
}

/* Badge under Amount Won - display block for new line */
.history-row .cell .free-spin-badge {
  margin-top: 4px;
  text-align: center;
}

/* Free Spin Row highlight */
.history-row.free-spin-row {
  background: linear-gradient(90deg, rgba(255, 107, 0, 0.1) 0%, transparent 30%);
}

.history-row.free-spin-row:hover {
  background: linear-gradient(90deg, rgba(255, 107, 0, 0.15) 0%, #252d31 30%);
}

/* Free Spins Container - holds all free spin rounds */
.free-spins-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.free-spin-amount {
  padding-right: 6px;
}

.free-spin-count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Free Spins List */
.free-spins-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual Free Spin Round */
.free-spin-round {
  background: #1a1f23;
  border-radius: 8px;
  padding: 12px;
  border: none;
  cursor: pointer;
}

.free-spin-round:last-child {
  border-bottom: none;
}

.free-spin-round:hover {
  background: #1a1f23;
}

.free-spin-round.expanded {
  background: #1a1f23;
}

/* Free Spin Header */
.free-spin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  background: #252d31;
  margin: 0 6px 8px 6px;
}

/* Free Spin Number */
.free-spin-number {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

/* Free Spin Win */
.free-spin-win {
  font-size: 13px;
  font-weight: 600;
  color: #6d7179;
}

.free-spin-win.has-win {
  color: #ffffff;
}

.free-spin-win.no-win {
  color: #6d7179;
}

/* Free Spin Content */
.free-spin-content {
  padding: 12px 6px;
}

/* Tumbles container inside free spin */
.tumbles-container {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2a3035;
}

.tumbles-title {
  font-size: 12px;
  color: #8a8a9a;
  margin-bottom: 12px;
  padding-left: 6px;
}

/* Super/Max Free Spins Badge */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 6px;
}

.mode-badge.super {
  background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
  color: #000;
}

.mode-badge.max {
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  color: #fff;
}

/* No wins message */
.no-wins-message {
  text-align: center;
  padding: 20px;
  color: #6a6a7a;
  font-style: italic;
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 1024px) {

  .section-content-static,
  .section-content {
    padding: 15px;
  }
}

@media (max-width: 768px) {
  .header {
    margin-bottom: 16px;
  }

  .history-table-header {
    display: none;
  }

  .history-row {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px 15px;
  }

  .history-row .cell {
    font-size: 12px;
  }

  .history-row .cell:nth-child(1) {
    grid-column: span 2;
    font-size: 11px;
  }

  .history-row .cell:nth-child(2) {
    grid-column: span 2;
    font-size: 11px;
    color: #6a6a7a;
  }

  .history-row .cell:nth-child(3),
  .history-row .cell:nth-child(5) {
    text-align: end;
  }

  .history-row .cell:nth-child(4) {
    grid-column: span 2;
  }

  .section-header,
  .section-header-static {
    padding: 10px 15px;
  }

  .section-title {
    font-size: 13px;
  }

  .section-win {
    font-size: 13px;
  }

  .section-content-static,
  .section-content {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .history-row {
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 8px 12px;
  }

  .history-row .cell {
    font-size: 11px;
  }

  .history-row .cell:nth-child(1) {
    grid-column: 1;
    font-size: 10px;
  }

  .history-row .cell:nth-child(2) {
    display: none;
  }

  .history-row .cell:nth-child(3),
  .history-row .cell:nth-child(4) {
    font-size: 10px;
    grid-column: span 1;
  }

  .history-row .cell:nth-child(5) {
    font-size: 12px;
    font-weight: bold;
  }

  .section-header,
  .section-header-static {
    padding: 8px 12px;
  }

  .section-title {
    font-size: 12px;
  }

  .section-win {
    font-size: 12px;
  }

  .section-win-label {
    font-size: 10px;
  }

  .section-content-static,
  .section-content {
    padding: 10px;
  }

  .grid-display-container {
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    scale: 0.85;
  }

  .modal-content {
    width: 100%;
  }

  .modal-body {
    transform: scale(0.9);
  }
}

@media (max-width: 360px) {
  .history-row {
    padding: 6px 10px;
  }

  .history-row .cell {
    font-size: 10px;
  }

  .section-header,
  .section-header-static {
    padding: 6px 10px;
  }

  .section-title {
    font-size: 11px;
  }
}