/* Top draft status - synced with bottom status */
.status-notification {
    position: fixed;
    top: 28px; /* At logo height */
    left: 185px; /* Aligned with Title label (sidebar edge) */
    padding: 8px 12px;
    font-weight: 500;
    font-size: 14px;
    color: #666;
    -webkit-transition: left 0.3s;
    transition: left 0.3s;
    z-index: 1060; /* Above navbar (1050) */
}

body.sidebar-collapsed .status-notification {
    left: 50px; /* Sidebar collapsed width (aligned with edge) */
}

.top-nav-status {
    display: none; /* Not used - using .status-notification instead */
}

/* Bottom draft status (dynamically created by auto-save.js) */
#draftStatus {
    position: fixed;
    bottom: 20px;
    left: 195px; /* Sidebar expanded width (185px) + 10px margin */
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #666;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    -webkit-transition: left 0.3s;
    transition: left 0.3s;
    z-index: 1040;
}

/* Adjust bottom status when sidebar is collapsed */
body.sidebar-collapsed #draftStatus {
    left: 60px; /* Sidebar collapsed width (50px) + 10px margin */
}

/* Removed screen-reader-only styles that were hiding the top status indicators */
/* The top-nav-status should be visible and follow sidebar state */

body {
            height: 100%;
            margin: 0;
            padding: 0;
            overflow-x: hidden !important;
    background-color: var(--main-bg-color) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, 'Merriweather', serif, sans-serif;
        }


.editor-container {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
                -ms-flex-direction: column;
                    flex-direction: column;
            height: calc(100vh - 60px);
            margin: -115px 50px 20px 10px; /* Adjusted initial margin */
}

.summernote {
            -webkit-box-flex: 1;
                -ms-flex: 1;
                    flex: 1;
            overflow-y: hidden;
            background-color: var(--main-bg-color);
    border: none;
    margin: 0 !important;
    padding: 0 !important;
        }

body, html {
    height: 100%;
    margin: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
}

.content {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
}



.note-editable {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    overflow-y: auto;
    overflow: hidden !important;
    padding: 18px 0.5rem 22px 0.5rem !important;
    line-height: 1.5em !important;
    min-height: 300px; /* Increased from 64px for better clickability */
    cursor: text; /* Show text cursor to indicate editable area */
}

.note-toolbar-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1050;
}



/* Styling for the new Publish button */
#btn_rdy_pub {
    display: inline-block;
    font-weight: 400;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid #f8f9fa;
    padding: 0.09rem .5rem .09rem .5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 50px;
    -webkit-transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
    color: #333;
    margin-right: 0.7rem !important;
    margin-left: 0;
    margin-top: 0.4rem !important;
    margin-bottom: .4rem !important;
}

#btn_rdy_pub:hover {
    color: #333;
    background-color: #ffca7b;
    border-color: #adadad;
}

#btn_rdy_pub:focus,
#btn_rdy_pub.focus {
    -webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#btn_rdy_pub.disabled,
#btn_rdy_pub:disabled {
    opacity: 0.65;
}

#btn_rdy_pub:not(:disabled):not(.disabled):active,
#btn_rdy_pub:not(:disabled):not(.disabled).active,
.show > #btn_rdy_pub.dropdown-toggle {
    color: #fff;
    background-color: #aad688;
    border-color: #aad688;
}

#btn_rdy_pub:not(:disabled):not(.disabled):active:focus,
#btn_rdy_pub:not(:disabled):not(.disabled).active:focus {
    -webkit-box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5);
            box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5);
}


.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

:root {
    --main-bg-color: #f5f5f5;
    --input-placeholder-color: #cecece;
}

.publish-options {
    background-color: var(--main-bg-color);
    border: none;
}



#inp_title {
    width: calc(100% - 80px); /* Adjusted to add margin on the right */
    min-height: 104px;
    padding: 28px 0.5rem 28px 0.5rem;
    margin: 0 20px 0 -10px; /* Added margin */
    font-size: 3em;
    color: #000;
    resize: none;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
    -webkit-transition: height 0.2s ease-in-out;
    transition: height 0.2s ease-in-out;
    overflow: hidden;
    line-height: 1em;
}

#inp_title::-webkit-input-placeholder {
    font-size: 2em;
    color: var(--input-placeholder-color);
}

.note-editor {
    margin: 0;
    padding: 0;
}

/* Control margin and padding of the Summernote toolbar */

.note-toolbar-wrapper {
    /* Keep original in-flow placement so title remains visible */
    position: relative !important;
    margin-top: 0; /* Align with previous layout */
    margin-left: 0;
    /* Critical: let clicks fall through the wrapper so first line is always clickable */
    pointer-events: none;
}

