/* ══════════════════════════════════════
   MÓDULO — CONTEÚDOS  v3
══════════════════════════════════════ */

/* ── Loading / vazio ── */
.ct-loading, .ct-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 360px; gap: 10px;
    color: var(--text-3); font-size: 13px;
    text-align: center;
    animation: fadeUp .2s ease both;
}
.ct-empty-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--text-3); margin-bottom: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ct-spin { animation: spin .8s linear infinite; display: inline-block; }

/* ══════════════════════════════════════
   GRID
══════════════════════════════════════ */
.ct-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    animation: fadeUp .18s ease both;
}
@media (max-width: 480px) { .ct-grid { gap: 1px; } }

/* ── Card ── */
.ct-card {
    position: relative;
    aspect-ratio: 3 / 4;
    background: var(--surface-3);
    overflow: hidden;
    cursor: pointer;
    outline: none;
}
.ct-card:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.ct-card:active { opacity: .92; }

.ct-card-thumb,
.ct-card-video-thumb {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .35s ease;
}
.ct-card:hover .ct-card-thumb,
.ct-card:hover .ct-card-video-thumb { transform: scale(1.04); }

.ct-card-no-media {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-4); font-size: 24px;
}

/* Overlay hover */
.ct-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 50%,
        rgba(0,0,0,.42) 100%
    );
    opacity: 0; transition: opacity .2s ease;
    display: flex; align-items: center; justify-content: center;
}
.ct-card:hover .ct-card-overlay { opacity: 1; }
.ct-card-overlay i {
    font-size: 30px; color: #fff;
    filter: drop-shadow(0 1px 6px rgba(0,0,0,.5));
    transform: scale(.85);
    transition: transform .2s ease;
}
.ct-card:hover .ct-card-overlay i { transform: scale(1); }

/* Badge de tipo */
.ct-card-type {
    position: absolute; top: 7px; right: 8px;
}
.ct-card-type i {
    font-size: 17px; color: rgba(255,255,255,.95);
    filter: drop-shadow(0 1px 4px rgba(0,0,0,.55));
}

/* ══════════════════════════════════════
   MODAL — backdrop
══════════════════════════════════════ */
.ct-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(10,9,8,.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: ct-fade-in .16s ease both;
}
@keyframes ct-fade-in { from { opacity:0; } to { opacity:1; } }

/* ── Layout interno do modal (desktop: lado a lado) ── */
.ct-modal {
    position: relative;
    width: 100%;
    max-width: 860px;              /* lado a lado no desktop */
    max-height: calc(100dvh - 48px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.08),
        0 24px 60px rgba(0,0,0,.28),
        0 8px 20px rgba(0,0,0,.12);
    animation: ct-modal-in .22s cubic-bezier(.22,1,.36,1) both;
    display: flex;
    flex-direction: row;           /* ← lado a lado */
}
@keyframes ct-modal-in {
    from { opacity:0; transform:scale(.97) translateY(8px); }
    to   { opacity:1; transform:scale(1)   translateY(0);   }
}

/* ── Coluna da mídia (esquerda) ── */
.ct-modal-media-wrap {
    flex: 0 0 auto;
    width: 54%;                    /* ~proporção 3×4 dentro do modal */
    aspect-ratio: 3 / 4;
    background: #0a0908;
    position: relative;
    overflow: hidden;
    align-self: stretch;
    max-height: calc(100dvh - 48px);
}

/* Quando a mídia for mais alta que a tela, limita e corta */
@media (max-height: 700px) {
    .ct-modal-media-wrap { width: 48%; }
}

.ct-modal-media-wrap > img,
.ct-modal-media-wrap > video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Coluna do painel (direita) ── */
.ct-modal-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border);
}

/* Topo do painel: título + fechar */
.ct-modal-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 10px;
}

.ct-modal-panel-title {
    font-size: 13px; font-weight: 600;
    color: var(--text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.ct-modal-panel-title span {
    font-weight: 400; color: var(--text-3);
    font-size: 11.5px; margin-left: 6px;
}

/* ── Botão fechar ── */
.ct-modal-close {
    flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer; color: var(--text-2); font-size: 14px;
    transition: all var(--t);
    z-index: 20;
}
.ct-modal-close:hover {
    background: var(--surface-2);
    border-color: var(--border-mid);
    color: var(--text-1);
}

/* ── Scroll do painel ── */
.ct-modal-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    -webkit-overflow-scrolling: touch;
}
.ct-modal-scroll::-webkit-scrollbar { width: 4px; }
.ct-modal-scroll::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 99px; }

