/**
 * AJT MSP Hub — BookStack Local Page Editor Styles.
 *
 * @package AJT_MSP_Hub
 * @since   3.1.2
 */

/* ══════════════════════════════════════════════════════════
 * EDITOR OVERLAY & CONTAINER
 * ══════════════════════════════════════════════════════════ */

.ajt-bs-local-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 16px;
    animation: ajtBsLeFadeIn 0.15s ease;
}

@keyframes ajtBsLeFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ajt-bs-local-editor {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ══════════════════════════════════════════════════════════
 * HEADER
 * ══════════════════════════════════════════════════════════ */

.ajt-bs-le-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #25283D;
    color: #FFFFFF;
    flex-shrink: 0;
    gap: 12px;
}

.ajt-bs-le-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ajt-bs-le-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.ajt-bs-le-title {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 6px 12px;
    color: #FFFFFF;
    font-family: 'Nunito Sans', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s;
}

.ajt-bs-le-title:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

.ajt-bs-le-title::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.ajt-bs-le-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Status indicator */
.ajt-bs-le-status {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}

.ajt-bs-le-status:empty { display: none; }

.ajt-bs-le-status--info {
    background: rgba(0, 121, 145, 0.2);
    color: #38BDF8;
}

.ajt-bs-le-status--success {
    background: rgba(5, 150, 105, 0.2);
    color: #6EE7B7;
}

.ajt-bs-le-status--warn {
    background: rgba(217, 119, 6, 0.2);
    color: #FCD34D;
}

.ajt-bs-le-status--error {
    background: rgba(220, 38, 38, 0.2);
    color: #FCA5A5;
}

/* Buttons */
.ajt-bs-le-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'Nunito Sans', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ajt-bs-le-btn-save {
    background: #A04398;
    color: #FFFFFF;
}

.ajt-bs-le-btn-save:hover {
    background: #8A3784;
}

.ajt-bs-le-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ajt-bs-le-btn-close {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.ajt-bs-le-btn-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

/* ══════════════════════════════════════════════════════════
 * EDITOR BODY
 * ══════════════════════════════════════════════════════════ */

.ajt-bs-le-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.ajt-bs-le-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #6B7280;
    font-size: 14px;
    font-family: 'Nunito Sans', -apple-system, sans-serif;
}

/* TinyMCE container override — fill available space */
.ajt-bs-le-body .tox.tox-tinymce,
.ajt-bs-le-body .mce-tinymce {
    flex: 1 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* TinyMCE 4: only the TOP-LEVEL container-body gets column layout.
   Do NOT apply to nested .mce-container-body (toolbar rows, button groups). */
.ajt-bs-le-body > .mce-tinymce > .mce-container-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: 100% !important;
}

.ajt-bs-le-body .mce-edit-area {
    flex: 1 !important;
}

.ajt-bs-le-body .mce-edit-area iframe {
    height: 100% !important;
}

.ajt-bs-le-body .tox .tox-editor-header {
    border-bottom: 1px solid #e5e7eb !important;
}

.ajt-bs-le-body .tox .tox-toolbar__primary {
    background: #f9fafb !important;
}

.ajt-bs-le-body .tox .tox-statusbar {
    border-top: 1px solid #e5e7eb !important;
    background: #f9fafb !important;
}

/* ══════════════════════════════════════════════════════════
 * DIAGRAMS.NET OVERLAY
 * ══════════════════════════════════════════════════════════ */

.ajt-bs-drawio-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px;
    animation: ajtBsLeFadeIn 0.15s ease;
}

.ajt-bs-drawio-container {
    width: 100%;
    max-width: 1400px;
    background: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.ajt-bs-drawio-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ══════════════════════════════════════════════════════════
 * RESPONSIVE
 * ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .ajt-bs-local-editor-overlay {
        padding: 0;
    }

    .ajt-bs-local-editor {
        border-radius: 0;
        max-width: 100%;
    }

    .ajt-bs-le-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ajt-bs-le-header-left {
        width: 100%;
    }

    .ajt-bs-le-title {
        font-size: 13px;
    }
}