/* Re-enable interaction for the actual toggle button inside the wrapper */
.note-toolbar-wrapper .note_btn { pointer-events: auto; }

.note-toolbar {
    margin-top: 0px !important; /* Adjusted margin to position toolbar correctly */
    padding: 0;
    position: sticky; /* FIX 2025-10-06: Sticky toolbar follows scroll */
    top: 0; /* Stick to top of viewport when scrolling */
    left: 5px;
    z-index: 1050 !important; /* Increased to stay above other elements */
    background-color: var(--main-bg-color, #fff); /* Ensure toolbar has background */
}

/* When toolbar is hidden via JS, ensure it doesn't block clicks */
.note-toolbar[style*="display: none"],
.note-toolbar[hidden] {
    pointer-events: none !important;
}

.note-toolbar .note-btn-group {
    margin: 0 !important;
    padding: 0 !important;
}

.note-toolbar .note-btn {
    margin: 0 !important;
    padding: 0.5rem !important; /* Example padding, adjust as needed */
}

/* Container for title label, vertical bar, and textarea */
.title-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    margin: 0 20px 20px -30px !important; /* Adjust margins as needed */
}

/* Title label styling */
.title-label {
    font-size: 1em; /* Adjust font size as needed */
    color: #000;
    margin-right: 10px; /* Space between label and bar */
    margin-left: 5px;
    font-family: 'Merriweather', serif;
}

/* Vertical bar styling */
.vertical-bar {
    height: 2.5em; /* Match the height of the title label */
    width: 1px;
    background-color: #000;
    margin-right: 15px; /* Space between bar and textarea */
}

.large-subtitle {
    font-size: 1.5em !important;
    color: #000;
}

#inp_subtitle {
    width: calc(100% - 0px); /* Adjust width as needed */
    padding: 0 0.5rem;
    margin: 0; /* Adjust margins as needed */
    font-size: 1.5em; /* Adjust font size as needed */
    color: #000;
    resize: none;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
    word-wrap: break-word; /* Ensures long words wrap */
    overflow-wrap: break-word; /* Ensures long words wrap */
    overflow: hidden; /* Hide overflow if necessary */
}

#inp_subtitle::-webkit-input-placeholder {
    font-size: 1.5em;
    color: var(--input-placeholder-color);
}

.form-control,
.form-control:focus,
.note-editor .note-editing-area .note-editable,
.note-editor .note-toolbar,
.note-editor {
    background-color: var(--main-bg-color) !important;
    border: none;
    -webkit-box-shadow: none;
            box-shadow: none;
}

.form-group {
    margin-bottom: 1rem;
}

.btn1-custom {
    background-color: #e5e5e5 !important;
    border: none;
    color: #fff !important;
}

.btn1-custom:hover {
    background-color: #e5e5e5 !important;
    color: #fff !important;
}

h1,
.note-placeholder,
.note-editing-area .note-editable {
    color: #000;
}

.note-editor.note-frame {
    border: none !important;
    -webkit-box-shadow: none !important;
            box-shadow: none !important;
}

.form-control::-webkit-input-placeholder {
    color: var(--input-placeholder-color);
}

.note-toolbar .dropdown-toggle::after {
    color: var(--input-placeholder-color) !important;
}

.note-toolbar .note-btn.btn-primary {
    background-color: var(--input-placeholder-color) !important;
    border: none;
}



.note-statusbar {
    display: none !important;
}

#note_btn {
    position: relative;
    left: -30px; /* Adjusted to align with title */
    top: -15px; /* Adjusted to position correctly */
    background: none !important;
    color: #cecece !important;
    border-color: #e5e5e5 !important;
    -webkit-transition: background-color 0.3s, color 0.3s;
    transition: background-color 0.3s, color 0.3s;
    z-index: 1000;
}

#note_btn:hover {
    background-color: #e0e0e0;
    color: #000;
}

#pub_now {
    background-color: #aad688;
}

#pub_now:hover {
    background-color: #5ea758;
}

.btn-primary {
    background-color: #7CB9E8;
}

.btn-primary:hover {
    background-color: #275EA3;
}

#saveMessage {
    display: none;
    position: fixed;
    top: 5px;
    padding: 0;
    font-family: Roboto;
    margin-top: 5px;
    border: none;
    right: 250px;
    z-index: 1050; /* Increased z-index */
    padding: 3px 6px;
    background-color: #f5f5f5;
    color: black;
    border-radius: 5px;
}

