/* Demonstração animada da Sugestão de Prazo na landing (index.php), no lugar do antigo images/sgprazo.mp4.
   A moldura (selo dourado, janela do navegador, cursor e balão) reaproveita as classes .kbd-* do
   kanban-demo.css, que precisa estar carregado antes deste arquivo. As cores do cartão seguem a tela
   real (sugestao/sugestao_tarefas.php). */

.sgd .kbd-balao {
    right: auto;
    left: 12px;
}

/* Título longo: encolhe em vez de quebrar em duas linhas */
.sgd .kbd-selo {
    font-size: clamp(14px, 4.6cqi, 28px);
    white-space: nowrap;
}

.sgd-palco {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1.2fr);
    align-items: start;
    padding: 14px;
    overflow: hidden;
    background: linear-gradient(135deg, #1A1B41, #000);
}

.sgd-pub,
.sgd-sug {
    min-width: 0;
    padding: 11px 12px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    transition: opacity .4s;
}

/* Publicação */
.sgd-pub {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .45s, transform .45s;
}

.sgd-pub.sgd-entrou {
    opacity: 1;
    transform: none;
}

.sgd-pub-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 7px;
}

.sgd-nova {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
}

.sgd-entrou .sgd-nova i {
    animation: sgdSino 1.4s ease-in-out 2;
    transform-origin: 50% 0;
}

.sgd-pub-data {
    color: #6b7280;
    font-size: 9.5px;
    font-weight: 600;
    white-space: nowrap;
}

.sgd-proc {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    color: #1A1B41;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sgd-proc i {
    color: #d4af37;
}

.sgd-partes {
    margin: 3px 0 7px;
    overflow: hidden;
    color: #6b7280;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sgd-texto {
    position: relative;
    height: 126px;
    padding-top: 7px;
    overflow: hidden;
    border-top: 1px solid #f0f1f3;
    color: #374151;
    font-size: 10.5px;
    line-height: 1.55;
}

.sgd-texto p {
    margin: 0;
}

.sgd-chave {
    padding: 0 1px;
    border-radius: 3px;
    transition: background-color .3s, color .3s, box-shadow .3s;
}

.sgd-chave.sgd-marcado {
    background: rgba(212, 175, 55, .3);
    color: #1A1B41;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, .55);
}

.sgd-chave.sgd-pulsa {
    animation: sgdPulsa .9s ease-out;
}

.sgd-scan {
    position: absolute;
    top: -24px;
    right: 0;
    left: 0;
    height: 24px;
    border-bottom: 2px solid #f1c40f;
    background: linear-gradient(180deg, rgba(241, 196, 15, 0), rgba(241, 196, 15, .25));
    opacity: 0;
    pointer-events: none;
}

.sgd-scan.sgd-ativo {
    animation: sgdLeitura 2.2s cubic-bezier(.4, 0, .6, 1) forwards;
}

/* IA no meio */
.sgd-ponte {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: center;
    height: 70px;
}

.sgd-ponte::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 3px;
    left: 3px;
    height: 2px;
    margin-top: -12px;
    background: repeating-linear-gradient(90deg, rgba(241, 196, 15, .8) 0 6px, transparent 6px 12px);
    background-size: 12px 2px;
    opacity: .25;
}

.sgd-pensando .sgd-ponte::before {
    opacity: 1;
    animation: sgdFluxo .6s linear infinite;
}

.sgd-ia {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 2px solid #d4af37;
    border-radius: 50%;
    background: #1A1B41;
    color: #f1c40f;
    font-size: 13px;
}

.sgd-pensando .sgd-ia {
    animation: sgdIa 1.1s ease-in-out infinite;
}

