/* =====================================================
   Admin v3 — Editor de blog (/blog/novo, /blog/editar/{id})
   Layout 3 colunas (editor / preview / metadata) conforme
   design_handoff_responsive/page-editor.jsx
   ===================================================== */

.editor-page {
    max-width: var(--content-max);
    margin: 0 auto;
    padding-bottom: var(--s-7);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

/* ---------- Header com breadcrumb + status + actions ---------- */
.editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
    padding: var(--s-3) 0 var(--s-2);
    border-bottom: 1px solid var(--line);
}

.editor-header__left {
    flex: 1;
    min-width: 0;
}

.editor-header__breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    margin-bottom: var(--s-2);
}

.editor-header__breadcrumb a {
    color: var(--text-mute);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease-out);
}

.editor-header__breadcrumb a:hover {
    color: var(--text);
    text-decoration: underline;
}

.editor-header__breadcrumb > span:last-child {
    color: var(--text);
    font-weight: var(--fw-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 480px;
}

.editor-header__title-row {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.editor-header__eyebrow {
    font-size: var(--text-2xs);
    color: var(--terra);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: var(--fw-semibold);
    margin: 0;
}

.editor-header__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin: 0;
    letter-spacing: -0.01em;
    line-height: var(--lh-tight);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

@media (min-width: 1024px) {
    .editor-header__title { font-size: var(--text-3xl); }
}

.editor-header__status {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    flex-shrink: 0;
}

.editor-header__saved {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ok);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
}

.editor-header__actions {
    display: flex;
    gap: var(--s-2);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ---------- Alertas ---------- */
.editor-page__alert { margin-bottom: 0; }
.editor-page__alert--ok {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: var(--ok);
}

/* ---------- Tabs (mobile only) ---------- */
.editor-tabs {
    display: flex;
    gap: var(--s-1);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--s-3);
}

@media (min-width: 1024px) {
    .editor-tabs { display: none; }
}

.editor-tabs__tab {
    flex: 1;
    background: transparent;
    border: 0;
    padding: var(--s-3) var(--s-2);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--text-mute);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    min-height: 44px;
}

.editor-tabs__tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ---------- Grid 3 colunas ---------- */
.editor-grid {
    display: grid;
    gap: var(--s-4);
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .editor-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px;
    }
}

@media (min-width: 1440px) {
    .editor-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px;
    }
}

/* Mobile: só mostra a coluna ativa */
.editor-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

@media (max-width: 1023px) {
    .editor-col { display: none; }
    .editor-col.is-active { display: flex; }
}

.editor-col__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-2);
    padding: 0 var(--s-1);
}

.editor-col__eyebrow {
    font-size: var(--text-2xs);
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: var(--fw-semibold);
}

/* ---------- Coluna 1: Editor ---------- */
.editor-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-mini-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--text-xs);
    color: var(--text-mute);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.editor-mini-label--inline {
    flex-direction: row;
    align-items: center;
    gap: var(--s-2);
    text-transform: none;
    letter-spacing: normal;
    font-size: var(--text-sm);
    color: var(--text);
}

.editor-title-input {
    width: 100%;
    border: 0;
    background: transparent;
    padding: var(--s-2) 0;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--fw-semibold);
    color: var(--text);
    line-height: var(--lh-tight);
    letter-spacing: -0.015em;
}

.editor-title-input::placeholder {
    color: var(--text-faint);
    font-weight: var(--fw-regular);
}

.editor-title-input:focus-visible { outline: none; }

.editor-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    align-items: center;
    justify-content: space-between;
    padding: var(--s-2) 0;
    border-bottom: 1px solid var(--line);
}

.editor-slug {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.editor-slug-input {
    flex: 1;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 0 var(--s-2);
    background: var(--bg-app);
    color: var(--text-mute);
    font-size: var(--text-xs);
}

.editor-slug__status {
    font-size: var(--text-xs);
    white-space: nowrap;
}

.editor-slug__status--ok { color: var(--ok); }
.editor-slug__status--bad { color: var(--bad); }

.editor-stats {
    display: flex;
    gap: var(--s-2);
    align-items: center;
    font-size: var(--text-xs);
    color: var(--text-mute);
}

.editor-stats__item strong { color: var(--text); }
.editor-stats__sep { color: var(--text-faint); }

.editor-body {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

.editor-body__container { width: 100%; min-width: 0; min-height: 480px; }

.editor-images {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-3);
}

.editor-images > summary {
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--text-mute);
}

.editor-images > summary:hover { color: var(--text); }

.editor-images__grid {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-top: var(--s-3);
}

.editor-images__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
}

