/* ═══════════════════════════════════════════════════════════
   docEditor.css  –  styles for the docPageEditor component
   and the docPreview responsive shell.
   ═══════════════════════════════════════════════════════════ */

/* ── Embedded variant (inside doc-upload or service-platform) ─────────────
   Overrides the default position:fixed full-viewport layout so the preview
   sits inside its parent container. Applied via dp-layout--embedded.        */
.dp-layout--embedded {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    height: calc(100vh - 240px);
    min-height: 480px;
    z-index: auto !important;
}

/* Close/back bar shown above the layout in embedded mode */
.dp-embed-bar {
    flex-shrink: 0;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
}

/* ── Full-height shell ───────────────────────────────────────────────────── */
.dp-layout {
    position: fixed;
    top: 56px;   /* navbar height */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f0f2f5;
    z-index: 1;
}

.dp-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Mobile topbar (hidden md+) ─────────────────────────────────────────── */
.dp-topbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.dp-topbar-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    font-size: 13px;
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    color: #495057;
    white-space: nowrap;
    transition: background 0.15s;
}
.dp-topbar-btn:hover            { background: #f8f9fa; }
.dp-topbar-btn--active          { background: #e7f1ff !important; color: #0d6efd !important; border-color: #0d6efd !important; }

.dp-topbar-crumb {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
}

/* ── Pages sidebar ──────────────────────────────────────────────────────── */
.dp-sidebar {
    width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow: hidden;
}

/* Bootstrap offcanvas-md makes it a flex child on desktop */
@media (min-width: 768px) {
    .dp-sidebar {
        position: static !important;
        transform: none !important;
        visibility: visible !important;
    }
}

.dp-sidebar-label {
    padding: 10px 14px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
}

.dp-page-list {
    overflow-y: auto;
    flex: 1;
}

.dp-page-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 14px;
    font-size: 13px;
    color: #495057;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.dp-page-btn:hover  { background: #e9f2ff; color: #0d6efd; }
.dp-page-btn.active { background: #0d6efd; color: #fff; font-weight: 500; }

.dp-sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
}

.dp-empty-msg {
    padding: 16px 14px;
    font-size: 12px;
    color: #adb5bd;
}

/* ── Main editor column ──────────────────────────────────────────────────── */
.dp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: #f0f2f5;
}

.dp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #adb5bd;
    font-size: 14px;
}
.dp-empty-state i { font-size: 3rem; }

/* ── Editor component inner layout ──────────────────────────────────────── */
.dp-editor-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.dp-editor-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}

.dp-editor-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Summary panel */
.dp-summary-panel {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f8f9fa;
}
.dp-summary-panel pre {
    background: #fff;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    padding: 14px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── TinyMCE overrides ───────────────────────────────────────────────────── */

/* Strip all chrome shadows */
.tox-tinymce,
.tox-tinymce:focus,
.tox-tinymce:focus-within {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    outline: none !important;
}

.tox .tox-edit-area {
    border: none !important;
    background: #f0f2f5 !important;
}
.tox .tox-edit-area::before {
    content: none !important;
    border: none !important;
}

/* Flat minimal toolbar — no shadow, light separator */
.tox .tox-toolbar,
.tox .tox-toolbar-overlord,
.tox .tox-toolbar__primary {
    background: #fff !important;
    border-bottom: 1px solid #e9ecef !important;
    box-shadow: none !important;
    padding: 2px 4px !important;
}

.tox .tox-toolbar__group {
    border-right: 1px solid #e9ecef !important;
    padding: 0 4px !important;
}
.tox .tox-toolbar__group:last-child { border-right: none !important; }

.tox .tox-tbtn {
    border-radius: 4px !important;
    color: #495057 !important;
    height: 28px !important;
    width: 28px !important;
    margin: 1px !important;
}
.tox .tox-tbtn:hover  { background: #f0f2f5 !important; color: #0d6efd !important; }
.tox .tox-tbtn--enabled,
.tox .tox-tbtn--active { background: #e7f1ff !important; color: #0d6efd !important; }

/* Hide statusbar (redundant in this layout) */
.tox .tox-statusbar { display: none !important; }

/* Hide promo */
.tox .tox-promotion { display: none !important; }
.tox .tox-statusbar__right-container { display: none !important; }

/* ── Crops panel ─────────────────────────────────────────────────────────── */
.dp-crops-panel {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    overflow: hidden;
}

@media (min-width: 768px) {
    .dp-crops-panel {
        position: static !important;
        transform: none !important;
        visibility: visible !important;
    }
}

.dp-crops-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
}

.dp-crops-body {
    overflow-y: auto;
    flex: 1;
}

.dp-crop-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}
.dp-crop-item:last-child { border-bottom: none; }

.dp-crop-thumb {
    width: 100%;
    max-height: 96px;
    object-fit: contain;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    display: block;
    margin-bottom: 7px;
}

.dp-crop-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.dp-crop-actions {
    display: flex;
    gap: 4px;
}
.dp-crop-actions .btn { font-size: 11px; padding: 2px 8px; }

/* ── Mobile stacked strips ───────────────────────────────────────────────── */
.dp-stack-bar {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.dp-stack-bar::-webkit-scrollbar         { height: 3px; }
.dp-stack-bar::-webkit-scrollbar-thumb   { background: #dee2e6; border-radius: 2px; }

.dp-stack-page-btn {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 14px;
    font-size: 12px;
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    color: #495057;
    scroll-snap-align: start;
    transition: background 0.12s;
}
.dp-stack-page-btn i          { font-size: 16px; }
.dp-stack-page-btn:hover      { background: #e9f2ff; border-color: #0d6efd; color: #0d6efd; }
.dp-stack-page-btn.active     { background: #0d6efd; border-color: #0d6efd; color: #fff; }

.dp-stack-crop-card {
    flex-shrink: 0;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    scroll-snap-align: start;
}

.dp-stack-crop-thumb {
    width: 80px;
    height: 52px;
    object-fit: contain;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    background: #fff;
    display: block;
}

.dp-stack-crop-actions {
    display: flex;
    gap: 3px;
}
.dp-stack-crop-actions .btn { font-size: 11px; padding: 2px 6px; }

/* ── Desktop crops-panel toggle ──────────────────────────────────────────── */
@media (min-width: 768px) {
    .dp-crops-panel.dp-crops-hidden {
        display: none !important;
    }
}

/* ── Responsive: mobile stacks ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* On mobile the offcanvas panels are not in the flex row */
    .dp-main {
        width: 100%;
    }
}
