/* =====================================================
   Canvas: Viewport, Wrapper, Zoom Bar,
           Slide Tabs, Status Pill
===================================================== */

/* ═══ CANVAS ═════════════════════════════════════════════ */
#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    /* Wall-to-wall white */
    min-width: 0;
    min-height: 0;
}

#canvas-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    padding: 0;
    /* Zero padding for wall-to-wall */
    min-height: 0;
    /* Clean grid background */
    background-size: 20px 20px;
    background-image:
        linear-gradient(to right, #f1f1f1 1px, transparent 1px),
        linear-gradient(to bottom, #f1f1f1 1px, transparent 1px);
}

#canvas-wrapper {
    display: block;
    margin: 0;
    /* Align to top-left */
    flex-shrink: 0;
    background: white;
    position: relative;
    box-shadow: none;
    /* No shadow for "paper fit to screen" look */
    border-radius: 0;
    transform-origin: top left;
}

#main-canvas {
    display: block;
}

/* Slide Master info bar — first row inside tabs-container */
#slide-master-bar {
    width: 100%;
    height: 26px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11.5px;
    font-weight: 500;
    color: #475569;
    box-sizing: border-box;
    letter-spacing: 0.01em;
    flex-shrink: 0;
}

/* Text Editor Overlay */
#text-editor {
    position: absolute;
    z-index: 1000;
    display: none;
    border: 2px solid var(--blue);
    outline: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: white;
    color: var(--text);
    box-shadow: var(--shadow-md);
    resize: none;
    overflow-y: auto;
    min-height: 32px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Zoom Bar */
.zoom-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.zoom-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.zoom-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.zoom-input {
    width: 48px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    padding: 2px 0;
}

/* Status Pill */
#status-pill {
    background: rgba(15, 23, 42, .85);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Slide Tabs */
#tabs-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.tabs-row {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 6px;
    flex-shrink: 0;
}

#tabs-list {
    display: flex;
    align-items: flex-end;
    height: 100%;
    gap: 3px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}

#tabs-list::-webkit-scrollbar {
    display: none;
}

.tab-item {
    height: 32px;
    padding: 0 18px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    margin-top: 8px;
}

.tab-item:hover {
    background: #e2e8f0;
    color: var(--text);
}

.tab-item.active {
    background: white;
    color: var(--blue);
    height: 36px;
    margin-top: 4px;
    border-top: 2px solid var(--blue);
    z-index: 2;
}

.tab-item .close-tab {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    opacity: 0;
    transition: opacity .15s;
}

.tab-item:hover .close-tab {
    opacity: 1;
}

.tab-item .close-tab:hover {
    background: rgba(0, 0, 0, .12);
}

#add-paper-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

#add-paper-btn:hover {
    background: var(--blue-light);
    color: var(--blue);
}


/* table-cell-editor removed — replaced by PPTableModule DOM overlay */

/* ── DOM Table Overlay ──────────────────────────────────── */
#pp-table-overlay {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 10;
}

#pp-table-overlay table {
    border-collapse: collapse;
    table-layout: fixed;
}

#pp-table-overlay td {
    position: relative;
    overflow: hidden;
    cursor: text;
    user-select: none;
    transition: outline 60ms ease;
}

#pp-table-overlay td:hover {
    filter: brightness(0.97);
}

/* Active cell textarea */
.pp-cell-editor {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
    border: none !important;
    outline: none !important;
    background: transparent;
    resize: none;
    overflow: hidden;
    caret-color: #0055ff;
    cursor: text;
    white-space: pre-wrap;
    word-break: break-word;
    z-index: 5;
}

.pp-cell-editor::selection {
    background: rgba(0, 85, 255, 0.20);
}
