/* style.css */
:root {
  --aleoria-marinho: #110b3e;
  --aleoria-roxo: #8224e3;
  --aleoria-laranja: #f58220;
  --aleoria-rosa: #e01a88;
  --aleoria-amarelo: #fbb03b;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fc;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.header {
  width: 100%;
  background: linear-gradient(
    90deg,
    var(--aleoria-marinho) 0%,
    var(--aleoria-roxo) 100%
  );
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.header-logo img {
  height: 35px;
  background-color: white;
  padding: 8px 20px;
  border-radius: 25px;
  filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.3));
}

.header button {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}
.header button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.container {
  background-color: white;
  padding: 35px 30px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(17, 11, 62, 0.08);
  text-align: center;
  width: 100%;
  max-width: 450px;
  margin-top: 50px;
  border-top: 5px solid var(--aleoria-laranja);
}

h2 {
  color: var(--aleoria-marinho);
  margin-top: 0;
}

textarea {
  width: 100%;
  height: 150px;
  padding: 15px;
  margin-bottom: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  resize: none;
  box-sizing: border-box;
  font-family: inherit;
}
textarea:focus {
  outline: none;
  border-color: var(--aleoria-roxo);
}

.btn-principal {
  background-color: var(--aleoria-laranja);
  color: white;
  border: none;
  padding: 15px 20px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s, background 0.3s;
  box-shadow: 0 4px 15px rgba(245, 130, 32, 0.4);
}
.btn-principal:hover {
  background-color: #e06d15;
  transform: translateY(-2px);
}

.btn-premium {
  background: linear-gradient(90deg, var(--aleoria-roxo), var(--aleoria-rosa));
  color: white;
  border: none;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  box-shadow: 0 4px 15px rgba(130, 36, 227, 0.4);
}
.btn-premium:hover {
  opacity: 0.9;
}

#resultado {
  margin-top: 25px;
  font-size: 22px;
  font-weight: 800;
  color: var(--aleoria-roxo);
  min-height: 30px;
}

.user-info {
  font-size: 14px;
  display: flex;
  align-items: center;
}

.saldo-badge {
  background-color: var(--aleoria-amarelo);
  color: var(--aleoria-marinho);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: bold;
  margin-left: 15px;
  margin-right: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* REGRAS DE RESPONSIVIDADE PARA TELEMÓVEIS */
@media (max-width: 768px) {
  /* 1. Ajusta o Cabeçalho Superior */
  .header {
    flex-direction: column !important;
    gap: 15px !important;
    text-align: center;
    padding: 15px !important;
  }

  /* 2. Empilha as áreas lado a lado (ex: Criar Rifa + Minhas Rifas) */
  .container > div[style*='display: flex'] {
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* 3. Garante que as caixas ocupem 100% no telemóvel */
  .container > div[style*='display: flex'] > div {
    width: 100% !important;
    min-width: 100% !important;
    flex: none !important;
    margin-bottom: 10px;
  }

  /* 4. Ajustes nos Inputs para não passarem do ecrã */
  input,
  select,
  textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* =========================================
   PORTA DOS DESESPERADOS - EFEITO 3D
   ========================================= */

/* Embalagem principal da porta */
.porta {
  perspective: 1200px;
  width: 140px; /* Trava a largura para não achatar! */
  height: 280px; /* Altura imponente */
  margin: 0 auto; /* Mantém ela centralizada no espaço dela */
  position: relative;
  cursor: pointer;
  transition: transform 0.3s;
}

.porta:hover {
  transform: scale(1.03);
}

/* O fundo escuro (o que fica atrás da porta) */
.porta-fundo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, #2a2a2a, #000000);
  border: 4px solid #3e2723;
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* A Folha da Porta com a sua imagem perfeita */
.porta-folha {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: transparent;
  background-image: url('../img/porta.png'); /* Sua imagem transparente */
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: none;
  border-radius: 6px;
  transform-origin: left; /* A dobradiça */
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.6);
  transform-style: preserve-3d;
}

/* Quando aberta, gira a folha! */
.porta.aberta .porta-folha {
  transform: rotateY(-105deg);
}

/* Bloqueia interações após aberta */
.porta.aberta {
  cursor: default;
}
.porta.aberta:hover {
  transform: none;
}

/* O monstro/prêmio */
.conteudo-porta {
  display: none;
  z-index: 1;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.porta.aberta .conteudo-porta {
  display: flex;
  animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  animation-delay: 0.2s;
  opacity: 0;
}

@keyframes popIn {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Animação do Tremor */
.tremor {
  animation: shake 0.4s;
}
@keyframes shake {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }
  20% {
    transform: translate(-4px, 0px) rotate(2deg);
  }
  40% {
    transform: translate(4px, 3px) rotate(-2deg);
  }
  60% {
    transform: translate(-4px, 1px) rotate(2deg);
  }
  80% {
    transform: translate(4px, -1px) rotate(-2deg);
  }
  100% {
    transform: translate(1px, -2px) rotate(0deg);
  }
}
