/* ==========================================================================
   Tec Castelo - Sorteador  |  identidade visual do site principal
   --cor-primaria #007BFF  --cor-escuro #333  --cor-acento #FFA500
   ========================================================================== */
:root {
  --cor-primaria: #007BFF;
  --cor-primaria-esc: #0056b3;
  --cor-escuro: #333333;
  --cor-acento: #FFA500;
  --cor-acento-esc: #e08e00;
  --cinza-claro: #e5e7eb;
  --branco: #ffffff;
  --sombra: 0 8px 30px rgba(0, 0, 0, .12);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Open Sans', system-ui, sans-serif;
  color: var(--cor-escuro);
  background: var(--cinza-claro);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }
h1, h2, h3 { font-family: 'Montserrat', sans-serif; font-weight: 800; }
.d-none { display: none !important; }
[hidden] { display: none !important; }

.tc-container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* --- Header --------------------------------------------------------------- */
.tc-header { background: var(--cor-escuro); position: sticky; top: 0; z-index: 20; }
.tc-header .tc-container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px;
}
.tc-logo-link { display: inline-flex; align-items: center; }
.tc-logo { height: 38px; width: auto; transition: opacity .2s; }
.tc-logo-link:hover .tc-logo { opacity: .85; }
.tc-badge {
  color: var(--branco); font-weight: 600; font-size: .9rem; font-family: 'Open Sans', sans-serif;
  background: rgba(255, 255, 255, .1); padding: 6px 14px; border-radius: 999px;
  border: 0; cursor: pointer; transition: background .2s;
}
.tc-badge:hover { background: rgba(255, 255, 255, .22); }

