/* site-11-editor-sidebar.css: Rich text editor and sidebar (33, 35).
   Part of the old site.css, split by sections (same order: _Styles.cshtml links them one after the other,
   so the cascade is exactly the same). */

/* =====================================================================
   33. RICH TEXT EDITOR ("mini Word": Pages/Shared/_RichTextEditor + js/richEditor.js)
   ---------------------------------------------------------------------
   Reuses .story-box / .story-toolbar (section 16). The editable page (.rich-editor-area)
   also has .rte-area, the "sheet of paper" look of section 16.
   ===================================================================== */

.rich-editor-area {
    position: relative;         /* for the placeholder */
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;      /* keeps the spaces the user typed (the server keeps them too) */
    overflow-wrap: break-word;
    overflow-y: auto;
    cursor: text;
}

    .rich-editor-area:focus {
        border-color: var(--accent, #22d3ee) !important;
        box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2), 0 15px 30px -5px rgba(0, 0, 0, 0.2) !important;
    }

    /* Placeholder: absolute in its normal place, so it does not push the first paragraph */
    .rich-editor-area.is-empty::before {
        content: attr(data-placeholder);
        position: absolute;
        color: #94a3b8;
        pointer-events: none;
    }

    .rich-editor-area p {
        margin: 0 0 0.8em;
    }

    .rich-editor-area ul,
    .rich-editor-area ol {
        margin: 0 0 0.8em;
        padding-left: 2rem;
        white-space: normal;
    }

    .rich-editor-area li {
        white-space: pre-wrap;
    }

    .rich-editor-area b,
    .rich-editor-area strong {
        font-weight: 700;
    }

.rich-editor-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
}

    .rich-editor-toolbar .btn b,
    .rich-editor-toolbar .btn i:not(.bi),
    .rich-editor-toolbar .btn u {
        font-family: Georgia, 'Times New Roman', serif;
        font-size: 0.95rem;
    }

    .rich-editor-toolbar .btn.is-active,
    .rich-editor-toolbar .btn[aria-pressed="true"] {
        color: #fff;
        background: #2563eb;
        border-color: #2563eb;
    }

.rich-editor-separator {
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: #cbd5e1;
}

.rich-editor-counter {
    padding: 0 6px;
    color: #64748b;
    font-size: 0.8rem;
    white-space: nowrap;
}


/* =====================================================================
   35. SIDEBAR (full height on the left, handle in the middle of its right edge)
   ===================================================================== */
:root {
    --sidebar-width: 264px;
    --app-header-height: 64px;
    --sidebar-speed: 0.3s;
    --sidebar-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --sidebar-bg: #0e1730;
    --sidebar-bg-2: #0a1124;
    --sidebar-line: rgba(255, 255, 255, 0.12);
    --sidebar-text: #e2e8f0;          /* light text: the photo behind is not black */
    --sidebar-text-strong: #ffffff;
    --sidebar-text-muted: #cbd5e1;
    --sidebar-accent: #3b82f6;
}

/* The top bar uses the whole width: logo on the far left, user on the far right */
.app-header-modern .nav-shell {
    max-width: none;
}

.app-wrapper {
    flex: 1;
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.app-main-content {
    flex: 1;
    min-width: 0;
}

.app-sidebar {
    position: fixed;            /* always visible, like the top bar: it never scrolls with the page */
    top: var(--app-header-height);
    bottom: 0;
    left: 0;
    z-index: 1020;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    isolation: isolate;
    background: #0b0f19;
    border-right: 1px solid var(--sidebar-line);
    box-shadow: 4px 0 24px -12px rgba(2, 6, 23, 0.15);
    transition: width var(--sidebar-speed) var(--sidebar-ease);
}

/* Same photo as the dashboard, the image itself darker: lower brightness = darker */
.app-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--app-bg-image) center / cover no-repeat;
    filter: brightness(0.35) contrast(1.3);
    pointer-events: none;
}

.sidebar-scroll {
    flex: 1;
    width: var(--sidebar-width);
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
    transition: opacity 0.2s ease, transform var(--sidebar-speed) var(--sidebar-ease);
}

/* --- Quick action --- */
.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 4px 22px;
    padding: 11px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 22px -12px rgba(37, 99, 235, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.sidebar-cta:hover {
    color: #fff;
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 14px 26px -12px rgba(37, 99, 235, 1), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.sidebar-scroll {
    flex: 1;
    width: var(--sidebar-width);
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
    transition: opacity 0.2s ease, transform var(--sidebar-speed) var(--sidebar-ease);
}

/* --- Quick action --- */
.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 4px 22px;
    padding: 11px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 22px -12px rgba(37, 99, 235, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

    .sidebar-cta:hover {
        color: #fff;
        transform: translateY(-1px);
        filter: brightness(1.08);
        box-shadow: 0 14px 26px -12px rgba(37, 99, 235, 1), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }

/* --- Sections and links --- */
.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 10px 8px;
    color: var(--sidebar-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

    .sidebar-section-title::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--sidebar-line);
    }

    .sidebar-cta + .sidebar-section-title,
    .sidebar-section-title:first-child {
        margin-top: 0;
    }

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-size: 0.93rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
    font-size: 1.05rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-item:hover {
    color: var(--sidebar-text-strong);
    background: rgba(255, 255, 255, 0.1);
}

    .sidebar-item:hover .sidebar-icon {
        background: rgba(255, 255, 255, 0.08);
        transform: scale(1.05);
    }

.sidebar-item.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.3);
}

    .sidebar-item.active .sidebar-icon {
        background: var(--sidebar-accent);
        color: #fff;
        box-shadow: 0 6px 14px -6px rgba(59, 130, 246, 0.9);
    }

    /* Bar on the left edge of the active link */
    .sidebar-item.active::before {
        content: "";
        position: absolute;
        left: -14px;
        top: 10px;
        bottom: 10px;
        width: 4px;
        border-radius: 0 4px 4px 0;
        background: #60a5fa;
    }

