/* ==========================================================================
   Controle COSAE — Dashboard (index.html)
   ========================================================================== */

.dashboard-hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 8px;
  opacity: 0;
  transform: translateY(16px);
  animation: dashboard-fade-in var(--cosae-slow) var(--cosae-ease) 80ms forwards;
}

@keyframes dashboard-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-hero__title {
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--cosae-text);
  margin: 0 0 14px;
  letter-spacing: -0.5px;
}

.dashboard-hero__subtitle {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--cosae-text-muted);
  max-width: 760px;
  margin: 0 0 12px;
}

/* Só o texto de boas-vindas da tela inicial — parágrafos longos ficam mais
   arrumados justificados; nas outras telas esse mesmo componente costuma
   ter 1 linha só de subtítulo, onde justificar não faz sentido. */
.dashboard-hero__subtitle--justify {
  text-align: justify;
}

.dashboard-hero__subtitle:last-of-type {
  margin-bottom: 40px;
}

.dashboard-hero__signature {
  margin-top: 28px;
  line-height: 1.6;
}

.dashboard-hero__list {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--cosae-text-muted);
  max-width: 760px;
  margin: 0 0 12px;
  padding-left: 22px;
}

.dashboard-hero__list li {
  margin-bottom: 4px;
}

/* Variante larga — usada em páginas de painel (objetos.html, dashboard-limpeza.html...), que devem
   aproveitar toda a largura da tela em vez do formato "carta" da página inicial */
.dashboard-hero--wide {
  max-width: var(--cosae-content-max-width);
  padding-left: 28px;
  padding-right: 28px;
}

/* Seções de um painel (Visão Geral, Limpeza...), em formato de lista que
   abre/fecha ao clicar no título — mantém a tela sem excesso de informação. */
.dash-section {
  max-width: var(--cosae-content-max-width);
  margin: 0 auto;
  padding: 0 28px;
}

.dash-section__title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--cosae-text);
  letter-spacing: -0.3px;
  margin: 0;
}

.dash-section__title--centered {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 1.4rem;
  margin: 0 0 20px;
}

.dash-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  background: none;
  border: none;
  padding: 4px 0;
  margin: 0 0 6px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border-radius: var(--cosae-radius-sm);
  transition: opacity var(--cosae-fast) var(--cosae-ease);
}

.dash-section__header:hover {
  opacity: 0.72;
}

.dash-section__header:focus-visible {
  outline: 2px solid var(--cosae-red);
  outline-offset: 4px;
}

.dash-section__chevron {
  flex-shrink: 0;
  color: var(--cosae-red);
  transition: transform var(--cosae-normal) var(--cosae-ease);
}

.dash-section.is-open .dash-section__chevron {
  transform: rotate(180deg);
}

/* Altura animada via max-height medido em JS (layout.js) — mais confiável entre
   navegadores do que animar grid-template-rows/fr, que tem suporte inconsistente. */
.dash-section__body {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--cosae-slow) var(--cosae-ease);
}

.dash-section__caption {
  color: var(--cosae-text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto 22px;
  text-align: center;
}

.section-placeholder-card {
  border: 1.5px dashed var(--cosae-border);
  border-radius: var(--cosae-radius-md);
  background: var(--cosae-surface);
  padding: 44px 24px;
  text-align: center;
  color: var(--cosae-text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* Divisória estilizada entre seções */
.section-divider {
  border: none;
  height: 2px;
  max-width: var(--cosae-content-max-width);
  margin: 0 auto 44px;
  padding: 0 28px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(179, 18, 26, 0.45) 50%,
    transparent 100%
  );
  background-clip: content-box;
}

/* -------------------------------------------------------------------------
   Tela inicial (index.html) — banner + grade de cartões, um por tela do
   sistema. Só título + ícone; a descrição aparece num balão ao passar o
   mouse. Clicar abre a tela.
   ------------------------------------------------------------------------- */
.home {
  max-width: var(--cosae-content-max-width);
  margin: 0 auto;
  padding: 20px clamp(18px, 4vw, 28px) 56px;
}

.home-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--cosae-radius-lg);
  margin-bottom: 26px;
  box-shadow: 0 6px 24px rgba(16, 16, 20, 0.1);
  opacity: 0;
  transform: translateY(14px);
  animation: dashboard-fade-in var(--cosae-slow) var(--cosae-ease) 60ms forwards;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(12px, 1.4vw, 16px);
  /* cartões da mesma linha esticam pra mesma altura */
  align-items: stretch;
}

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 20px 18px;
  background: var(--cosae-surface);
  border: 1.5px solid var(--cosae-border);
  border-radius: var(--cosae-radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 16, 20, 0.04);
  opacity: 0;
  transform: translateY(12px);
  animation: dashboard-fade-in 460ms var(--cosae-ease) forwards;
  animation-delay: calc(120ms + var(--d, 0) * 45ms);
  transition: transform var(--cosae-fast) var(--cosae-ease),
    border-color var(--cosae-fast) var(--cosae-ease),
    box-shadow var(--cosae-fast) var(--cosae-ease);
}