/* --- Area de login no header --------------------------------------------- */
.tc-header-right { display: flex; align-items: center; gap: 12px; }
.tc-auth { display: flex; align-items: center; gap: 8px; }
.tc-btn-login {
  display: inline-flex; align-items: center; gap: 7px; background: var(--cor-primaria); color: #fff;
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .85rem; text-decoration: none;
  padding: 7px 14px; border-radius: 999px; transition: background .2s;
}
.tc-btn-login:hover { background: var(--cor-primaria-esc); }
.tc-user-pic { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.4); }
.tc-user-name { color: #fff; font-weight: 600; font-size: .88rem; }
.tc-logout { color: var(--cinza-claro); font-size: .8rem; text-decoration: underline; margin-left: 2px; }
.tc-logout:hover { color: var(--cor-acento); }

/* Seletor de conta gerenciada (no topo, no lugar do @usuario) */
.tc-acc-select {
  font: 600 .88rem 'Open Sans', sans-serif; color: #fff; cursor: pointer; max-width: 200px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  padding: 5px 10px;
}
.tc-acc-select option { color: var(--cor-escuro); }

/* Login CTA no hero */
.tc-herologin { margin-top: 20px; }
.tc-herologin p { margin: 0 0 12px; opacity: .95; }
.tc-herologin .tc-btn-login { font-size: 1rem; padding: 12px 24px; }
.tc-badge i { color: var(--cor-acento); }

/* Icone do Instagram com o gradiente original (roxo->rosa->laranja).
   Fallback solido (nunca fica invisivel); gradiente so onde ha suporte.
   O glifo do Font Awesome fica no ::before, entao o gradiente vai nele. */
.fa-instagram { color: #d62976 !important; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .fa-instagram::before {
    background: linear-gradient(45deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
/* WhatsApp no verde oficial */
.fa-whatsapp { color: #25D366 !important; }

/* --- Hero ----------------------------------------------------------------- */
.tc-hero {
  background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-escuro) 100%);
  color: var(--branco); text-align: center; padding: 64px 0 72px;
}
.tc-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 12px; letter-spacing: -.5px; }
.tc-sub { font-size: 1.1rem; max-width: 620px; margin: 0 auto 32px; opacity: .95; }

.tc-search {
  display: flex; align-items: center; gap: 8px; background: var(--branco);
  border-radius: 999px; padding: 8px 8px 8px 18px; max-width: 760px; margin: 0 auto;
  box-shadow: var(--sombra);
}
.tc-search-ico { color: var(--cor-primaria); font-size: 1.3rem; display: flex; }
.tc-search input {
  flex: 1; border: 0; outline: 0; font-size: 1rem; color: var(--cor-escuro);
  background: transparent; min-width: 0; padding: 10px 6px;
}
.tc-hint { margin-top: 14px; min-height: 22px; font-size: .92rem; color: #ffe3b0; }

/* --- Botoes --------------------------------------------------------------- */
.tc-btn {
  border: 0; cursor: pointer; font-family: 'Montserrat', sans-serif; font-weight: 700;
  font-size: .98rem; padding: 12px 24px; border-radius: 999px; color: var(--branco);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, background .2s ease, box-shadow .2s ease; white-space: nowrap;
}
.tc-btn:active { transform: scale(.97); }
.tc-btn[disabled] { opacity: .55; cursor: not-allowed; }
.tc-btn-primary { background: var(--cor-primaria); }
.tc-btn-primary:hover { background: var(--cor-primaria-esc); }
.tc-btn-accent { background: var(--cor-acento); color: var(--cor-escuro); }
.tc-btn-accent:hover { background: var(--cor-acento-esc); color: var(--branco); }
.tc-btn-ghost { background: transparent; color: var(--cor-escuro); border: 2px solid var(--cinza-claro); }
.tc-btn-block { display: flex; width: 100%; margin-top: 18px; padding: 15px; font-size: 1.05rem; }
.tc-link {
  background: 0; border: 0; color: var(--cor-primaria); cursor: pointer; margin: 14px auto 0;
  display: block; font-weight: 600;
}

/* --- Paineis -------------------------------------------------------------- */
.tc-panel { padding: 40px 0 60px; }
.tc-back {
  background: var(--branco); border: 2px solid var(--cinza-claro); color: var(--cor-escuro);
  font-family: 'Open Sans', sans-serif; font-weight: 600; font-size: .95rem; cursor: pointer;
  border-radius: 999px; padding: 9px 18px; margin-bottom: 18px;
  display: inline-flex; align-items: center; gap: 8px; transition: border-color .2s, color .2s;
}
.tc-back:hover { border-color: var(--cor-primaria); color: var(--cor-primaria); }
.tc-back i { font-size: .9em; }
/* Card do post: imagem inclinada + foto do perfil + contador por cima */
.tc-postshow { max-width: 640px; margin: 0 auto; text-align: center; }
.tc-postmedia { position: relative; width: min(340px, 78%); margin: 0 auto -48px; z-index: 1; }
.tc-postimg {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 22px;
  border: 6px solid #fff; box-shadow: var(--sombra); transform: rotate(4deg); background: var(--cinza-claro);
}
.tc-postavatar {
  position: absolute; left: -38px; top: 26%; width: 92px; height: 92px; object-fit: cover;
  border-radius: 18px; border: 4px solid #fff; box-shadow: var(--sombra); transform: rotate(-4deg);
}
.tc-postbadge {
  position: absolute; right: -34px; bottom: 70px; background: #fff; border-radius: 14px;
  padding: 10px 18px; box-shadow: var(--sombra); transform: rotate(-3deg); line-height: 1.15;
}
.tc-postbadge strong { display: block; font: 800 1.6rem 'Montserrat', sans-serif; color: var(--cor-escuro); }
.tc-postbadge span { font-weight: 600; font-size: .9rem; color: var(--cor-primaria); }
.tc-postbody {
  background: var(--branco); border-radius: 24px; box-shadow: var(--sombra); padding: 66px 24px 24px;
}
.tc-postig { font-size: 2.2rem; }
.tc-postlabel { margin: 6px 0 0; font-weight: 700; color: var(--cor-escuro); }
.tc-postowner { margin: 0 0 12px; font: 800 1.7rem 'Montserrat', sans-serif; color: var(--cor-escuro); word-break: break-word; }
.tc-postcap {
  text-align: left; white-space: pre-line; font-size: .92rem; color: #444; line-height: 1.5;
  max-height: 260px; overflow-y: auto; padding: 12px 14px; background: #f6f7f9; border-radius: 12px;
}
.tc-tag { color: #00376b; font-weight: 600; }
.tc-error {
  margin-top: 16px; text-align: left; padding: 12px 14px; border-radius: 12px;
  background: #fdecec; border: 1px solid #f5c2c2; color: #8a1f1f; font-size: .9rem; line-height: 1.45;
}
.tc-error strong { display: block; margin-bottom: 4px; }

/* --- Loading -------------------------------------------------------------- */
.tc-loading { text-align: center; margin-top: 28px; }
.tc-spinner {
  width: 46px; height: 46px; border: 5px solid var(--cinza-claro);
  border-top-color: var(--cor-primaria); border-radius: 50%;
  margin: 0 auto 12px; animation: tc-spin .8s linear infinite;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }
.tc-loadtext strong { color: var(--cor-primaria); }

/* --- Grid sorteio --------------------------------------------------------- */
.tc-grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.tc-card { background: var(--branco); border-radius: var(--radius); box-shadow: var(--sombra); padding: 22px; }
.tc-h2 { font-size: 1.15rem; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.tc-h2 i { color: var(--cor-primaria); }

.tc-check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; font-size: .95rem; }
.tc-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--cor-primaria); flex: 0 0 auto; }
.tc-subfield { margin: -6px 0 14px 28px; }
.tc-field { display: block; font-size: .9rem; font-weight: 600; color: #555; margin-bottom: 14px; }
.tc-field input, .tc-subfield input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px; font-size: 1rem;
  border: 2px solid var(--cinza-claro); border-radius: 10px; outline: 0; font-family: inherit;
}
.tc-field input:focus, .tc-subfield input:focus { border-color: var(--cor-primaria); }
.tc-integrity {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: .85rem; line-height: 1.4;
  background: #fff7e6; border: 1px solid #ffd591; color: #7a4b00;
}
.tc-datetime { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; font-size: .9rem; }
.tc-datetime[hidden] { display: none; }
.tc-datetime small { grid-column: 1 / -1; color: #777; margin-top: -4px; }
.tc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tc-eligible {
  background: var(--cinza-claro); border-radius: 10px; padding: 12px; text-align: center;
  margin: 6px 0 4px; font-size: .95rem;
}
.tc-eligible strong { color: var(--cor-primaria); font-size: 1.2rem; }

/* --- Lista de participantes ---------------------------------------------- */
.tc-listhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tc-listsearch { border: 2px solid var(--cinza-claro); border-radius: 999px; padding: 8px 14px; outline: 0; font-family: inherit; }
.tc-listsearch:focus { border-color: var(--cor-primaria); }
.tc-liststats { font-size: .85rem; color: #777; margin: 4px 0 10px; }
.tc-list {
  height: 520px; overflow-y: auto; border: 1px solid var(--cinza-claro); border-radius: 12px;
  padding: 6px;
}
.tc-list::-webkit-scrollbar { width: 10px; }
.tc-list::-webkit-scrollbar-thumb { background: var(--cor-primaria); border-radius: 999px; border: 2px solid var(--branco); }
.tc-list::-webkit-scrollbar-track { background: var(--cinza-claro); border-radius: 999px; }
.tc-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: .92rem;
}
.tc-row:nth-child(odd) { background: #f7f8fa; }
.tc-row .tc-idx { color: #9aa1ad; font-size: .78rem; min-width: 46px; font-variant-numeric: tabular-nums; }
.tc-row .tc-at { color: var(--cor-primaria); font-weight: 700; }
.tc-row .tc-mentions { margin-left: auto; color: var(--cor-acento-esc); font-size: .75rem; }
.tc-empty { text-align: center; color: #999; padding: 40px 10px; }

/* --- Overlay do sorteio --------------------------------------------------- */
.tc-overlay {
  position: fixed; inset: 0; background: rgba(51, 51, 51, .96); z-index: 100;
  display: flex; flex-direction: column; align-items: center;
  padding: 72px 20px 40px; overflow-y: auto;
}
/* margin auto centraliza quando cabe e deixa rolar quando o conteudo e maior */
.tc-overlay > .tc-count,
.tc-overlay > .tc-result { margin: auto 0; }
.tc-overlay-close {
  position: fixed; top: 20px; right: 24px; background: rgba(255, 255, 255, .18); color: #fff;
  border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; z-index: 101;
}
.tc-overlay-close:hover { background: rgba(255, 255, 255, .3); }
.tc-count { text-align: center; color: #fff; }
.tc-count-label { font-size: 1.2rem; letter-spacing: 2px; text-transform: uppercase; opacity: .8; margin: 0 0 10px; }
.tc-count-num {
  font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: clamp(6rem, 24vw, 14rem);
  line-height: 1; color: var(--cor-acento); animation: tc-pop .9s ease;
}
@keyframes tc-pop { 0% { transform: scale(.3); opacity: 0; } 50% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

.tc-result { text-align: center; color: #fff; max-width: 560px; width: 100%; animation: tc-fadein .5s ease; }
@keyframes tc-fadein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tc-result-label { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 2px; color: var(--cor-acento); margin: 0 0 20px; }
.tc-result-label i { margin-right: 6px; }
.tc-winner {
  background: linear-gradient(135deg, var(--cor-primaria), var(--cor-primaria-esc));
  border-radius: var(--radius); padding: 22px; margin-bottom: 14px; box-shadow: var(--sombra);
}
.tc-winner .tc-winner-at { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 1.8rem; }
.tc-winner .tc-winner-txt { font-size: .9rem; opacity: .9; margin-top: 6px; }
.tc-backups { margin-top: 18px; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 16px; }
.tc-backups-label { font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; opacity: .7; margin: 0 0 10px; }
.tc-backup { background: rgba(255, 255, 255, .08); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-weight: 600; }
.tc-backup .tc-at { color: var(--cor-acento); }
.tc-result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.tc-result-actions .tc-btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }

/* --- Footer --------------------------------------------------------------- */
.tc-footer { background: var(--cor-escuro); color: rgba(255, 255, 255, .55); flex-shrink: 0; padding: 40px 0 24px; }
.tc-foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 28px; }
.tc-foot-col h5 { font-family: 'Montserrat', sans-serif; color: #fff; font-size: 1rem; margin: 0 0 14px; }
.tc-foot-col p { margin: 0 0 8px; font-size: .9rem; }
.tc-foot-col ul { list-style: none; padding: 0; margin: 0; }
.tc-foot-col li { margin-bottom: 8px; }
.tc-foot-col a { color: rgba(255, 255, 255, .55); text-decoration: none; font-size: .9rem; transition: color .2s; }
.tc-foot-col a:hover { color: var(--cor-acento); }
.tc-foot-col i { color: var(--cor-acento); margin-right: 8px; }
.tc-foot-logo { height: 54px; margin-bottom: 12px; display: inline-block; }
.tc-foot-copy { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 28px; padding-top: 18px; text-align: center; }
.tc-foot-copy p { margin: 0; font-size: .82rem; }
.tc-foot-copy .tc-cnpj { font-size: .76rem; opacity: .8; margin-top: 2px; }

@media (max-width: 640px) {
  .tc-foot-grid { grid-template-columns: 1fr; text-align: center; gap: 22px; }
  .tc-foot-col ul { display: inline-block; text-align: left; }
}

/* --- Responsivo ----------------------------------------------------------- */
@media (max-width: 820px) {
  .tc-grid { grid-template-columns: 1fr; }
  .tc-list { height: 420px; }
}
@media (max-width: 560px) {
  .tc-search { flex-wrap: wrap; border-radius: 20px; padding: 12px; }
  .tc-search input { width: 100%; }
  .tc-btn-primary { width: 100%; }
  .tc-postavatar { left: -18px; width: 70px; height: 70px; }
  .tc-postbadge { right: -18px; }
  .tc-acc-select { max-width: 130px; }
  .tc-header-right { gap: 8px; }
  .tc-badge { font-size: 0; padding: 8px 10px; } /* so o icone no celular */
  .tc-badge i { font-size: 1rem; }
}

/* Efeito vidro so no mobile: barras e botoes.
   Vidro so "aparece" com algo atras: o topo fica fixo e o conteudo passa por baixo;
   nos botoes o brilho vem do reflexo (gradiente) + borda clara + sombra interna. */
@media (max-width: 768px) {
  .tc-header {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(180deg, rgba(60, 60, 60, .62), rgba(40, 40, 40, .48));
    -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
    border-bottom: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  }
  .tc-search {
    background: linear-gradient(135deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .6));
    -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18), inset 0 1px 0 #fff;
  }
  .tc-btn, .tc-badge, .tc-back, .tc-btn-login, .tc-acc-select {
    -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, .45);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .08);
  }
  /* reflexo por cima da cor (2 camadas de fundo) */
  .tc-btn-primary, .tc-btn-login {
    background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%), rgba(0, 123, 255, .82);
  }
  .tc-btn-accent {
    background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 55%), rgba(255, 165, 0, .85);
  }
  .tc-btn-ghost, .tc-back {
    background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .6));
  }
  .tc-badge, .tc-acc-select {
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08));
  }
}
