textarea {
  resize: both; /* allows horizontal and vertical resizing */
  overflow: auto; /* ensures scrollbars appear if needed */
}
/* gap-4 override removed — manual-layout rows need their natural spacing */
html {
    scroll-behavior: smooth;
}
body {
    background-color: #f4f7fa;
}
.main-content-wrapper {
    background-color: #E6E0F8;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0px, rgba(255,255,255,.07) 1px, transparent 1px, transparent 2px);
}
.bg-black {
    background-color: #000000 !important;
}
.header-border-red {
    border-bottom: 3px solid #dc3545;
}
.sidebar {
    position: fixed;
    top: 0; 
    left: 0; 
    bottom: 0;
    width: 250px;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%);
    z-index: 1050;
    background-color: #002b5c;
    color: #e0e0e0;
}
@media (min-width: 992px) {
    .sidebar {
        position: relative;
        transform: translateX(0);
        min-height: 100vh;
        max-width: 250px;
    }
}
.sidebar.show {
    transform: translateX(0);
}
#sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1049;
    pointer-events: auto;
}
.sidebar h5 {
    color: #ffffff;
    font-weight: 700;
}
.sidebar-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); 
    padding-bottom: 8px;
    margin-bottom: 12px !important;
    list-style-type: none;
    padding-left: 0;
    transition: background-color 0.1s ease;
}
.sidebar-item a {
    color: #e0e0e0 !important;
    font-weight: 500;
    padding-left: 1rem;
    display: block;
}
.sidebar-item:hover {
    background-color: #ffffff;
}
.sidebar-item:hover a {
    color: #000000 !important;
}
.card {
    border: none;
    border-radius: 0.75rem; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 
}
.card-header {
    background-color: #343a40 !important; 
    color: white; 
    border-bottom: none;
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    padding: 0.5rem 1.0rem;
}
.card-body {
    background-color: #d8e2dc;
    border: 1px solid black;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}
pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}
pre code p {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
}
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(108, 117, 125, 0.85);
    color: #ffffff;
    border: none;
    padding: 0.25rem 0.6rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
pre:hover .copy-btn {
    background-color: #6c757d;
}
.youtube-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}
.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.navbar-nav .nav-link {
    border: 1px solid #ffffff; 
    border-radius: 0.5rem;
    margin-inline: 0.25rem;
    padding: 0.5rem 1rem !important;
    transition: background-color 0.2s, color 0.2s;
}
.navbar-nav .nav-link:hover {
    background-color: #007bff;
    color: #000000 !important;
    border-color: #007bff;
}
.navbar-nav .nav-link.active {
    background-color: #dc3545 !important;
    color: #000000 !important;
    border-color: #dc3545 !important;
    font-weight: 700;
}
.navbar-nav .nav-link.active:hover {
    background-color: #e04a59 !important;
    color: #000000 !important;
    border-color: #e04a59 !important;
}
.btn-outline-danger:hover {
    color: #ffffff !important; 
}
.navbar {
    z-index: 1051;
}
.manual-layout-row {
    margin-bottom: 1.5rem;
}
.manual-layout-column {
    padding: 1.0rem;
    border: 2px solid #dcdcdc;
    background-color: #ffffffff;
    border-radius: 0.75rem;
    height: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.more-button {
    background-color: #ffc107 !important;
    color: #000000 !important;
    border-color: #ffc107 !important;
}
.more-button:hover {
    background-color: #e0a800 !important;
    color: #000000 !important;
    border-color: #e0a800 !important;
}
@media (max-width: 991.98px) {
    .manual-layout-column {
        border-radius: 0;
    }
}
.dropdown-submenu {
    position: relative;
}
.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
    display: none;
}
.dropdown-submenu:hover > .dropdown-menu { display: block; }

/* Flip submenu to the left when it would overflow the right edge */
.dropdown-submenu-flip > .dropdown-menu {
    left: auto !important;
    right: 100% !important;
}
.dropdown-submenu > a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #ccc;
    margin-top: 5px;
    margin-right: -10px;
}
.manual-layout-column.is-code-column {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

#open-section-menu-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* --- NEW: Custom Modal Styling --- */
#sectionMenuModal .modal-content {
    background-color: #002b5c; /* Same blue as sidebar */
    color: #e0e0e0;
}
#sectionMenuModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
#sectionMenuModal .list-group-item {
    background-color: transparent;
    color: #e0e0e0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
#sectionMenuModal .list-group-item:last-child {
    border-bottom: none;
}
#sectionMenuModal .list-group-item-action:hover,
#sectionMenuModal .list-group-item-action:focus {
    background-color: #ffffff;
    color: #000000;
}

/* Style burger button on hover */
.burger:hover {
  background-color: #dc3545 !important; /* Bootstrap's danger red color */
  border-color: #dc3545 !important;
  color: white !important; /* Make the icon white for contrast */
}

/* This targets all paragraphs inside an element with the class "text-box" */
.text-box p {
  margin-top: 0;
  margin-bottom: 0;
}
p {
  /*font-size: 16px;      /* Set the text size */
  line-height: 1.2;     /* Set the space between lines */
  margin-top: 0;        /* Remove the default top gap */
  margin-bottom: 0;  /* Set a custom 12px gap *after* the paragraph */
}

/* Block toggle chevron */
.block-chevron { transition: transform 0.2s ease; }
[data-bs-toggle="collapse"][aria-expanded="false"] .block-chevron { transform: rotate(-180deg); }

