/* OfficeCli HTML Preview Stylesheet */
/* Dynamic variables --slide-design-w, --slide-design-h, --slide-aspect are set inline */

:root {
    --sidebar-w: 180px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #1a1a2e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #12122a;
    border-right: 1px solid #2a2a4a;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-title {
    color: #888;
    font-size: 11px;
    text-align: center;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thumb {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 3px;
    padding: 2px;
    transition: border-color 0.15s;
    position: relative;
}
.thumb:hover { border-color: #555; }
.thumb.active { border-color: #5b9bd5; }
.thumb-inner {
    width: 100%;
    aspect-ratio: var(--slide-aspect);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    pointer-events: none;
}
.thumb-slide {
    width: var(--slide-design-w);
    height: var(--slide-design-h);
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    background: white;
}
.thumb-num {
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: #888;
    font-size: 10px;
}

/* ===== Main area ===== */
.main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 24px;
    scroll-behavior: smooth;
}
.file-title {
    display: none;
}
.slide-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.slide-label {
    display: none;
}
.slide-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}
.slide {
    width: var(--slide-design-w);
    height: var(--slide-design-h);
    position: relative;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border-radius: 2px;
    transform-origin: center top;
    flex-shrink: 0;
}

/* ===== Speaker notes (R8-bt-3) ===== */
.slide-notes {
    width: var(--slide-design-w);
    margin-top: 8px;
    padding: 10px 14px;
    background: #1f1f1f;
    color: #ddd;
    border-left: 3px solid #888;
    border-radius: 2px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12pt;
    line-height: 1.4;
    box-sizing: border-box;
}
.slide-notes[dir="rtl"] {
    border-left: none;
    border-right: 3px solid #888;
    text-align: right;
}
.slide-notes-label {
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 4px;
}
.slide-notes-body div { margin: 2px 0; }

/* ===== Page counter ===== */
.page-counter {
    position: fixed;
    bottom: 16px;
    right: 24px;
    background: rgba(0,0,0,0.6);
    color: #ccc;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* ===== Fullscreen ===== */
body.fullscreen .sidebar { display: none; }
body.fullscreen .main {
    padding: 0;
    gap: 0;
    overflow: hidden;
    scroll-behavior: auto;
}
body.fullscreen .file-title { display: none; }
body.fullscreen .slide-container {
    width: 100vw;
    height: 100vh;
    justify-content: center;
    display: none;
    gap: 0;
}
body.fullscreen .slide-container.fs-active { display: flex; }
body.fullscreen .slide-label { color: #444; font-size: 11px; }
body.fullscreen .slide {
    box-shadow: none;
    border-radius: 0;
}

/* ===== Sidebar toggle button ===== */
.sidebar-toggle {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 200;
    background: rgba(30,30,60,0.85);
    color: #aaa;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    display: none;
    opacity: 0;
    transition: opacity 0.25s;
}
.sidebar-toggle:hover { color: #fff; border-color: #888; }
/* Hover zone: top-left 60x60px area reveals the button */
.toggle-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    z-index: 199;
    display: none;
}
.toggle-zone:hover + .sidebar-toggle,
.sidebar-toggle:hover {
    opacity: 1;
}
body.sidebar-hidden .sidebar { display: none; }
body.sidebar-hidden .sidebar-toggle { left: 8px; }
/* Headless / automated browser — hide sidebar, toggle, and page counter */
html.headless .sidebar,
html.headless .sidebar-toggle,
html.headless .toggle-zone,
html.headless .page-counter { display: none !important; }

/* ===== Narrow viewport: auto-hide sidebar ===== */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .sidebar-toggle { display: block; }
    .toggle-zone { display: block; }
    body.sidebar-visible .sidebar { display: flex; position: fixed; top: 0; left: 0; bottom: 0; z-index: 150; }
    body.sidebar-visible .sidebar-toggle { left: calc(var(--sidebar-w) + 8px); opacity: 1; }
    body.sidebar-visible .toggle-zone { display: none; }
}

/* ===== Elements ===== */
.shape {
    position: absolute;
    overflow: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.shape.has-fill {
    overflow: hidden;
}
.shape-text {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.shape-text.valign-top { justify-content: flex-start; }
.shape-text.valign-center { justify-content: center; }
.shape-text.valign-bottom { justify-content: flex-end; }
/* anchorCtr="1": shrink-wrap paragraphs so align-items:center can center the
   text block horizontally (a width:100% .para would otherwise fill the frame). */
.shape-text.anchor-ctr .para { width: auto; max-width: 100%; }
/* Vertical text (writing-mode): the flex main axis is horizontal, so valign-*
   (justify-content) anchors the text column horizontally — matching PowerPoint's
   anchor="ctr". A width:100% .para would fill that axis and defeat the centering,
   so shrink-wrap the paragraphs like anchor-ctr does. */
.shape-text.has-vert-text .para { width: auto; max-width: 100%; }
.para { width: 100%; line-height: 1; }
.picture { position: absolute; overflow: hidden; }
.picture img { width: 100%; height: 100%; object-fit: fill; }
/* overflow:visible (not hidden) — with border-collapse:collapse the
   rightmost/bottommost cell's outer 1pt border sits exactly on the
   container edge; overflow:hidden would clip its outer half. Cell
   content overflow is already handled by .slide-table td below. */
.table-container { position: absolute; overflow: visible; }
.slide-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.slide-table td { padding: 4px 6px; vertical-align: top; overflow: hidden; font-size: 10pt; color: inherit; }
.connector { position: absolute; pointer-events: none; }
/* The connector's bounding box is a large rectangle for any diagonal/bent line,
   so the box stays click-through (pointer-events:none above) — otherwise it would
   swallow clicks meant for shapes beneath it. But pointer-events is inherited in
   SVG, so leave the drawn stroke itself hittable: an interactive host (the editor)
   can then select the connector by clicking the visible line, while the empty box
   area still passes through. fill="none" means only the stroke receives events. */
.connector svg line, .connector svg polyline, .connector svg path { pointer-events: stroke; }
.group { position: absolute; }