.sgd-ponte-txt {
    position: relative;
    z-index: 1;
    color: #f1c40f;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Cartão de sugestão */
.sgd-sug {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sgd-sug-topo {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sgd-sug-titulo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
    color: #1A1B41;
    font-size: 11.5px;
    font-weight: 800;
    white-space: nowrap;
}

.sgd-sug-titulo i {
    color: #a855f7;
}

.sgd-badge {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 8.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity .3s;
}

.sgd-tipo {
    background: #005ce6;
    color: #fff;
    opacity: 0;
}

.sgd-com-tipo .sgd-tipo {
    opacity: 1;
}

.sgd-pendente {
    background: #ffc107;
    color: #1a1a1a;
}

.sgd-rotulo {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
    color: #6c757d;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sgd-rotulo i {
    color: #d4af37;
}

.sgd-valor {
    min-height: 1.4em;
    border-radius: 4px;
    color: #1A1B41;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    transition: color .35s;
}

.sgd-2linhas {
    display: -webkit-box;
    height: 2.8em;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Esqueleto enquanto a IA ainda não preencheu o campo */
.sgd-campo:not(.sgd-visivel) .sgd-valor,
.sgd-campo:not(.sgd-visivel) .sgd-sub {
    color: transparent;
    background: linear-gradient(90deg, #eef0f3 0%, #f8f9fb 50%, #eef0f3 100%);
    background-size: 200% 100%;
    animation: sgdEsqueleto 1.4s linear infinite;
}

.sgd-detalhes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.sgd-det {
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid rgba(212, 175, 55, .2);
    border-radius: 8px;
    background: rgba(0, 0, 0, .025);
}

.sgd-det .sgd-valor {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sgd-sub {
    display: block;
    margin-top: 1px;
    overflow: hidden;
    border-radius: 3px;
    color: #6b7280;
    font-size: 8.5px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sgd-visivel .sgd-ok {
    color: #16a34a;
}

.sgd-rodape {
    position: relative;
    height: 26px;
}

.sgd-botoes,
.sgd-registrado {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity .35s, transform .35s;
}

.sgd-botoes {
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(4px);
}

.sgd-com-botoes .sgd-botoes {
    opacity: 1;
    transform: none;
}

.sgd-registrou .sgd-botoes {
    opacity: 0;
    transform: translateY(-4px);
}

.sgd-registrado {
    padding: 0 8px;
    overflow: hidden;
    border-left: 3px solid #ffc107;
    border-radius: 6px;
    background: #fff3cd;
    color: #856404;
    font-size: 9.5px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
}

.sgd-registrado i {
    color: #ff9800;
}

.sgd-registrou .sgd-registrado {
    opacity: 1;
}

.sgd-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: transform .12s, filter .12s;
}

.sgd-btn-azul { background: #0d6efd; }
.sgd-btn-verde { background: #28a745; }
.sgd-btn-cinza { background: #6c757d; }

.sgd-btn.sgd-clicado {
    filter: brightness(.88);
    transform: scale(.94);
}

/* Aviso "Prazo criado com sucesso!" */
.sgd-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    color: #1A1B41;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
    opacity: 0;
    transform: translate(-50%, -40%) scale(.92);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}

.sgd-toast i {
    color: #22c55e;
    font-size: 16px;
}

.sgd-toast.sgd-visivel {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.sgd-saindo .sgd-pub,
.sgd-saindo .sgd-sug {
    opacity: 0;
}

@keyframes sgdLeitura {
    0% { top: -24px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

@keyframes sgdPulsa {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .9); }
    100% { box-shadow: 0 0 0 7px rgba(212, 175, 55, 0); }
}

@keyframes sgdFluxo {
    to { background-position: 12px 0; }
}

@keyframes sgdFluxoVertical {
    to { background-position: 0 12px; }
}

@keyframes sgdIa {
    50% {
        box-shadow: 0 0 0 6px rgba(241, 196, 15, .18), 0 0 18px rgba(241, 196, 15, .6);
        transform: scale(1.06);
    }
}

@keyframes sgdEsqueleto {
    to { background-position: -200% 0; }
}

@keyframes sgdSino {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(14deg); }
    40% { transform: rotate(-12deg); }
    60% { transform: rotate(8deg); }
    80% { transform: rotate(-4deg); }
}

/* Celular: publicação em cima, IA no meio e sugestão embaixo */
@container (max-width: 519px) {
    .sgd-palco {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
    }

    .sgd-ponte {
        flex-direction: row;
        gap: 8px;
        height: 46px;
    }

    .sgd-ponte::before {
        top: 4px;
        right: auto;
        bottom: 4px;
        left: 50%;
        width: 2px;
        height: auto;
        margin: 0 0 0 -1px;
        background: repeating-linear-gradient(180deg, rgba(241, 196, 15, .8) 0 6px, transparent 6px 12px);
        background-size: 2px 12px;
    }

    .sgd-pensando .sgd-ponte::before {
        animation-name: sgdFluxoVertical;
    }

    .sgd-ponte-txt {
        position: absolute;
        left: calc(50% + 24px);
    }

    .sgd-texto {
        height: 98px;
    }
}

/* Celular bem estreito (320px): só Prazo e Vencimento na linha de detalhes */
@container (max-width: 300px) {
    .sgd-detalhes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sgd-det-foro {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sgd-campo:not(.sgd-visivel) .sgd-valor,
    .sgd-campo:not(.sgd-visivel) .sgd-sub,
    .sgd-pensando .sgd-ia,
    .sgd-pensando .sgd-ponte::before,
    .sgd-entrou .sgd-nova i {
        animation: none;
    }
}