/* Code block wrap (for Quill-based code blocks) */
.code-block-wrap {
    background: #282c34;
    color: #abb2bf;
    border-radius: 0.5rem;
    padding: 1.5rem;
    overflow-x: auto;
    position: relative;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 1px solid rgba(255,255,255,0.1);
}
.code-block-wrap .code-content {
    font-family: 'Consolas', 'Monaco', monospace;
}
.code-block-wrap .code-content p {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Yellow scroll-to-top button — sits to the left of the sections button */
#scrollTopBtn {
    position: fixed;
    bottom: 20px;
    right: 78px;
    z-index: 1040;
    width: 50px;
    height: 50px;
    background-color: #ffc107;
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    display: none;
    align-items: center;
    justify-content: center;
}
#scrollTopBtn:hover { background-color: #e0a800; }

/* Floating sections widget */
#sections-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    width: 50px;
    height: 50px;
    background-color: #343a40;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
#sections-float-btn:hover { background-color: #dc3545; }
#sections-float-panel {
    position: fixed;
    bottom: 78px;
    right: 20px;
    z-index: 1041;
    background: #002b5c;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.45);
    width: 230px;
    max-height: 360px;
    overflow-y: auto;
    color: #e0e0e0;
    display: none;
    flex-direction: column;
    transform-origin: bottom right;
    animation: sectionsPopIn 0.18s ease;
}
#sections-float-panel.show {
    display: flex;
}
@keyframes sectionsPopIn {
    from { opacity:0; transform:scale(0.85); }
    to   { opacity:1; transform:scale(1); }
}
.sections-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    font-weight: 700;
    font-size: .88rem;
    flex-shrink: 0;
}
.sections-panel-header button {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.sections-panel-header button:hover { color: #fff; }
.sections-panel-actions {
    display: flex;
    gap: 6px;
    padding: 6px 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sections-panel-actions button {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    color: #c8d8f0;
    font-size: .78rem;
    padding: 5px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background-color 0.15s, color 0.15s;
}
.sections-panel-actions button:hover { background: rgba(255,255,255,0.17); color: #fff; }
.sections-panel-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}
.sections-panel-list li a {
    display: block;
    padding: 7px 14px;
    color: #c8d8f0;
    text-decoration: none;
    font-size: .85rem;
    border-left: 3px solid transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.sections-panel-list li a:hover {
    background-color: rgba(255,255,255,0.1);
    border-left-color: #dc3545;
    color: #fff;
}

/* Desktop sidebar collapsed via Menu toggle */
@media (min-width: 992px) {
    html.sidebar-collapsed #sidebar { display: none !important; }
    html.sidebar-collapsed main     { width: 100% !important; max-width: 100% !important; }
}

/* Main Menu dropdown — always on top, fully opaque, dominant */
#main-menu .dropdown-menu {
    z-index: 2000 !important;
    background-color: #1a2332 !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.92) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
}
#main-menu .dropdown-item { color: #e0e0e0; }
#main-menu .dropdown-item:hover,
#main-menu .dropdown-item:focus { background-color: rgba(255,255,255,0.1); color: #fff; }

/* Code block popout button — injected by JS when Code Popout is ON */
.popout-btn {
    position: absolute;
    top: 10px;
    right: 78px;
    background-color: #4a5568;
    color: #a6e3a1;
    border: none;
    padding: 0.25rem 0.6rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}
pre:hover .popout-btn,
.code-block-wrap:hover .popout-btn { opacity: 1; }

/* Advanced Pages Mode — focus column dropdown in card header */
.adv-pages-select {
    font-size: .74rem;
    padding: 2px 6px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.3);
    background-color: #1a2332;
    color: #c8d8f0;
    cursor: pointer;
    min-width: 72px;
    outline: none;
}
.adv-pages-select:focus { border-color: #60a5fa; }
.adv-pages-select option { background: #1a2332; color: #e0e0e0; }

/* Compact mode */
html.compact-mode main .card { margin: 0.35rem !important; }
html.compact-mode .card-header { padding: 0.18rem 0.75rem !important; }
html.compact-mode .card-header h2 { font-size: 0.88rem !important; }
html.compact-mode .card-header .btn-sm { padding: 0.08rem 0.3rem !important; font-size: 0.68rem !important; }

/* QE image paste zone */
.qe-img-paste-zone {
    border: 2px dashed #475569;
    border-radius: 6px;
    padding: 10px 14px;
    text-align: center;
    color: #94a3b8;
    font-size: .82rem;
    cursor: text;
    outline: none;
    min-height: 42px;
    transition: border-color 0.15s, background 0.15s;
}
.qe-img-paste-zone:focus,
.qe-img-paste-zone.drag-over {
    border-color: #60a5fa;
    background: rgba(96,165,250,0.08);
    color: #e2e8f0;
}
/* Tables inside text panels. The editor cannot make tables, but Import Document
   (js/doc-import.js) brings them in from Word; without this they render as
   borderless runs of text. Scrolls sideways rather than widening the panel. */
.qe-rendered table {
    border-collapse: collapse;
    margin: .5rem 0 1rem;
    display: block;
    max-width: 100%;
    overflow-x: auto;
}
.qe-rendered th,
.qe-rendered td {
    border: 1px solid #d1d5db;
    padding: .35rem .6rem;
    vertical-align: top;
}
.qe-rendered tr:first-child td,
.qe-rendered th {
    background: #f3f4f6;
    font-weight: 600;
}
