/* Planner: calendário, semana, dia, ano, janela de compromisso e animações 3D. */

.planner { display: flex; flex-direction: column; gap: 26px; }

/* ---------- Topo do planner ---------- */
.planner-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.planner-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.planner-titulo { font-size: 30px; min-width: 200px; text-align: center; }
.planner-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.botao-redondo {
  width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--suave); color: var(--tinta);
  transition: transform 0.2s ease;
}
.botao-redondo:hover { transform: scale(1.08) rotate(-4deg); }
.visoes { display: flex; padding: 4px; border-radius: 999px; background: var(--suave); }
.visao { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; color: var(--tinta); text-decoration: none; font-weight: 700; font-size: 14px; }
.visao.ativa { background: var(--destaque); color: var(--destaque-texto); box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.35); }

/* ---------- Folha (base de todas as visões) ---------- */
.folha { position: relative; }
.argolas { position: absolute; top: -12px; left: 6%; right: 6%; display: flex; justify-content: space-between; pointer-events: none; z-index: 2; }
.argolas span {
  width: 12px; height: 26px; border-radius: 8px;
  background: linear-gradient(90deg, #8d8d8d, #f4f4f4 45%, #9a9a9a);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- Mês ---------- */
.cal-cabecalho, .cal-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-cabecalho { margin: 10px 0 6px; text-align: center; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--apagado); }
.cal-dia {
  min-height: 108px; padding: 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1.5px var(--suave); display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cal-dia:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--suave), 0 10px 18px -12px rgba(0, 0, 0, 0.45); }