.home-card:hover,
.home-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--cosae-red);
  box-shadow: 0 16px 34px rgba(179, 18, 26, 0.16);
  outline: none;
  /* sobe acima dos cartões vizinhos pra o balão de descrição não ficar por trás */
  z-index: 5;
}

.home-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 13px;
  background: rgba(179, 18, 26, 0.09);
  color: var(--cosae-red);
  transition: background var(--cosae-fast) var(--cosae-ease), color var(--cosae-fast) var(--cosae-ease), transform var(--cosae-fast) var(--cosae-ease);
}

.home-card:hover .home-card__icon,
.home-card:focus-visible .home-card__icon {
  background: linear-gradient(180deg, var(--cosae-red-light), var(--cosae-red));
  color: #fff;
  transform: scale(1.04);
}

.home-card__title {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--cosae-text);
  /* reserva sempre 2 linhas — título de 1 linha ou de 2 ocupa a mesma altura,
     então todos os cartões ficam iguais */
  min-height: 2.6em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-card__go {
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: var(--cosae-red);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity var(--cosae-fast) var(--cosae-ease), transform var(--cosae-fast) var(--cosae-ease);
}

.home-card:hover .home-card__go,
.home-card:focus-visible .home-card__go {
  opacity: 1;
  transform: translateX(0);
}

/* Balão de descrição — flutua abaixo do cartão, não empurra o layout. */
.home-card__reveal {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 12px 14px;
  border-radius: 12px;
  background: #17171b;
  color: #f2f2f4;
  font-size: 0.8rem;
  line-height: 1.55;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  transition: opacity var(--cosae-fast) var(--cosae-ease), transform var(--cosae-fast) var(--cosae-ease);
}

.home-card__reveal::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 26px;
  width: 11px;
  height: 11px;
  background: inherit;
  border-radius: 2px;
  transform: rotate(45deg);
}

.home-card:hover .home-card__reveal,
.home-card:focus-visible .home-card__reveal {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  /* Sem hover (celular/tablet) — descrição fixa embaixo, cortada em 2 linhas
     pra todos os cartões terem a mesma altura. */
  .home-card__reveal {
    position: static;
    padding: 8px 0 0;
    background: transparent;
    color: var(--cosae-text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    box-shadow: none;
    opacity: 1;
    transform: none;
  }
  .home-card__reveal::before { display: none; }
  .home-card__go { display: none; }
  .home-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
  }
}

@media (max-width: 560px) {
  .home { padding-top: 12px; }
  .home-banner { border-radius: var(--cosae-radius-md); margin-bottom: 18px; }
  .home-grid { grid-template-columns: 1fr; }
}


@media (max-width: 640px) {
  .dashboard-hero {
    padding: 40px 18px 8px;
  }
  .dashboard-hero--wide {
    padding-left: 18px;
    padding-right: 18px;
  }
  .dashboard-hero__title {
    font-size: 1.6rem;
  }
  .dashboard-hero__subtitle {
    font-size: 0.92rem;
  }
  .dash-section {
    padding: 0 18px;
  }
  .dash-section__title {
    font-size: 1.1rem;
  }
  .section-divider {
    margin: 0 auto 32px;
    padding: 0 18px;
  }
}
