/* =============================================================================
 * DigiLab Mobile Views
 * Loaded unconditionally (small file, classes only used on mobile views).
 * Companion to custom.css which handles responsive fallbacks via media queries.
 * ============================================================================= */

/* ---------------------------------------------------------------------------
 * Mobile Card List — shared pattern for all table-replacement cards
 * --------------------------------------------------------------------------- */

.mobile-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

.mobile-list-card {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 40, 80, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 200, 255, 0.1);
  transition: background 0.15s ease;
}

.mobile-list-card:active {
  background: rgba(0, 200, 255, 0.08);
}

[data-bs-theme="dark"] .mobile-list-card {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .mobile-list-card:active {
  background: rgba(255, 255, 255, 0.08);
}

/* Card layout helpers */
.mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.mobile-card-primary {
  font-size: 0.95rem;
  font-weight: 600;
}

.mobile-card-secondary {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

/* Player card detail row — deck badge + record on one line */
.mobile-card-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

.mobile-card-details .deck-badge {
  opacity: 1;
}

.mobile-card-record {
  font-size: 0.8rem;
  opacity: 0.7;
}

.mobile-card-tertiary {
  font-size: 0.75rem;
  opacity: 0.55;
  margin-top: 0.15rem;
}

.mobile-card-separator {
  margin: 0 0.35rem;
  opacity: 0.4;
}

.mobile-card-stat {
  font-size: 0.85rem;
  font-weight: 500;
}

.mobile-card-rank {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}

.mobile-card-rank.rank-1 { color: #FFD700; }
.mobile-card-rank.rank-2 { color: #C0C0C0; }
.mobile-card-rank.rank-3 { color: #CD7F32; }

/* ---------------------------------------------------------------------------
 * Player Card Enhancements — tier colors, left borders, win rate bar
 * --------------------------------------------------------------------------- */

/* Rating badge in monospace */
.mobile-card-rating {
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.7);
}

/* Rating tier badge colors (fixed thresholds) */
.rating-tier-elite {
  background: rgba(255, 215, 0, 0.15) !important;
  color: #B8860B !important;
}

.rating-tier-strong {
  background: rgba(0, 200, 255, 0.12) !important;
  color: #0088AA !important;
}

.rating-tier-good {
  background: rgba(76, 175, 80, 0.12) !important;
  color: #2E7D32 !important;
}

.rating-tier-low {
  background: rgba(0, 0, 0, 0.04) !important;
  color: rgba(0, 0, 0, 0.4) !important;
}

/* Dark mode rating badges */
[data-bs-theme="dark"] .mobile-card-rating {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .rating-tier-elite {
  background: rgba(255, 215, 0, 0.2) !important;
  color: #FFD700 !important;
}

[data-bs-theme="dark"] .rating-tier-strong {
  background: rgba(0, 200, 255, 0.15) !important;
  color: var(--dl-cyan) !important;
}

[data-bs-theme="dark"] .rating-tier-good {
  background: rgba(76, 175, 80, 0.15) !important;
  color: #4CAF50 !important;
}

[data-bs-theme="dark"] .rating-tier-low {
  background: rgba(255, 255, 255, 0.04) !important;
  color: rgba(255, 255, 255, 0.35) !important;
}

/* Top 3 left border accents */
.mobile-list-card.player-rank-1 {
  border-left: 3px solid #FFD700;
}

.mobile-list-card.player-rank-2 {
  border-left: 3px solid #C0C0C0;
}

.mobile-list-card.player-rank-3 {
  border-left: 3px solid #CD7F32;
}

/* ---------------------------------------------------------------------------
 * Horizontal Scroll — rising stars, top decks on dashboard
 * --------------------------------------------------------------------------- */

.mobile-horizontal-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mobile-horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.mobile-horizontal-scroll > * {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 280px;
}

/* Compact variant — smaller cards for deck/player scroll */
.mobile-scroll-compact {
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.5rem;
}

.mobile-scroll-compact > * {
  width: 150px;
}

/* ---------------------------------------------------------------------------
 * Shared Rank Badge — matches desktop rising-star-rank (blue circle)
 * --------------------------------------------------------------------------- */

.mobile-rank-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--dl-blue) 0%, var(--dl-cyan) 100%);
  color: #fff;
  z-index: 2;
  line-height: 1;
}

/* ---------------------------------------------------------------------------
 * Top Decks Cards — compact cards with color accent border
 * --------------------------------------------------------------------------- */

.mobile-deck-card {
  position: relative;
  padding: 0.5rem;
  padding-top: 0.4rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 200, 255, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  /* border-left set inline from deck color */
}

.mobile-deck-card:active {
  transform: scale(0.97);
}

[data-bs-theme="dark"] .mobile-deck-card {
  background: linear-gradient(135deg, var(--dl-slate) 0%, var(--dl-dark) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
}

.mobile-deck-card-img {
  height: 130px;
  border-radius: 4px;
  margin-bottom: 0.35rem;
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mobile-deck-card-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dl-dark);
}

[data-bs-theme="dark"] .mobile-deck-card-name {
  color: #F7FAFC;
}

/* Win rate bar (matches desktop deck-bar) */
.mobile-deck-card-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.2rem;
}

.mobile-deck-card-bar-fill {
  height: 100%;
  border-radius: 3px;
}

[data-bs-theme="dark"] .mobile-deck-card-bar {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-deck-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #6B7280;
}

[data-bs-theme="dark"] .mobile-deck-card-stats {
  color: #A0AEC0;
}

.mobile-deck-card-wins {
  font-weight: 600;
  color: var(--dl-blue);
}

[data-bs-theme="dark"] .mobile-deck-card-wins {
  color: var(--dl-orange-light);
}

.mobile-deck-card-wins .bi {
  font-size: 0.55rem;
}

/* ---------------------------------------------------------------------------
 * Rising Stars Cards — compact player cards with badges
 * --------------------------------------------------------------------------- */

.mobile-star-card {
  position: relative;
  padding: 0.5rem;
  padding-top: 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 200, 255, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-star-card:active {
  transform: scale(0.97);
}

[data-bs-theme="dark"] .mobile-star-card {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.06);
}

.mobile-star-card-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0.15rem;
  margin-bottom: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-star-card-badges {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

/* Badges match desktop rising-star-badge styling */
.mobile-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.mobile-star-badge .bi {
  font-size: 0.55rem;
}

.mobile-star-badge-gold {
  background: linear-gradient(135deg, #F5B700 0%, #FFD700 100%);
  color: #1a1a1a;
}

.mobile-star-badge-silver {
  background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
  color: #1a1a1a;
}

.mobile-star-card-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Rating matches desktop rising-star-rating styling */
.mobile-star-card-rating-value {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Fira Code', monospace;
  color: var(--dl-blue);
}

[data-bs-theme="dark"] .mobile-star-card-rating-value {
  color: var(--dl-cyan);
}

.mobile-star-card-rating-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

/* ---------------------------------------------------------------------------
 * Section Separators — visual dividers between dashboard sections
 * --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
 * Recent Tournaments Cards — structured layout with date badge
 * --------------------------------------------------------------------------- */

.mobile-tournament-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-tournament-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 200, 255, 0.1);
  transition: transform 0.15s ease;
}

.mobile-tournament-card:active {
  transform: scale(0.98);
}

[data-bs-theme="dark"] .mobile-tournament-card {
  background: linear-gradient(135deg, var(--dl-slate) 0%, var(--dl-dark) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Date badge — compact calendar chip */
.mobile-tournament-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  background: #f1f5f9;
  flex-shrink: 0;
}

[data-bs-theme="dark"] .mobile-tournament-date {
  background: #334155;
}

.mobile-tournament-date-day {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: var(--dl-dark);
}

[data-bs-theme="dark"] .mobile-tournament-date-day {
  color: #F7FAFC;
}

.mobile-tournament-date-month {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1;
  margin-top: 2px;
  color: #64748b;
  text-transform: uppercase;
}

/* Country flag — small inline flag next to store name */
.mobile-tournament-flag {
  font-size: 0.7rem;
  margin-right: 0.3rem;
  vertical-align: baseline;
}

.mobile-tournament-flag .bi {
  font-size: 0.65rem;
  opacity: 0.6;
}

/* Middle: store name + winner */
.mobile-tournament-info {
  flex: 1;
  min-width: 0;
}

.mobile-tournament-store {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dl-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-bs-theme="dark"] .mobile-tournament-store {
  color: #F7FAFC;
}

.mobile-tournament-winner {
  font-size: 0.7rem;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.mobile-tournament-winner .bi {
  font-size: 0.55rem;
  color: #F5B700;
}

[data-bs-theme="dark"] .mobile-tournament-winner {
  color: #A0AEC0;
}

/* Right: player count */
.mobile-tournament-players {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.mobile-tournament-players-count {
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Fira Code', monospace;
  color: var(--dl-blue);
}

[data-bs-theme="dark"] .mobile-tournament-players-count {
  color: var(--dl-cyan);
}

.mobile-tournament-players-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
}

/* Section headers — used on non-accordion mobile pages */
.mobile-section-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.55;
  padding: 0.75rem 0 0.25rem;
}

/* ---------------------------------------------------------------------------
 * Compact Table — reactable on mobile (e.g., recent tournaments)
 * --------------------------------------------------------------------------- */

.mobile-table-compact {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------------------
 * Compact Map — stores page
 * --------------------------------------------------------------------------- */

.mobile-map-compact {
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.mobile-map-compact .mapboxgl-map,
.mobile-map-compact .maplibregl-map {
  height: 200px !important;
}

/* ---------------------------------------------------------------------------
 * Load More Button
 * --------------------------------------------------------------------------- */

.mobile-load-more {
  width: 100%;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid rgba(0, 200, 255, 0.25);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.06) 0%, rgba(15, 76, 129, 0.08) 100%);
  color: inherit;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.2s ease;
}

.mobile-load-more:hover,
.mobile-load-more:active {
  border-color: rgba(0, 200, 255, 0.5);
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.12) 0%, rgba(15, 76, 129, 0.15) 100%);
  transform: translateY(-1px);
}