.editor-images__upload {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* ---------- Coluna 2: Preview ao vivo ---------- */
.editor-col--preview {
    position: relative;
}

@media (min-width: 1024px) {
    .editor-col--preview {
        position: sticky;
        top: calc(var(--topbar-h) + var(--s-3));
        align-self: flex-start;
        max-height: calc(100vh - var(--topbar-h) - var(--s-5));
        overflow: hidden;
    }
}

.editor-preview {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    overflow-y: auto;
    max-height: calc(100vh - var(--topbar-h) - var(--s-7));
    box-shadow: var(--shadow-sm);
}

.editor-preview__cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--r-md);
    margin-bottom: var(--s-4);
}

.editor-preview__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin: 0 0 var(--s-2);
    letter-spacing: -0.015em;
    line-height: var(--lh-tight);
}

.editor-preview__meta {
    font-size: var(--text-xs);
    margin: 0 0 var(--s-3);
}

.editor-preview__excerpt {
    font-size: var(--text-md);
    color: var(--text);
    margin: 0 0 var(--s-4);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--line);
    line-height: var(--lh-snug);
    font-style: italic;
}

.editor-preview__placeholder {
    font-size: var(--text-sm);
    text-align: center;
    padding: var(--s-7) var(--s-4);
}

/* Tipografia do conteúdo renderizado (reset estilos do post público) */
.editor-preview__body {
    font-size: var(--text-md);
    line-height: var(--lh-base);
    color: var(--text);
}

.editor-preview__body h1,
.editor-preview__body h2,
.editor-preview__body h3 {
    font-family: var(--font-display);
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin: var(--s-5) 0 var(--s-2);
    line-height: var(--lh-snug);
}

.editor-preview__body h1 { font-size: var(--text-2xl); }
.editor-preview__body h2 { font-size: var(--text-xl); }
.editor-preview__body h3 { font-size: var(--text-lg); }

.editor-preview__body p { margin: 0 0 var(--s-3); }

.editor-preview__body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.editor-preview__body blockquote {
    margin: var(--s-4) 0;
    padding: var(--s-3) var(--s-4);
    border-left: 3px solid var(--terra);
    background: var(--bg-sunken);
    border-radius: var(--r-sm);
    color: var(--text-mute);
    font-style: italic;
}

.editor-preview__body ul,
.editor-preview__body ol {
    margin: 0 0 var(--s-3);
    padding-left: var(--s-5);
}

.editor-preview__body li { margin-bottom: 4px; }

.editor-preview__body code {
    background: var(--bg-sunken);
    padding: 1px 6px;
    border-radius: var(--r-xs);
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid var(--line);
}

.editor-preview__body pre {
    background: var(--bg-sunken);
    padding: var(--s-3);
    border-radius: var(--r-md);
    overflow-x: auto;
    margin: var(--s-3) 0;
}

.editor-preview__body pre code {
    background: transparent;
    border: 0;
    padding: 0;
}

.editor-preview__body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    margin: var(--s-3) 0;
}

.editor-preview__body hr {
    border: 0;
    height: 1px;
    background: var(--line);
    margin: var(--s-5) 0;
}

.editor-preview__body strong { font-weight: var(--fw-semibold); }

/* ---------- Coluna 3: Metadata ---------- */
.editor-col--meta { gap: var(--s-3); }

@media (min-width: 1024px) {
    .editor-col--meta {
        position: sticky;
        top: calc(var(--topbar-h) + var(--s-3));
        align-self: flex-start;
        max-height: calc(100vh - var(--topbar-h) - var(--s-5));
        overflow-y: auto;
    }
}

.editor-meta-card {
    display: flex;
    flex-direction: column;
}

.editor-meta-card__body {
    padding: 0 var(--s-4) var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.editor-meta-card__sub {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding-top: var(--s-3);
    border-top: 1px dashed var(--line);
}

.editor-cover-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
}

.editor-cover-empty {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--r-sm);
    border: 1px dashed var(--line-strong);
    background: var(--bg-sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
}

/* Histórico */
.editor-history {
    list-style: none;
    margin: 0 0 var(--s-2);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.editor-history__item {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2);
    background: var(--bg-sunken);
    border-radius: var(--r-sm);
    font-size: var(--text-xs);
}

.editor-history__item > div {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--s-2);
}

.editor-history__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--text-mute);
    flex-shrink: 0;
}

.editor-history__dot--current { background: var(--accent); }

/* Code/code de placeholder */
.editor-meta-card__body code {
    background: var(--bg-app);
    padding: 1px 5px;
    border-radius: var(--r-xs);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    border: 1px solid var(--line);
}
