/* Tela de estudo: PDF + anotações (nova / editar / ver sessão) */
body.layout-estudo {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.layout-estudo > .navbar { margin-bottom: 0 !important; flex: 0 0 auto; }
.estudo-main { flex: 1 1 auto; min-height: 0; padding: 0; }

.estudo {
    --largura-pdf: 55%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
}
.estudo-pdf, .estudo-divisor, .estudo-abas { display: none; }
.estudo-notas { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.estudo-notas-miolo { max-width: 960px; margin: 0 auto; padding: 24px 16px 40px; }
.estudo .card:hover { transform: none; }

.estudo-escolha {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.estudo-escolha label { font-weight: 600; margin: 0; white-space: nowrap; }
.estudo-escolha select { flex: 1 1 220px; max-width: 100%; }

.estudo-pdf iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--fundo); }

/* citação recém-chegada no editor */
.ck-editor.recebeu { animation: recebeu 1s ease; border-radius: 6px; }
@keyframes recebeu { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--caneta) 45%, transparent); } }

/* ---------- com PDF, telas largas: lado a lado ---------- */
@media (min-width: 992px) {
    .estudo.com-pdf { grid-template-columns: var(--largura-pdf) 10px minmax(320px, 1fr); }
    .estudo.com-pdf .estudo-pdf { display: block; min-width: 0; }
    .estudo.com-pdf .estudo-divisor {
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: col-resize;
        background: var(--borda);
        touch-action: none;
    }
    .estudo-divisor span { width: 4px; height: 44px; border-radius: 4px; background: var(--suave); }
    .estudo-divisor:hover, .estudo.arrastando .estudo-divisor { background: var(--pontilhado); }
    .estudo.arrastando iframe { pointer-events: none; }
    .estudo.arrastando { user-select: none; cursor: col-resize; }
    .estudo.com-pdf .estudo-notas-miolo { max-width: 820px; padding: 16px 18px 32px; }
    .estudo.com-pdf .card-header h2 { font-size: 1.35rem; }
}

/* ---------- com PDF, celular e tablet em pé: abas ---------- */
@media (max-width: 991.98px) {
    .estudo.com-pdf { grid-template-rows: minmax(0, 1fr) auto; }
    .estudo.com-pdf .estudo-abas {
        display: flex;
        gap: 6px;
        padding: 6px 8px max(6px, env(safe-area-inset-bottom));
        background: var(--barra);
    }
    .estudo-abas button {
        flex: 1;
        padding: 10px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #c7cbd6;
        font-weight: 600;
    }
    .estudo[data-aba="pdf"] .estudo-abas [data-aba="pdf"],
    .estudo[data-aba="notas"] .estudo-abas [data-aba="notas"] { background: var(--fundo); color: var(--texto); }
    .estudo.com-pdf[data-aba="pdf"] .estudo-pdf { display: block; }
    .estudo.com-pdf[data-aba="pdf"] .estudo-notas { display: none; }
    .estudo-notas-miolo { padding: 12px 10px 24px; }
}
