/**
 * Match Page Visual Redesign v1
 * 
 * Transforma os botões de opção da página Match em botões coloridos 3D
 * com badge de letra, seta chevron, brilho e barra de progresso.
 * 
 * Funciona em conjunto com match-redesign.js que aplica as classes
 * e transformações DOM em runtime.
 * 
 * NÃO altera lógica, state ou API calls — apenas visual.
 */

/* ============================================================
   ANIMAÇÕES
   ============================================================ */

@keyframes mr-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes mr-slideInRight {
  0% { opacity: 0; transform: translateX(30px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes mr-popIn {
  0% { opacity: 0; transform: scale(0.85); }
  60% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes mr-pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.05); }
}

@keyframes mr-bounceArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

/* ============================================================
   BADGE "FERRAMENTA INTELIGENTE"
   ============================================================ */

.mr-smart-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(3, 92, 212, 0.08));
  border: 1px solid rgba(124, 58, 237, 0.2);
  font-size: 0.75rem;
  font-weight: 600;
  color: #7C3AED;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  animation: mr-popIn 0.4s ease-out;
}

.mr-smart-badge svg {
  width: 14px;
  height: 14px;
  fill: #7C3AED;
}

/* ============================================================
   BARRA DE PROGRESSO CONTÍNUA
   ============================================================ */

.mr-progress-bar-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 8px auto;
  animation: mr-popIn 0.3s ease-out;
}

.mr-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
}

.mr-progress-label-pct {
  color: #7C3AED;
  font-weight: 700;
}

.mr-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  position: relative;
}

.mr-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7C3AED, #035cd4);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.mr-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200% 100%;
  animation: mr-shimmer 2s infinite;
}

/* ============================================================
   BOTÕES DE OPÇÃO — ESTILO 3D COLORIDO
   ============================================================ */

.mr-option-btn {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 14px 16px !important;
  border-radius: 16px !important;
  border: none !important;
  cursor: pointer;
  text-align: left !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  overflow: hidden;
  min-height: 72px !important;
  width: 100%;
  /* 3D shadow será definida inline pelo JS com a cor do botão */
}

/* Shine overlay no topo */
.mr-option-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  border-radius: 16px 16px 0 0;
  z-index: 1;
}

/* Hover — sobe levemente */
.mr-option-btn:hover {
  transform: translateY(-2px) !important;
}

/* Active/Tap — afunda (3D press) */
.mr-option-btn:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 0 var(--mr-shadow-color, #333) !important;
}

/* Animação de entrada */
.mr-option-btn.mr-animate-in {
  animation: mr-slideInRight 0.35s ease-out both;
}

.mr-option-btn.mr-animate-in:nth-child(1) { animation-delay: 0.05s; }
.mr-option-btn.mr-animate-in:nth-child(2) { animation-delay: 0.12s; }
.mr-option-btn.mr-animate-in:nth-child(3) { animation-delay: 0.19s; }
.mr-option-btn.mr-animate-in:nth-child(4) { animation-delay: 0.26s; }
.mr-option-btn.mr-animate-in:nth-child(5) { animation-delay: 0.33s; }

/* ============================================================
   BADGE DE LETRA (A, B, C, D)
   ============================================================ */

.mr-letter-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  z-index: 2;
  flex-shrink: 0;
}

/* ============================================================
   EMOJI CONTAINER (dentro do botão)
   ============================================================ */

.mr-emoji-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 1.3rem;
  z-index: 2;
  flex-shrink: 0;
}

/* ============================================================
   TEXTOS DO BOTÃO
   ============================================================ */

.mr-option-btn .mr-text-area {
  flex: 1;
  min-width: 0;
  z-index: 2;
}

.mr-option-btn .mr-option-label {
  font-size: 1rem !important;
  font-weight: 800 !important;
  color: #fff !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}

.mr-option-btn .mr-option-sublabel {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  color: rgba(255, 255, 255, 0.85) !important;
  line-height: 1.3 !important;
  margin-top: 2px !important;
}

/* ============================================================
   SETA CHEVRON (lado direito)
   ============================================================ */

.mr-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.35);
  z-index: 2;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.mr-chevron svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
}

.mr-option-btn:hover .mr-chevron {
  animation: mr-bounceArrow 0.6s ease infinite;
}

/* ============================================================
   BOTÃO SELECIONADO (estado ativo)
   ============================================================ */

.mr-option-btn.mr-selected {
  transform: translateY(3px) !important;
  opacity: 0.9;
}

.mr-option-btn.mr-selected .mr-letter-badge {
  background: rgba(255, 255, 255, 0.95);
  color: #16A34A;
  border-color: rgba(255, 255, 255, 1);
}

.mr-option-btn.mr-selected .mr-chevron {
  background: rgba(255, 255, 255, 0.95);
}

.mr-option-btn.mr-selected .mr-chevron svg {
  stroke: #16A34A;
}

/* ============================================================
   ESCONDER ELEMENTOS ORIGINAIS QUE SERÃO SUBSTITUÍDOS
   ============================================================ */

/* Esconder o emoji/ícone original quando o redesign está ativo */
.mr-option-btn > .mr-original-icon {
  display: none !important;
}

/* Esconder o checkmark original do canto superior direito */
.mr-option-btn .mr-original-check {
  display: none !important;
}

/* ============================================================
   RESPONSIVIDADE — MOBILE
   ============================================================ */

@media (max-width: 640px) {
  .mr-option-btn {
    padding: 12px 14px !important;
    min-height: 64px !important;
    border-radius: 14px !important;
    gap: 10px !important;
  }

  .mr-letter-badge {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .mr-emoji-container {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1.15rem;
    border-radius: 10px;
  }

  .mr-option-btn .mr-option-label {
    font-size: 0.92rem !important;
  }

  .mr-option-btn .mr-option-sublabel {
    font-size: 0.72rem !important;
  }

  .mr-chevron {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }

  .mr-chevron svg {
    width: 14px;
    height: 14px;
  }

  .mr-smart-badge {
    font-size: 0.7rem;
    padding: 5px 12px;
  }
}

/* ============================================================
   COMPATIBILIDADE COM match-autoscroll.js
   Quando o autoscroll compacta para mobile, respeitar os tamanhos
   ============================================================ */

@media (max-width: 640px), (max-height: 750px) {
  .mq-grid .mr-option-btn {
    padding: 8px 10px !important;
    min-height: 0 !important;
    border-radius: 12px !important;
    gap: 6px !important;
  }

  .mq-grid .mr-letter-badge {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.7rem;
    border-radius: 6px;
  }

  .mq-grid .mr-emoji-container {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 1rem;
    border-radius: 8px;
  }

  .mq-grid .mr-option-btn .mr-option-label {
    font-size: 0.78rem !important;
    line-height: 1.2 !important;
  }

  .mq-grid .mr-option-btn .mr-option-sublabel {
    font-size: 0.62rem !important;
    line-height: 1.15 !important;
  }

  .mq-grid .mr-chevron {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }

  .mq-grid .mr-chevron svg {
    width: 12px;
    height: 12px;
  }

  .mr-progress-bar-container {
    max-width: 260px;
    margin-bottom: 4px;
  }

  .mr-progress-label {
    font-size: 0.65rem;
    margin-bottom: 4px;
  }

  .mr-progress-track {
    height: 5px;
  }
}
