/*
 * Layout general de la ventana: barra de título, cinta, área de trabajo
 * (miniaturas + lienzo + notas) y barra de estado.
 */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: grid;
    grid-template-rows: var(--ppt-titlebar-h) auto 1fr var(--ppt-statusbar-h);
    font-family: var(--ppt-font-ui);
    font-size: var(--ppt-font-size-ui);
    color: var(--ppt-text);
    background: var(--ppt-ribbon-bg);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

/* ---------- Barra de título + QAT ---------- */

.titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    background: var(--ppt-titlebar-bg);
}

.titlebar__left,
.titlebar__right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.titlebar__right { justify-content: flex-end; }

.titlebar__icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    margin: 0 6px 0 2px;
    color: var(--ppt-brand);
}

/* Icono real de la aplicación (public/assets/icon/, generado por
   scripts/make-icons.py): se pide el de 64 px y se pinta a 20 para que salga
   nítido en pantallas HiDPI; cuesta 2,5 KB. Si el PNG no cargara, el hueco
   conserva su tamaño y la barra no salta. */
.titlebar__icon img {
    width: 20px;
    height: 20px;
    display: block;
}

.titlebar__center {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--ppt-font-size-ui);
    color: var(--ppt-text-2);
    white-space: nowrap;
}

.titlebar__sep { color: var(--ppt-text-disabled); }
.titlebar__saved { color: var(--ppt-text-muted); }

.titlebar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--ppt-radius);
    color: var(--ppt-text-2);
}

.titlebar__btn:hover { background: var(--ppt-hover); }

/* Botón «Compartir» de la barra de título (como en PowerPoint 2024). */
.titlebar__share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    margin-right: 2px;
    border-radius: var(--ppt-radius);
    font-size: var(--ppt-font-size-ui);
    color: var(--ppt-text-2);
}

.titlebar__share:hover { background: var(--ppt-hover); }
.titlebar__share[hidden] { display: none; }

.titlebar__account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--ppt-brand);
    color: #FFFFFF;
    font-size: var(--ppt-font-size-ui-sm);
    font-weight: 600;
    user-select: none;
}

/* Barra de herramientas de acceso rápido */
.qat {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--ppt-qat-bg);
    border-radius: var(--ppt-radius);
}

.qat__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--ppt-radius);
    color: var(--ppt-text-2);
}

.qat__btn:hover:not(:disabled) { background: var(--ppt-hover); }
.qat__btn:active:not(:disabled) { background: var(--ppt-pressed); }
.qat__btn:disabled { color: var(--ppt-text-disabled); cursor: default; }

/* ---------- Área de trabajo ---------- */

.workspace {
    display: grid;
    grid-template-columns: var(--ppt-thumbs-w) 4px 1fr;
    min-height: 0;
    background: var(--ppt-panel-bg);
    border-top: 1px solid var(--ppt-border-soft);
}

.workspace.is-thumbs-collapsed { grid-template-columns: 0 4px 1fr; }

.thumbs {
    min-width: 0;
    overflow: hidden;
    background: var(--ppt-panel-bg);
}

.thumbs__list {
    height: 100%;
    padding: 8px 6px;
    overflow-y: auto;
    overflow-x: hidden;
    outline: none;
}

.thumbs-splitter,
.notes-splitter {
    background: var(--ppt-border-soft);
}

.thumbs-splitter { cursor: col-resize; }
.notes-splitter { cursor: row-resize; height: 4px; }

.thumbs-splitter:hover,
.notes-splitter:hover { background: var(--ppt-divider); }

.stage {
    display: grid;
    grid-template-rows: 1fr 4px auto;
    min-width: 0;
    min-height: 0;
}

.stage__canvas {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: auto;
    background: var(--ppt-stage-bg);
    outline: none;
}

/* ---------- Panel de notas ---------- */

