/**
 * Deck Action Panel — Painel de ação abaixo do monte de cartas
 * Inclui também o wrapper .deck-center-stack que centra o conjunto
 * (monte + painel) na mesa.
 * Mobile-first · responsivo vertical e horizontal
 */

/* ============================================
   WRAPPER CENTRAL — monte + painel
   ============================================ */

/**
 * .deck-center-stack
 * Centra o conjunto (monte de cartas + painel de ação) na mesa.
 * position:absolute + translate(-50%,-50%) garante centralização
 * independente do tamanho do pai.
 *
 * A mesa hexagonal aplica rotate(var(--hexRotate)) no portrait (90deg).
 * Contra-rotamos o stack em portrait para que o conteúdo apareça
 * VERTICAL na tela — pilha em cima, botão embaixo.
 */
.deck-center-stack {
  position: absolute;
  left:  50%;
  top:   50%;

  /*
   * Portrait → --hexRotate = 90deg → rotate(-90deg) cancela a rotação do pai.
   * Landscape → --hexRotate = 0deg  → rotate(0deg)  = sem efeito.
   */
  transform: translate(-50%, -50%) rotate(calc(-1 * var(--hexRotate, 0deg)));

  display:         flex;
  flex-direction:  column;   /* coluna: pile em cima, botão embaixo */
  align-items:     center;
  gap:             0;        /* espaço gerido pelo margin-top do painel */

  /* z-index acima do fundo, abaixo dos badges */
  z-index: 50;

  /* pointer-events herdado pelos filhos conforme necessidade */
  pointer-events: none;
}

/* ── Landscape: pile à esquerda, botão à direita ──────────────────── */
@media (orientation: landscape) {
  .deck-center-stack {
    flex-direction: row;
    align-items:    center;
    gap:            20px;
  }

  .deck-action-panel {
    margin-top: 0 !important;
  }
}

/* ============================================
   PAINEL DE AÇÃO
   ============================================ */

.deck-action-panel {
  margin-top: 2rem;
  display:        flex;
  flex-direction: column;
  align-items:    center;
  /* permite receber cliques (override do none do pai) */
  pointer-events: auto;
}

/* ============================================
   BOTÃO — EMBARALHAR AS CARTAS
   ============================================ */

.deck-action-panel__btn {
  padding:       0.55rem 1.2rem;
  font-size:     clamp(0.7rem, 2.2vw, 0.85rem);
  font-weight:   700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color:         #fff;

  background:    linear-gradient(135deg, #e8a020 0%, #c47010 100%);
  border:        none;
  border-radius: 999px;
  cursor:        pointer;

  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.25);

  transition:
    transform      0.15s ease,
    box-shadow     0.15s ease,
    background     0.15s ease;

  /* evita que o texto quebre */
  white-space: nowrap;
}

.deck-action-panel__btn:hover {
  background: linear-gradient(135deg, #f0b030 0%, #d08020 100%);
  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.5),
    0 2px 4px  rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.deck-action-panel__btn:active {
  transform:  translateY(1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* ============================================
   MENSAGEM DE AGUARDO
   ============================================ */

.deck-action-panel__waiting {
  font-size:   clamp(0.6rem, 1.8vw, 0.75rem);
  font-weight: 500;
  color:       rgba(255, 255, 255, 0.75);
  text-align:  center;
  max-width:   160px;
  line-height: 1.35;
  margin:      0;

  /* sutil brilho para legibilidade sobre o feltro */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ============================================
   RESPONSIVIDADE — PORTRAIT (celular vertical)
   ============================================ */

@media (orientation: portrait) and (max-width: 480px) {
  .deck-action-panel {
    margin-top: 1.5rem;
  }

  .deck-action-panel__btn {
    font-size: clamp(0.65rem, 3vw, 0.78rem);
    padding:   0.5rem 1rem;
  }

  .deck-action-panel__waiting {
    font-size: clamp(0.55rem, 2.2vw, 0.68rem);
    max-width: 130px;
  }
}

/* ============================================
   RESPONSIVIDADE — LANDSCAPE (celular horizontal)
   ============================================ */

@media (orientation: landscape) and (max-height: 480px) {
  .deck-action-panel__btn {
    font-size: clamp(0.6rem, 1.8vw, 0.72rem);
    padding:   0.4rem 0.9rem;
  }

  .deck-action-panel__waiting {
    font-size: clamp(0.5rem, 1.5vw, 0.62rem);
    max-width: 110px;
  }
}

/* ============================================
   BOTÃO — ESTADO DISABLED (embaralhando)
   ============================================ */

.deck-action-panel__btn:disabled {
  opacity: 0.55;
  cursor:  not-allowed;
  background: linear-gradient(135deg, #9a7020 0%, #7a5812 100%);
  transform:  none;
}

.deck-action-panel__btn:disabled:hover {
  background: linear-gradient(135deg, #9a7020 0%, #7a5812 100%);
  transform:  none;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ============================================
   BOTÃO — VERSÃO BLOQUEADA (não-dealer)
   Aparência cinza + cursor proibido
   ============================================ */

.deck-action-panel__btn--locked {
  background: linear-gradient(135deg, #555 0%, #3a3a3a 100%);
  cursor:     not-allowed;
  opacity:    0.65;
}

.deck-action-panel__btn--locked:hover {
  background: linear-gradient(135deg, #555 0%, #3a3a3a 100%);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.25);
  transform: none;
}

.deck-action-panel__btn--locked:active {
  transform:  none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

/* ============================================
   BOTÃO — ANIMAÇÃO SHAKE (clique não autorizado)
   ============================================ */

@keyframes btnShake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-7px) rotate(-1.2deg); }
  30%  { transform: translateX(7px)  rotate(1.2deg); }
  45%  { transform: translateX(-5px) rotate(-0.8deg); }
  60%  { transform: translateX(5px)  rotate(0.8deg); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.deck-action-panel__btn--shake {
  animation: btnShake 0.44s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ============================================
   TOAST — AVISO DE AÇÃO BLOQUEADA
   Aparece acima do botão, sem alterar o layout
   ============================================ */

/**
 * .deck-action-panel__toast
 *
 * Ocupa espaço reservado mesmo quando invisível (min-height)
 * para evitar layout shift ao aparecer.
 *
 * O flex-column pai exibe o toast antes do botão graças à
 * ordem padrão (inserido primeiro no DOM via create()).
 */
.deck-action-panel__toast {
  /* Reserva altura mesmo invisível — evita layout shift */
  min-height:   clamp(20px, 3vh, 24px);

  padding:      0.25rem 0.65rem;
  border-radius: 999px;

  font-size:    clamp(0.55rem, 1.6vw, 0.68rem);
  font-weight:  600;
  color:        #fff;
  text-align:   center;
  white-space:  nowrap;
  max-width:    100%;
  overflow:     hidden;
  text-overflow: ellipsis;
  text-shadow:  0 1px 2px rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;

  /* Vermelho de alerta */
  background: rgba(210, 40, 40, 0.88);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);

  /* Invisível por padrão — sem ocupar espaço visual */
  opacity:    0;
  transform:  translateY(4px) scale(0.95);
  pointer-events: none;

  transition:
    opacity   0.2s ease,
    transform 0.2s ease;
}

.deck-action-panel__toast--visible {
  opacity:   1;
  transform: translateY(0) scale(1);
}

/* ============================================
   ACESSIBILIDADE — prefers-reduced-motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .deck-action-panel__btn--shake {
    animation: none;
  }

  .deck-action-panel__toast {
    transition: none;
  }
}