.sidebar-item:focus-visible,
.sidebar-cta:focus-visible,
.sidebar-logout:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-count {
    min-width: 22px;
    height: 22px;
    margin-left: auto;
    padding: 0 7px;
    border-radius: 999px;
    background: #f59e0b;
    color: #1f1300;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

/* --- Footer: signed-in user --- */
.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    width: var(--sidebar-width);
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-line);
    background: rgba(2, 6, 23, 0.25);
    transition: opacity 0.2s ease;
}

.sidebar-user-avatar {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.sidebar-user {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-user-name {
    overflow: hidden;
    color: var(--sidebar-text-strong);
    font-size: 0.86rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    color: var(--sidebar-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-logout {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 1.05rem;
    transition: background 0.2s ease, color 0.2s ease;
}

    .sidebar-logout:hover {
        background: rgba(239, 68, 68, 0.15);
        color: #f87171;
    }

/* --- Footer layout: account actions written out on top, the signed-in user below --- */
.sidebar-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 14px 14px;
}

.sidebar-account-menu {
    padding-bottom: 10px;
}

/* Logout: same row as the menu links, red on hover so it is not clicked by mistake */
.sidebar-item--logout:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
}

    .sidebar-item--logout:hover .sidebar-icon {
        background: rgba(239, 68, 68, 0.2);
        color: #f87171;
    }

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 10px 0;
    border-top: 1px solid var(--sidebar-line);
}

    .sidebar-profile .sidebar-user-avatar {
        width: 38px;
        height: 38px;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
    }

    /* The name may take two lines instead of being cut */
    .sidebar-profile .sidebar-user-name {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        line-height: 1.3;
    }

    .sidebar-profile .sidebar-user-role {
        margin-top: 2px;
    }

/* --- Handle: attached to the right edge, exactly in the middle --- */
.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    right: -22px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 60px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid var(--sidebar-line);
    border-left: 0;
    border-radius: 0 12px 12px 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    font-size: 0.9rem;
    box-shadow: 6px 0 16px -8px rgba(2, 6, 23, 0.6);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, width 0.2s ease, right 0.2s ease;
}

    .sidebar-collapse-btn i {
        transition: transform var(--sidebar-speed) var(--sidebar-ease);
    }

    .sidebar-collapse-btn:hover {
        width: 26px;
        right: -26px;
        background: var(--sidebar-accent);
        color: #fff;
    }

    .sidebar-collapse-btn:focus-visible {
        outline: 2px solid #60a5fa;
        outline-offset: 2px;
    }

.sidebar-backdrop {
    display: none;
}

/* The fixed bar takes no room: the page and the footer move right by its width */
@media (min-width: 992px) {
    .app-layout:has(.app-sidebar) .app-wrapper,
    .app-layout:has(.app-sidebar) .app-footer {
        padding-left: var(--sidebar-width);
        transition: padding-left var(--sidebar-speed) var(--sidebar-ease);
    }

    .sidebar-collapsed .app-layout:has(.app-sidebar) .app-wrapper,
    .sidebar-collapsed .app-layout:has(.app-sidebar) .app-footer {
        padding-left: 0;
    }

    /* Breathing room between the bar and the page */
    .app-wrapper .app-main-content.content {
        padding-left: 40px;
        padding-right: 32px;
    }
}

/* --- Desktop: hidden = the bar shrinks to nothing, only the handle stays at the edge --- */
@media (min-width: 992px) {
    .sidebar-collapsed .app-sidebar {
        width: 0;
        border-right-color: transparent;
        box-shadow: none;
    }

    .sidebar-collapsed .sidebar-scroll,
    .sidebar-collapsed .sidebar-footer {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .sidebar-collapsed .sidebar-scroll {
        transform: translateX(-24px);
    }

    .sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }
}

/* --- Phones and tablets: the bar slides over the content --- */
@media (max-width: 991.98px) {
    .app-sidebar {
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform var(--sidebar-speed) var(--sidebar-ease);
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }

    .sidebar-open .sidebar-collapse-btn i {
        transform: rotate(0deg);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 1035;
        inset: var(--app-header-height) 0 0 0;
        display: block;
        background: rgba(5, 9, 20, 0.6);
        backdrop-filter: blur(2px);
    }

        .sidebar-backdrop[hidden] {
            display: none;
        }
}