.notes {
    display: flex;
    flex-direction: column;
    height: var(--ppt-notes-h);
    background: var(--ppt-panel-bg);
}

.notes.is-collapsed { height: 0; overflow: hidden; }

.notes__header {
    padding: 4px 12px 0;
    color: var(--ppt-text-muted);
    font-size: var(--ppt-font-size-ui-sm);
}

.notes__input {
    flex: 1;
    min-height: 0;
    padding: 4px 12px 8px;
    border: 0;
    resize: none;
    font-family: var(--ppt-font-ui);
    font-size: 13px;
    color: var(--ppt-text);
    background: transparent;
    outline: none;
}

.notes__input::placeholder { color: var(--ppt-text-disabled); }

/* ---------- Barra de estado ---------- */

.statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 12px;
    background: var(--ppt-statusbar-bg);
    border-top: 1px solid var(--ppt-border-soft);
    color: var(--ppt-text-2);
    font-size: var(--ppt-font-size-ui-sm);
    user-select: none;
}

.statusbar__left,
.statusbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.statusbar__item { white-space: nowrap; }

.statusbar__views { display: flex; gap: 2px; }

.statusbar__views button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    border-radius: var(--ppt-radius-sm);
    color: var(--ppt-text-2);
}

.statusbar__views button:hover { background: var(--ppt-hover); }
.statusbar__views button.is-active { background: var(--ppt-hover-solid); color: var(--ppt-brand); }

.statusbar__zoom {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--ppt-radius-sm);
    font-size: 14px;
    line-height: 1;
}

.zoom__btn:hover { background: var(--ppt-hover); }

.zoom__slider {
    width: 110px;
    height: 16px;
    accent-color: var(--ppt-text-muted);
    cursor: pointer;
}

.zoom__value {
    min-width: 46px;
    padding: 2px 4px;
    border-radius: var(--ppt-radius-sm);
    text-align: right;
    white-space: nowrap;
}

.zoom__value:hover { background: var(--ppt-hover); }

.zoom__fit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 20px;
    border-radius: var(--ppt-radius-sm);
    color: var(--ppt-text-2);
}

.zoom__fit:hover { background: var(--ppt-hover); }

/* ---------- Capa flotante ---------- */

.overlay-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.overlay-root > * { pointer-events: auto; }

/* ---------- Nombre de la presentación editable (ui/docname.js) ---------- */

/*
 * El rótulo no tenía estilo propio: ahora es un objetivo de clic, así que se le
 * dan la mano, el resalte y el mismo radio que a los demás botones de la barra.
 * Las métricas son lo delicado: el <input> sustituye al <span> en el sitio, y
 * si sus cajas no miden lo mismo la barra de título pega un salto al entrar en
 * edición. Por eso 2px 7px + 1px de borde = los 3px 8px del rótulo.
 */
.titlebar__name {
    max-width: 34vw;
    padding: 3px 8px;
    border-radius: var(--ppt-radius);
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.titlebar__name:hover { background: var(--ppt-hover); }

/* Accesible con teclado: el rótulo es role="button" tabindex="0". */
#doc-name:focus-visible {
    outline: 2px solid var(--ppt-focus);
    outline-offset: 1px;
    background: var(--ppt-hover);
}

/* Campo de edición en el sitio; hereda la tipografía de la barra (12px). */
.doc-name-input {
    font: inherit;
    min-width: 180px;
    max-width: 34vw;
    padding: 2px 7px;
    border: 1px solid var(--ppt-accent);
    border-radius: var(--ppt-radius);
    background: var(--ppt-titlebar-bg);
    color: var(--ppt-text);
    outline: none;
    user-select: text;
}

.doc-name-input:focus { box-shadow: 0 0 0 2px rgba(210, 71, 38, 0.22); }

/* Solo lectura (enlace «ver», vista de administración): ni mano ni resalte. */
.doc-name-readonly { cursor: default; }
.doc-name-readonly:hover { background: transparent; }