.mobile-load-more-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--dl-blue);
}

.mobile-load-more-count {
  font-size: 0.65rem;
  opacity: 0.5;
  letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .mobile-load-more-label {
  color: var(--dl-cyan);
}

[data-bs-theme="dark"] .mobile-load-more {
  border-color: rgba(0, 200, 255, 0.2);
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.06) 0%, rgba(0, 200, 255, 0.03) 100%);
}

[data-bs-theme="dark"] .mobile-load-more:hover,
[data-bs-theme="dark"] .mobile-load-more:active {
  border-color: rgba(0, 200, 255, 0.45);
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.12) 0%, rgba(0, 200, 255, 0.06) 100%);
}

/* ---------------------------------------------------------------------------
 * Meta Card Enhancements — deck color borders, meta % badge
 * --------------------------------------------------------------------------- */

/* Deck color left border (applied via inline style on card) */
.mobile-list-card.meta-deck-card {
  border-left-width: 3px;
  border-left-style: solid;
}

/* Meta % pill badge */
.mobile-card-meta-badge {
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* Meta stat row (no opacity, full color for stats) */
.mobile-card-meta-stats {
  font-size: 0.8rem;
  color: rgba(0, 0, 0, 0.55);
}

[data-bs-theme="dark"] .mobile-card-meta-stats {
  color: rgba(255, 255, 255, 0.5);
}

/* ---------------------------------------------------------------------------
 * Tournament Card Enhancements — format badge, winner trophy
 * --------------------------------------------------------------------------- */

/* Format pill badge (neutral tint) */
.mobile-card-format-badge {
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(15, 76, 129, 0.1);
  color: var(--dl-blue);
  white-space: nowrap;
}

[data-bs-theme="dark"] .mobile-card-format-badge {
  background: rgba(0, 200, 255, 0.12);
  color: var(--dl-cyan);
}

/* Trophy icon next to winner name */
.mobile-tournament-trophy {
  font-size: 0.65rem;
  color: #FFD700;
  margin-right: 0.25rem;
}

/* ---------------------------------------------------------------------------
 * Value Boxes Grid — forced 2x2 on mobile (bypasses bslib breakpoints)
 * --------------------------------------------------------------------------- */

.mobile-value-boxes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mobile-value-boxes-grid .value-box-digital {
  min-height: 80px;
  height: 100%;
}

.mobile-value-boxes-grid .vb-value {
  font-size: 1.15rem;
}

.mobile-value-boxes-grid .vb-image-showcase {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.25;
  z-index: 1;
  pointer-events: none;
}

.mobile-value-boxes-grid .vb-image-showcase img {
  max-height: 65px;
  border-radius: 4px;
  box-shadow: none;
}

.mobile-value-boxes-grid .vb-content-with-image .vb-content {
  z-index: 3;
}

/* ---------------------------------------------------------------------------
 * Mobile Charts — reduced height for dashboard
 * --------------------------------------------------------------------------- */

.mobile-chart-container {
  height: 250px;
  width: 100%;
}

.mobile-chart-container .highcharts-container,
.mobile-chart-container .html-widget {
  height: 250px !important;
}

/* ---------------------------------------------------------------------------
 * Dashboard Accordion — unified collapsible sections
 * --------------------------------------------------------------------------- */

.mobile-dashboard-accordion {
  --bs-accordion-border-color: rgba(0, 200, 255, 0.1);
  --bs-accordion-btn-padding-x: 0.75rem;
  --bs-accordion-btn-padding-y: 0.6rem;
  --bs-accordion-body-padding-x: 0.5rem;
  --bs-accordion-body-padding-y: 0.5rem;
  margin-bottom: 1rem;
}

.mobile-dashboard-accordion .accordion-button {
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.5rem;
}

.mobile-dashboard-accordion .accordion-button .bi {
  font-size: 0.9rem;
  opacity: 0.6;
}

.mobile-dashboard-accordion .accordion-button:not(.collapsed) .bi {
  opacity: 1;
}

[data-bs-theme="dark"] .mobile-dashboard-accordion {
  --bs-accordion-border-color: rgba(255, 255, 255, 0.08);
  --bs-accordion-bg: rgba(255, 255, 255, 0.02);
  --bs-accordion-btn-bg: rgba(255, 255, 255, 0.02);
  --bs-accordion-active-bg: rgba(0, 200, 255, 0.05);
  --bs-accordion-active-color: inherit;
}