/* Initial state when toolbar is hidden */
.editor-container-toolbar-hidden {
    margin-top: 0 !important; /* Adjust this value as needed */
}

/* State when toolbar is shown */
.editor-container-toolbar-visible {
    margin-top: -100px !important; /* Adjust this value as needed */
}

.note-toolbar-hidden {
    top: 100px; /* Adjust this value as needed */
}

.note-toolbar-visible {
    top: -5px; /* Adjust this value as needed */
}

.notification-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050; /* Ensure it appears above other elements */
    display: none; /* Hidden by default */
}

.notification-success.show {
    display: block; /* Show when adding the 'show' class */
}

/* Publish Success Modal Styling */
.modal-publish-success .modal-dialog {
    max-width: 600px;
    margin: auto;
}

.modal-publish-success .modal-content {
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.9);
    position: relative;
    opacity: 0.95; /* Adjust opacity as needed */
}

.modal-publish-success .modal-header {
    border-bottom: none;
    position: relative;
}

.modal-publish-success .modal-header .btn.close {
    position: absolute;
    right: 10px;
    top: 10px;
    border: none;
    font-size: 1.5rem;
    color: #333;
}

.modal-publish-success .modal-body {
    padding: 20px;
}

.modal-publish-success h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.modal-publish-success p {
    font-size: 1rem;
    margin-bottom: 20px;
}

.modal-publish-success a {
    color: #007bff;
}

.modal-publish-success .btn-share {
    width: calc(100% - 40px);
    margin: 10px 10px;
    border-radius: 25px;
    background-color: unset;
    color: black;
    padding: 10px 10px;
    font-size: 1rem;
    -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid black !important;
    display: block;
    text-align: center;
}

.modal-publish-success .btn-share:hover {
    background-color: #0056b3;
    text-decoration: none;
    color: white;
}

.modal-publish-success .modal-body h4 {
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 20px;
    font-weight: normal;
}

.modal-backdrop.show {
    opacity: 0.7;
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
}

.modal-fullscreen {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    height: 100%;
}

.modal-fullscreen .modal-content {
    margin: auto;
    background-color: #fff;
}

#row_close {
    padding: 5px;
    -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Shadow border around close button */
}

/*
  Force LTR direction inside Summernote editable surface.
  FIX (2025-10-05): Changed unicode-bidi from 'isolate' to 'normal'.
  The 'isolate' value was ironically CAUSING the reversed word order bug
  it was intended to prevent. Bug affected both physical keyboard and
  automated testing - text appeared backwards in the DOM itself.
*/
.note-editing-area .note-editable {
    direction: ltr;
    unicode-bidi: normal;
    text-align: left;
    min-height: 500px !important; /* FIX 2025-10-06: Ensure editor is always clickable */
    padding: 20px; /* Add padding for better click target */
    cursor: text; /* Show text cursor to indicate editable area */
}

/* FIX 2025-10-06: Ensure editor container doesn't collapse */
.editor-container,
.note-editor,
.note-editing-area {
    min-height: 500px !important;
}

/* FIX 2025-10-06: Prevent footer from overlapping editor and ensure images are clickable */
.note-editor.note-frame .note-editing-area {
    margin-bottom: 800px !important; /* Large space to prevent footer overlap - was 100px */
    padding-bottom: 400px !important; /* Extra padding for content at bottom */
}

/* FIX 2025-10-06: Ensure editor editable area has enough bottom space */
.note-editable {
    padding-bottom: 400px !important; /* Prevent content from being hidden by footer */
}

/* FIX 2025-10-06: Ensure images in editor are always clickable, even near footer */
.note-editable img {
    position: relative !important;
    z-index: 10 !important; /* Above footer but below toolbar */
    pointer-events: auto !important; /* Ensure clicks register */
    cursor: pointer !important; /* Show it's clickable */
}

/* FIX 2025-10-06: Ensure Summernote image handles and popover stay above footer */
.note-editor .note-handle,
.note-editor .note-control-selection,
.note-editor .note-popover,
.note-resizebar {
    z-index: 1040 !important; /* Above footer, below toolbar (which is 1050) */
    pointer-events: auto !important;
}

/* FIX 2025-10-06: Ensure the image selection box is visible */
.note-editor .note-control-selection .note-control-selection-bg {
    z-index: 1039 !important;
    opacity: 0.3 !important;
}

/* Ensure the selection box isn't clipped by the editing area container */
.note-editor .note-editing-area {
    overflow: visible !important;
}

/* FIX 2025-10-06: Ensure footer doesn't overlap any editor elements */
.page-footer,
footer {
    position: relative;
    z-index: 1 !important; /* Below all editor elements */
}