/* ── Corpo do painel ── */
.ct-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Seção ── */
.ct-modal-section { display: flex; flex-direction: column; gap: 8px; }

.ct-modal-section-label {
    font-size: 9.5px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-4);
}

.ct-modal-caption {
    font-size: 12.5px; line-height: 1.75;
    color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}
.ct-modal-caption-empty {
    font-size: 12.5px; color: var(--text-4); font-style: italic;
}

/* ── Status badge ── */
.ct-modal-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600;
    padding: 3px 9px; border-radius: 99px;
    border: 1px solid;
    letter-spacing: 0.01em;
    align-self: flex-start;
}
.ct-modal-status.analise   { background: #FEFBF2; border-color: #E8D9A4; color: #7A6220; }
.ct-modal-status.aprovado  { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.ct-modal-status.reprovado { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.ct-modal-status.publicado { background: #EEF3FB; border-color: #B4C9EC; color: #234E8C; }
.ct-modal-status.agendado  { background: #F4F0FB; border-color: #C8BAF0; color: #4E389E; }
.ct-modal-status.planej    { background: var(--surface-3); border-color: var(--border); color: var(--text-2); }
.ct-modal-status.default   { background: var(--surface-3); border-color: var(--border); color: var(--text-3); }

/* ── Linhas de informação ── */
.ct-modal-info-row {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.ct-modal-info-row:last-child { border-bottom: none; }
.ct-modal-info-key { color: var(--text-3); font-weight: 500; }
.ct-modal-info-val { color: var(--text-1); font-weight: 500; display: flex; align-items: center; gap: 4px; }

/* ── Ações ── */
.ct-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 2px;
}

.ct-action-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; height: 38px;
    font-family: var(--font); font-size: 12.5px; font-weight: 600;
    border-radius: var(--radius-md); border: 1px solid;
    cursor: pointer; transition: all var(--t);
    width: 100%; letter-spacing: 0.01em;
}
.ct-action-btn i { font-size: 15px; }

.ct-action-btn--aprovar {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}
.ct-action-btn--aprovar:hover { background: #DDF4E9; border-color: #8FCCA9; }

.ct-action-btn--recusar {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}
.ct-action-btn--recusar:hover { background: #FAE2E0; border-color: #D8978F; }

.ct-action-btn--editar {
    background: var(--surface);
    border-color: var(--border-mid);
    color: var(--text-2);
}
.ct-action-btn--editar:hover { background: var(--surface-3); color: var(--text-1); }

.ct-action-btn--download {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.ct-action-btn--download:hover { background: #000; border-color: #000; }

/* ══════════════════════════════════════
   CARROSSEL
══════════════════════════════════════ */
.ct-carousel {
    position: absolute; inset: 0;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    cursor: grab;
}
.ct-carousel:active { cursor: grabbing; }

.ct-carousel-track {
    display: flex;
    height: 100%;
    width: 100%;
    will-change: transform;
}

.ct-carousel-slide {
    flex: 0 0 100%;
    width: 100%; height: 100%;
    position: relative;
    overflow: hidden;
    background: #0a0908;
}

.ct-carousel-slide img,
.ct-carousel-slide video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Setas */
.ct-carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px;
    background: rgba(255,255,255,.9);
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 13px; color: var(--text-1);
    z-index: 10; transition: all var(--t);
    box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.ct-carousel-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.ct-carousel-arrow--prev { left: 10px; }
.ct-carousel-arrow--next { right: 10px; }
.ct-carousel-arrow:disabled { opacity: 0; pointer-events: none; }

/* Dots */
.ct-carousel-dots {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 4px; z-index: 10;
}
.ct-carousel-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,.4);
    transition: all .2s ease;
    cursor: pointer;
}
.ct-carousel-dot.active {
    background: #fff;
    width: 16px; border-radius: 99px;
}

/* ── Contador slide (ex: 2 / 6) ── */
.ct-carousel-counter {
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(4px);
    color: rgba(255,255,255,.92);
    font-size: 11px; font-weight: 500;
    padding: 3px 9px;
    border-radius: 99px;
    z-index: 10;
    pointer-events: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ══════════════════════════════════════
   MOBILE — scroll único, mídia rola junto
══════════════════════════════════════ */
@media (max-width: 640px) {

    .ct-modal-backdrop {
        padding: 0;
        align-items: flex-start;
    }

    /* Modal ocupa a tela toda e vira um scroll único */
    .ct-modal {
        max-width: 100%;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        flex-direction: column;
        overflow-y: auto;          /* scroll único aqui */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Painel lateral vira coluna única abaixo da mídia */
    .ct-modal-panel {
        flex: none;                /* não estica — altura natural */
        border-left: none;
        border-top: 1px solid var(--border);
        overflow: visible;         /* sem scroll próprio */
    }

    /* Mídia no fluxo — rola junto com tudo */
    .ct-modal-media-wrap {
        width: 100%;
        flex-shrink: 0;
        aspect-ratio: 3 / 4;      /* 3×4 exato */
        max-height: none;
        align-self: auto;
        position: relative;
        overflow: hidden;
    }

    /* Scroll do painel desativado — o modal já scrollou */
    .ct-modal-scroll {
        flex: none;
        overflow: visible;
        height: auto;
    }

    .ct-modal-panel-header { padding: 13px 14px 12px; }
    .ct-modal-body { padding: 14px 14px 40px; gap: 16px; }
}

/* Fechar flutuante — só aparece no mobile */
.ct-modal-close-float {
    display: none;
}

@media (max-width: 640px) {
    .ct-modal-close-float {
        display: flex;
        position: absolute;
        top: 12px; right: 12px;
        z-index: 20;
        width: 32px; height: 32px;
        align-items: center; justify-content: center;
        background: rgba(0,0,0,.48);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: none; border-radius: 50%;
        cursor: pointer; color: #fff; font-size: 15px;
        transition: background var(--t);
    }
    .ct-modal-close-float:hover { background: rgba(0,0,0,.72); }

    /* Esconde o fechar do painel no mobile (está acima do scroll) */
    .ct-modal-close { display: none; }
}

/* ── Animações ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}



/* ══════════════════════════════════════
   CONFIRM DIALOG
══════════════════════════════════════ */
.ct-confirm-backdrop {
    position: fixed; inset: 0;
    background: rgba(10,9,8,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1100;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: ct-fade-in .14s ease both;
}

.ct-confirm-box {
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%; max-width: 340px;
    box-shadow: 0 16px 48px rgba(0,0,0,.22);
    display: flex; flex-direction: column; gap: 10px;
    animation: ct-modal-in .2s cubic-bezier(.22,1,.36,1) both;
}

.ct-confirm-titulo {
    font-size: 14px; font-weight: 700;
    color: var(--text-1); letter-spacing: -0.01em;
}

.ct-confirm-texto {
    font-size: 12.5px; line-height: 1.65;
    color: var(--text-2);
}

.ct-confirm-btns {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 6px;
}

.ct-confirm-btn {
    height: 34px; padding: 0 16px;
    font-family: var(--font); font-size: 12.5px; font-weight: 600;
    border-radius: var(--radius-md); border: 1px solid var(--border-mid);
    cursor: pointer; transition: all var(--t);
}

.ct-confirm-cancelar {
    background: var(--surface-3); color: var(--text-2);
}
.ct-confirm-cancelar:hover { background: var(--surface-2); color: var(--text-1); }

.ct-confirm-ok {
    color: #fff;
    filter: brightness(1);
}
.ct-confirm-ok:hover { filter: brightness(.88); }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.ct-toast {
    position: fixed; bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 10px 20px;
    border-radius: 99px;
    font-size: 12.5px; font-weight: 600;
    white-space: nowrap;
    z-index: 1200;
    opacity: 0;
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.ct-toast--sucesso {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}
.ct-toast--erro {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}
.ct-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════
   EDITOR DE LEGENDA — inline
   Adicione ao final de conteudo.css
══════════════════════════════════════ */

.ct-caption-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeUp .15s ease both;
}

.ct-caption-textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    font-family: var(--font);
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--text-1);
    background: var(--surface-3);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--t), box-shadow var(--t);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.ct-caption-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.ct-caption-textarea::placeholder { color: var(--text-4); }

.ct-caption-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ct-caption-counter {
    font-size: 11px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.ct-caption-editor-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.ct-caption-btn {
    height: 30px;
    padding: 0 13px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-mid);
    cursor: pointer;
    transition: all var(--t);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ct-caption-btn--cancel {
    background: var(--surface-3);
    color: var(--text-2);
}
.ct-caption-btn--cancel:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.ct-caption-btn--save {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.ct-caption-btn--save:hover {
    filter: brightness(.88);
}
.ct-caption-btn--save:disabled {
    opacity: .55;
    cursor: not-allowed;
    filter: none;
}
.ct-caption-btn--save i { font-size: 13px; }