.cal-dia.fora { opacity: 0.45; }
.cal-dia-topo { display: flex; align-items: center; justify-content: space-between; }
.cal-numero {
  width: 30px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--fonte-titulo); font-size: 17px; color: var(--tinta); text-decoration: none;
}
.cal-mais {
  width: 28px; height: 28px; border-radius: 999px; border: 0; background: transparent; color: var(--apagado);
  font-size: 20px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s ease, transform 0.2s ease;
}
.cal-dia:hover .cal-mais, .cal-mais:focus-visible { opacity: 1; }
.cal-mais:hover { transform: rotate(90deg); background: var(--suave); }
.cal-dia.hoje { background: var(--cartao); box-shadow: inset 0 0 0 2.5px var(--destaque), 0 12px 22px -14px rgba(0, 0, 0, 0.5); }
.cal-dia.hoje .cal-numero { background: var(--destaque); color: var(--destaque-texto); }
.cal-eventos { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-ver-mais { font-size: 12px; padding-left: 4px; }
.cal-pontos { display: none; gap: 3px; justify-content: center; }
.cal-pontos span { width: 7px; height: 7px; border-radius: 999px; }

/* Chips de compromisso */
.chip-evento {
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; min-height: 26px; padding: 3px 7px;
  border: 0; border-radius: 9px; background: var(--clara); color: #2B2230; cursor: pointer; text-align: left;
  font-size: 12.5px; font-weight: 700; transition: transform 0.18s ease, box-shadow 0.18s ease;
  transform-origin: 50% 100%;
}
.chip-evento:hover { transform: perspective(300px) rotateX(10deg) translateY(-2px); box-shadow: 0 6px 10px -6px var(--cor); }
.chip-ponto { width: 8px; height: 8px; border-radius: 999px; background: var(--cor); flex-shrink: 0; }
.chip-hora { color: var(--cor); font-variant-numeric: tabular-nums; flex-shrink: 0; filter: brightness(0.8); }
.chip-titulo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip-cat { margin-left: auto; font-size: 11px; opacity: 0.7; }

/* ---------- Semana ---------- */
.sem-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.sem-coluna {
  border-radius: 18px; padding: 10px; min-height: 260px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
  box-shadow: 0 10px 18px -16px rgba(0, 0, 0, 0.5);
}
.sem-coluna.hoje { box-shadow: inset 0 0 0 2.5px var(--destaque), 0 12px 22px -14px rgba(0, 0, 0, 0.5); }
.sem-cabeca { display: flex; flex-direction: column; color: var(--tinta); text-decoration: none; }
.sem-eventos { display: flex; flex-direction: column; gap: 4px; }
.adicionar-leve { border: 0; background: transparent; color: var(--apagado); font-size: 12px; font-weight: 700; text-align: left; padding: 4px 2px; cursor: pointer; min-height: 28px; }
.adicionar-leve:hover { color: var(--destaque); }
.lista-tarefas.mini .marcar { min-height: 34px; gap: 8px; font-size: 13px; }
.lista-tarefas.mini .caixa { width: 20px; height: 20px; border-radius: 7px; }
.lista-tarefas.mini .apagar { width: 28px; height: 28px; font-size: 18px; }
.linha-form.compacto { margin-top: auto; }
.linha-form.compacto input { min-height: 36px; font-size: 13px; padding: 0 10px; border-radius: 10px; flex: 1 1 auto; width: 100%; min-width: 0; }

/* ---------- Dia ---------- */
.dia-layout { display: flex; flex-wrap: wrap; gap: 30px; align-items: flex-start; }
.dia-conteudo { flex: 999 1 380px; min-width: 0; }
.bloco-calendario { flex: 1 1 200px; max-width: 240px; margin: 0 auto; position: relative; perspective: 900px; padding-top: 14px; }
.bloco-argolas { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-around; z-index: 2; }
.bloco-argolas span { width: 14px; height: 30px; border-radius: 9px; background: linear-gradient(90deg, #8d8d8d, #f4f4f4 45%, #9a9a9a); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); }
.bloco-pagina {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 22px 12px 18px;
  background: #fffdf8; border-radius: 10px; border-top: 22px solid var(--destaque);
  box-shadow: 0 1px 0 #eee, 0 3px 0 #e6e0d6, 0 5px 0 #ddd6ca, 0 7px 0 #d3cbbd, 0 18px 24px -10px rgba(0, 0, 0, 0.45);
  transform: rotateX(8deg); transform-origin: 50% 0;
  transition: transform 0.4s ease;
}
.bloco-calendario:hover .bloco-pagina { transform: rotateX(18deg) rotateZ(-1deg); }
.bloco-mes { text-transform: uppercase; letter-spacing: 3px; font-size: 13px; font-weight: 800; color: var(--apagado); }
.bloco-numero { font-family: var(--fonte-titulo); font-size: 96px; line-height: 1; color: var(--destaque); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.08); }
.bloco-semana { font-family: 'Kalam', cursive; font-size: 26px; color: var(--tinta); }
.agenda { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.agenda-item { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; align-items: start; }
.agenda-hora { font-weight: 800; font-size: 15px; padding-top: 10px; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.agenda-hora small { font-weight: 600; font-size: 12px; color: var(--apagado); }
.agenda-cartao {
  display: flex; flex-direction: column; gap: 4px; text-align: left; border: 0; cursor: pointer; width: 100%;
  padding: 12px 14px; border-radius: 16px; background: var(--clara); color: #2B2230;
  box-shadow: 0 8px 16px -12px var(--cor); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.agenda-cartao:hover { transform: perspective(700px) rotateY(-6deg) translateX(4px); box-shadow: -8px 12px 20px -14px var(--cor); }
.agenda-titulo { font-weight: 800; font-size: 16px; }
.agenda-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.agenda-desc { font-size: 14px; opacity: 0.85; white-space: pre-line; }
.agenda .vazio { font-size: 24px; color: var(--apagado); padding: 6px 0; }

/* ---------- Ano ---------- */
.ano-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; perspective: 1200px; }
.mini-mes {
  border-radius: 16px; padding: 10px 10px 12px;
  box-shadow: 0 10px 18px -14px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease; transform-style: preserve-3d;
}
.mini-mes:hover { transform: rotateX(8deg) rotateY(-6deg) translateZ(20px); box-shadow: 0 22px 30px -16px rgba(0, 0, 0, 0.5); }
.mini-titulo { display: flex; align-items: center; justify-content: space-between; font-family: var(--fonte-titulo); font-size: 19px; font-weight: 700; color: var(--tinta); text-decoration: none; margin-bottom: 6px; }
.mini-qtd { font-family: 'Schibsted Grotesk', sans-serif; font-size: 11px; font-weight: 800; background: var(--destaque); color: var(--destaque-texto); border-radius: 999px; padding: 1px 7px; }
.mini-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mini-dia { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--tinta); text-decoration: none; border-radius: 999px; }
.mini-dia.tem { background: var(--cor); color: #fff; }
.mini-dia.hoje { box-shadow: 0 0 0 2px var(--destaque); }
.mini-dia:hover { background: var(--suave); color: var(--tinta); }

/* ---------- Janela de compromisso ---------- */
.janela {
  position: fixed; inset: 0; margin: auto; height: fit-content;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto;
  color: var(--tinta); padding: 22px;
}
.janela::backdrop { background: rgba(30, 20, 25, 0.45); backdrop-filter: blur(3px); }
.janela .formulario { margin: 0; }
.janela textarea { border-radius: 14px; border: 2px solid var(--suave); padding: 10px 12px; background: #fff; font-size: 15px; resize: vertical; }
.linha-campos { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.linha-campos input { width: 100%; }
.categorias { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.categorias legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding: 0; }
.opcao-cat { position: relative; cursor: pointer; }
.opcao-cat input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opcao-cat span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--clara); color: #2B2230; font-weight: 700; font-size: 14px; border: 2px solid transparent;
  transition: transform 0.15s ease;
}
.opcao-cat span::before { content: ''; width: 10px; height: 10px; border-radius: 999px; background: var(--cor); }
.opcao-cat input:checked + span { border-color: var(--cor); transform: translateY(-2px); box-shadow: 0 6px 12px -8px var(--cor); }
.opcao-cat input:focus-visible + span { outline: 3px solid #6E8BFF; outline-offset: 2px; }
.janela-botoes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.espaco-flex { flex: 1; }
.botao-perigo { background: #FCE4E1; color: #8E2318; }

/* ---------- Animações 3D ---------- */
.efeitos-ativos .folha.entra-prox { animation: entra-prox 0.7s cubic-bezier(.2, .8, .2, 1) both; }
.efeitos-ativos .folha.entra-ant { animation: entra-ant 0.7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes entra-prox { from { transform: perspective(1600px) rotateY(18deg) translateX(30px); opacity: 0.2; } to { transform: none; opacity: 1; } }
@keyframes entra-ant { from { transform: perspective(1600px) rotateY(-18deg) translateX(-30px); opacity: 0.2; } to { transform: none; opacity: 1; } }

/* página do calendário virando */
.copia-saindo { backface-visibility: hidden; }
.virando-prox { transform-origin: 0% 50%; animation: virar-prox 0.8s cubic-bezier(.45, .05, .35, 1) forwards; }
.virando-ant { transform-origin: 100% 50%; animation: virar-ant 0.8s cubic-bezier(.45, .05, .35, 1) forwards; }
@keyframes virar-prox {
  0% { transform: perspective(1800px) rotateY(0); filter: brightness(1); }
  100% { transform: perspective(1800px) rotateY(-110deg); filter: brightness(0.7); }
}
@keyframes virar-ant {
  0% { transform: perspective(1800px) rotateY(0); filter: brightness(1); }
  100% { transform: perspective(1800px) rotateY(110deg); filter: brightness(0.7); }
}

/* folha do dia sendo arrancada */
.folha-arrancada { transform-origin: 85% 0%; animation: arrancar 1s cubic-bezier(.5, 0, .7, .4) forwards; }
@keyframes arrancar {
  0% { transform: none; opacity: 1; }
  18% { transform: perspective(1200px) rotateX(14deg) rotateZ(-3deg) translateY(6px); }
  35% { transform: perspective(1200px) rotateX(22deg) rotateZ(-8deg) translate(-10px, 30px); opacity: 1; }
  100% { transform: perspective(1200px) rotateX(75deg) rotateZ(-28deg) translate(-160px, 110vh); opacity: 0.3; }
}

/* calendário do mês: hoje respira, número gira como moeda */
.efeitos-ativos .cal-dia.hoje { animation: respirar 3.2s ease-in-out infinite; }
@keyframes respirar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.efeitos-ativos .cal-dia.hoje .cal-numero { animation: moeda 6s ease-in-out infinite; }
@keyframes moeda { 0%, 70% { transform: rotateY(0); } 85%, 100% { transform: rotateY(360deg); } }

/* semana: colunas entram uma a uma */
.efeitos-ativos .chegando .sem-coluna { animation: coluna-entra 0.55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes coluna-entra { from { transform: perspective(900px) rotateX(-70deg) translateY(-20px); opacity: 0; transform-origin: 50% 0; } to { transform: none; opacity: 1; } }

/* ano: meses viram um por um */
.efeitos-ativos .chegando .mini-mes { animation: mes-vira 0.6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes mes-vira { from { transform: rotateY(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* dia: agenda chega em cascata */
.efeitos-ativos .chegando .agenda-item { animation: item-entra 0.5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms + 150ms); }
@keyframes item-entra { from { transform: perspective(700px) rotateY(35deg) translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.efeitos-ativos .chegando .bloco-pagina { animation: bloco-cai 0.8s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes bloco-cai { from { transform: rotateX(-80deg); } to { transform: rotateX(8deg); } }

/* compromisso recém-salvo dá um pulinho */
.efeitos-ativos .recem { animation: pulinho 0.7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pulinho { 0% { transform: perspective(400px) rotateX(-90deg) scale(0.6); } 100% { transform: none; } }

/* janela abre em 3D */
.efeitos-ativos .janela[open] { animation: janela-abre 0.45s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes janela-abre { from { transform: perspective(900px) rotateX(-25deg) translateY(30px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* confete */
.confete { position: fixed; z-index: 90; width: 0; height: 0; pointer-events: none; perspective: 500px; }
.confete span {
  position: absolute; left: -4px; top: -4px; width: 9px; height: 13px; border-radius: var(--forma); background: var(--cor);
  animation: confete 1.1s cubic-bezier(.15, .7, .35, 1) forwards;
}
@keyframes confete {
  0% { transform: translate3d(0, 0, 0) rotateX(0) rotateZ(0) scale(0.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate3d(var(--dx), calc(var(--dy) + 60px), 0) rotateX(var(--rx)) rotateZ(var(--rz)) scale(1); opacity: 0; }
}

.sem-efeitos .folha, .sem-efeitos .sem-coluna, .sem-efeitos .mini-mes, .sem-efeitos .agenda-item,
.sem-efeitos .cal-dia.hoje, .sem-efeitos .cal-numero, .sem-efeitos .bloco-pagina, .sem-efeitos .recem { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .folha, .sem-coluna, .mini-mes, .agenda-item, .cal-dia.hoje, .cal-numero, .bloco-pagina, .recem, .janela[open] { animation: none !important; }
}

/* ---------- Telas menores ---------- */
@media (max-width: 1200px) {
  .sem-grade { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 760px) {
  .cal-dia { min-height: 64px; padding: 4px; border-radius: 10px; }
  .cal-eventos, .cal-mais { display: none; }
  .cal-pontos { display: flex; }
  .cal-dia-topo { justify-content: center; }
  .cal-numero { width: 28px; height: 28px; font-size: 15px; }
  .cal-cabecalho, .cal-grade { gap: 3px; }
  .planner-titulo { font-size: 24px; min-width: 0; flex: 1; }
  .planner-nav { width: 100%; }
  .linha-campos { grid-template-columns: 1fr 1fr; }
  .linha-campos label:first-child { grid-column: 1 / -1; }
  .argolas { display: none; }
}
