/* Layout Base - Igual à Lotomania mas com prefixo mv- */
.mv-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  transition: max-width 0.4s ease-in-out;
  padding: 20px 16px 60px; /* added bottom padding for footer spacing */
}

/* Cabeçalho */
.mv-header {
  text-align: center;
  margin-bottom: 8px;
  grid-column: 1 / -1;
}

.mv-header h1 {
  color: #2c3e50;
  margin: 0 0 10px;
  font-size: 28px;
}

.mv-header p {
  color: #7f8c8d;
  font-size: 16px;
  margin: 0;
}

/* Coluna Esquerda: Seletor */
.mv-selector {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.mv-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.mv-selector-header h2 {
  color: #2c3e50;
  margin: 0;
  font-size: 18px;
}

.mv-counter {
  background: #283178;
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

/* Grid de números: 10 colunas */
.mv-numbers-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 20px;
}

.mv-num-btn {
  aspect-ratio: 1;
  border: 2px solid #bdc3c7;
  background: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, transform .1s;
  padding: 0;
  width: 100%;
  max-width: 54px;
  height: auto;
  max-height: none;
  margin: 0 auto;
  touch-action: manipulation;
}

@media (hover: hover) {
  .mv-num-btn:hover {
    border-color: #283178;
    background: #e8eaf6;
    transform: scale(1.08);
  }
}

.mv-num-btn.selected {
  background: #283178;
  border-color: #283178;
  color: #fff;
  transform: scale(1.05);
}

/* Seção de Trevos */
.mv-trevos-selector {
  text-align: center;
  margin-bottom: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.mv-trevos-selector h3 {
  color: #2c3e50;
  margin: 0 0 5px;
  font-size: 16px;
}

.mv-helper-text {
  color: #7f8c8d;
  font-size: 13px;
  margin-bottom: 12px;
}

.mv-trevos-grid {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.mv-trevo-btn {
  width: 44px;
  height: 44px;
  border: 2px solid #bdc3c7;
  background: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, transform .1s;
  padding: 0;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}

.mv-trevo-btn:hover {
  border-color: #283178;
  background: #e8eaf6;
  transform: scale(1.08);
}

.mv-trevo-btn.selected {
  background: #283178;
  border-color: #283178;
  color: #fff;
  transform: scale(1.05);
}

/* Ações */
.mv-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.mv-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  width: auto;
  height: auto;
  max-height: none;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
}

.mv-btn-primary {
  background: #2e7d32;
  color: #fff;
}

.mv-btn-primary:hover:not(:disabled) {
  background: #1b5e20;
}

.mv-btn-primary:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.mv-btn-secondary {
  background: #c62828;
  color: #fff;
}

.mv-btn-secondary:hover {
  background: #b71c1c;
}

.mv-btn-blue {
  background: #1976d2;
  color: #fff;
}

.mv-btn-blue:hover {
  background: #1565c0;
}

.mv-btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 5px;
}

/* Resultados */
.mv-results {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.mv-placeholder {
  text-align: center;
  color: #7f8c8d;
  padding: 32px 16px;
  border: 1px dashed #ddd;
  border-radius: 10px;
}

/* Cabeçalho dos resultados */
.mv-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mv-expand-btn {
  flex-shrink: 0;
  align-self: flex-start;
}

.mv-numbers-display,
.mv-trevos-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 8px;
}

.mv-numbers-display span:first-child,
.mv-trevos-display span:first-child {
  font-weight: bold;
  color: #2c3e50;
  margin-right: 4px;
}

.mv-number-chip,
.mv-trevo-chip {
  background: #283178;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
}

/* Cards de resumo */
.mv-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.mv-summary-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  border-left: 4px solid #283178;
}

.mv-summary-card h3 {
  color: #2c3e50;
  margin: 0 0 12px;
  font-size: 15px;
  text-align: center;
}

.mv-stats { display: flex; flex-direction: column; gap: 8px; }

.mv-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #ecf0f1;
  font-size: 14px;
}

.mv-stat:last-child { border-bottom: none; }
.mv-stat-label { font-weight: 600; color: #34495e; }
.mv-stat-value { color: #27ae60; font-weight: 700; }

/* Distribuição de acertos */
.mv-hits-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
}

.mv-hit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.mv-hit-badge {
  background: #283178;
  color: #fff;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* Filtros */
.mv-filters-section { margin-top: 24px; }

.mv-filters-section h3 {
  color: #2c3e50;
  margin: 0 0 16px;
  font-size: 16px;
  text-align: center;
}

.mv-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.mv-filter-controls label {
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
}

.mv-filter-controls select,
.mv-filter-controls input {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  width: auto;
  height: auto;
  margin: 0;
  min-height: 44px;
  touch-action: manipulation;
}

/* Lista de concursos */
.mv-contests-list {
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.mv-contests-list::-webkit-scrollbar { width: 6px; }
.mv-contests-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 6px; }

.mv-contest-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid #283178;
}

.mv-contest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.mv-contest-info { display: flex; flex-direction: column; gap: 2px; }
.mv-contest-num { font-weight: 700; color: #2c3e50; }
.mv-contest-date { color: #7f8c8d; font-size: 12px; }

.mv-hits-label {
  padding: 5px 12px;
  border-radius: 14px;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.mv-hits-label.high   { background: #2e7d32; }
.mv-hits-label.medium { background: #ef6c00; }
.mv-hits-label.low    { background: #c62828; }

.mv-drawn-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.mv-ball {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
}

.mv-ball.hit    { background: #2e7d32; }
.mv-ball.missed { background: #c62828; }

.mv-contest-details { display: flex; flex-direction: column; gap: 6px; }

.mv-detail {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.mv-detail-label { font-weight: 600; color: #2c3e50; white-space: nowrap; }
.mv-detail-value { color: #34495e; text-align: right; }

/* Loading */
.mv-loading {
  display: none;
  text-align: center;
  padding: 40px;
  grid-column: 1 / -1;
}

.mv-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #283178;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: mv-spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes mv-spin {
  to { transform: rotate(360deg); }
}

/* Título de resultados sr-only */
.mv-results-title-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.mv-layout--active .mv-results-title-sr {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0 0 12px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  color: #2c3e50;
  font-size: 22px;
}

.mv-results:not(.mv-results--active) .mv-results-header { display: none; }

/* Modo ativo: lado a lado */
.mv-layout--active {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  max-width: 1400px;
}

/* Estado inicial: oculta seção de resultados antes de validar */
.mv-layout:not(.mv-layout--active) .mv-results {
  display: none;
}

/* Modo expandido */
.mv-layout--active.full-view {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  max-width: 1400px;
}

/* Responsivo */
@media (max-width: 1100px) {
  .mv-layout--active,
  .mv-layout--active.full-view {
    grid-template-columns: 1fr;
    max-width: 700px;
  }
  #mv-toggle-view { display: none; }
}

@media (max-width: 600px) {
  .mv-selector {
    padding: 16px;
  }

  .mv-numbers-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .mv-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 400px) {
  .mv-selector {
    padding: 16px 12px;
  }

  .mv-numbers-grid {
    gap: 6px;
  }

  .mv-layout { padding: 12px 12px 0; }
}