﻿html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 0;
}

.footer {
  position: relative;
  width: 100%;
  height: auto;
  line-height: 1.5;
}

main {
  min-height: unset;
}

/* Admin-specific styles */
.navbar-brand strong {
    font-size: 1.2rem;
}

/* ✅ Updated: Only apply hover to dashboard cards, not form cards */
.card.dashboard-card {
    transition: transform 0.2s;
}

.card.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-toolbar {
    margin-bottom: 1rem;
}

.table-actions {
    white-space: nowrap;
}

.badge {
    font-size: 0.75rem;
}

tr .inactive-row {
    background-color:  rgb(250, 219, 219) !important; /* Light red background for inactive rows */
}

/* Universal selector for all inputs */
::placeholder {
    color: #f7b5bf !important; /* Light gray */
    opacity: 1; /* Ensures full color visibility in Firefox */
}

/* Form styling */
.form-label {
    font-weight: 600;
}

.required::after {
    content: " *";
    color: red;
}

/* Alert styling */
.alert {
    margin-top: 1rem;
}

.validation-summary-valid { display: none !important; }

/* Character Counters for all validated fields */
.summary-counter,
.abstract-counter,
.description-counter,
.bio-counter,
.title-counter {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    pointer-events: none;
    z-index: 10;
    font-weight: 600;
}

/* Ensure fields have padding to not overlap with counter */
textarea[data-summary-field="true"],
textarea[data-abstract-field="true"],
textarea[data-description-field="true"] {
    padding-right: 70px !important;
}

input[data-title-field="true"] {
    padding-right: 70px !important;
}


/* Toast UI Editor Customization */
.toastui-editor-defaultUI {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
}

/* Match Bootstrap validation styles */
.input-validation-error + .toastui-editor-defaultUI {
    border-color: #dc3545 !important;
}

/* Hide H1 from toolbar permanently */
.toastui-editor-popup-body button[data-level="1"] {
    display: none !important;
}

/* Adjust toolbar for Bootstrap theme */
.toastui-editor-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* ✅ NEW: HTML Source button styling */
.toastui-editor-toolbar-icons:last-child {
    margin-left: auto;
    border-left: 1px solid #e5e7eb;
    padding-left: 8px;
}

/* ✅ NEW: HTML Source textarea styling */
#toastui_source_container textarea {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 12px;
    line-height: 1.5;
}

/* ✅ NEW: Syntax highlighting for HTML in source view */
.language-html {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 0.375rem;
}

/* Toast UI HTML Source Button in Footer */
.toastui-editor-mode-switch-button[data-mode="htmlSource"] {
    background-color: transparent;
    border: none;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    padding: 8px 12px;
    transition: background-color 0.2s;
}

    .toastui-editor-mode-switch-button[data-mode="htmlSource"]:hover {
        background-color: #f1f3f5;
    }

    .toastui-editor-mode-switch-button[data-mode="htmlSource"].active {
        background-color: #e5e7eb;
        font-weight: 600;
        color: #0d6efd;
    }

/* Adjust mode switch container */
.toastui-editor-mode-switch {
    display: flex;
    align-items: center;
    gap: 0;
}

/* HTML Source View Toolbar */
#toastui_sourceToolbar {
    background: linear-gradient(to bottom, #fafafa, #f0f0f0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Source textarea styling */
textarea[id$="_source"] {
    border-top: none !important;
    resize: vertical;
}

/* Return button hover */
#toastui_returnBtn:hover {
    background-color: #0b5ed7;
}

/* Image Picker Modal */
.image-picker-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

    .image-picker-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-color: #0d6efd;
    }

/* Toast UI heading dropdown customization */
.toastui-editor-popup-body button[data-level="1"],
.toastui-editor-popup-body button[data-level="2"] {
    display: none !important;
}

/* Image in editor */
.toastui-editor-contents img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

/* CodeMirror HTML Editor */
.CodeMirror {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.CodeMirror-focused {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Validation error state */
.input-validation-error + .CodeMirror {
    border-color: #dc3545;
}

/* Image picker cards */
.image-picker-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #0d6efd;
    transition: all 0.2s;
}

/* CodeMirror Editor Styling */
.CodeMirror {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    min-height: 300px;
}

.CodeMirror-focused {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Validation error state */
.input-validation-error + .CodeMirror {
    border-color: #dc3545;
}

/* Tag matching highlights */
.CodeMirror-matchingtag {
    background: rgba(255, 150, 0, 0.3);
}

/* Active line */
.CodeMirror-activeline-background {
    background: #e8f2ff;
}

/* View Mode Toggle Buttons */
.btn-group input[type="radio"].btn-check:checked + label {
    background-color: #0d6efd;
    color: white;
}

/* Smooth panel transitions */
[id$="_codePanel"],
[id$="_previewPanel"] {
    transition: all 0.3s ease;
}

input:required,
select.form-select:required,
textarea.form-control:required {
    background-color: #f8f9fa; /* Light grey tint */
    border-left: 4px solid #0d6efd; /* Blue "important" strip */
    transition: border-color 0.2s;
}

    /* Optional: Change the strip color when they start typing */
    textarea.form-control:required:focus {
        border-left-color: #0a58ca;
        background-color: #ffffff;
    }
select.form-select:required {
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd; /* Adds a blue accent strip */
}

/* Navbar: reduce horizontal padding between lg (992px) and xl (1200px) to prevent wrapping */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar-nav .nav-link {
        padding-inline: 0.4rem;
    }
}

/* ==============================================
   SIDEBAR LAYOUT
   ============================================== */

:root {
    --topbar-height: 54px;
    --sidebar-width: 250px;
    --sidebar-bg: #1e293b;
    --sidebar-item-color: rgba(255, 255, 255, 0.72);
    --sidebar-item-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: rgba(96, 165, 250, 0.18);
    --sidebar-active-color: #93c5fd;
}

/* Top bar — 3-column grid: left | centre | right
   Grid guarantees all three columns share the same row baseline regardless
   of dropdown state, so no child can ever push siblings down. */
#topbar {
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1040;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 0.75rem;
}

.topbar-left  { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-start; }
.topbar-center { display: flex; align-items: center; justify-content: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; }

/* Brand link */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}
.topbar-brand:hover { color: #fff; }

#topbar .nav-link { color: rgba(255, 255, 255, 0.75); }
#topbar .nav-link:hover,
#topbar .nav-link:focus { color: #fff; }

#sidebarToggle {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
    background: none;
    border: none;
}

#sidebarToggle:hover { color: #fff; }

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    transition: width 0.25s ease, min-width 0.25s ease;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-nav { padding: 0.5rem 0 1.5rem; }

/* Top-level items (Dashboard) */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.45rem 0.875rem;
    color: var(--sidebar-item-color);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    margin: 0.1rem 0.5rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item i { font-size: 1rem; width: 1.125rem; flex-shrink: 0; text-align: center; }
.sidebar-item:hover { background: var(--sidebar-item-hover-bg); color: #fff; }
.sidebar-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-color); font-weight: 600; }

/* Section toggle buttons */
.sidebar-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.45rem 0.875rem;
    color: var(--sidebar-item-color);
    font-size: 0.875rem;
    border-radius: 0.375rem;
    margin: 0.1rem 0.5rem;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    width: calc(100% - 1rem);
    text-align: left;
    border: none;
    background: transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section-toggle > i:first-child { font-size: 1rem; width: 1.125rem; flex-shrink: 0; text-align: center; }
.sidebar-section-toggle:hover { background: var(--sidebar-item-hover-bg); color: #fff; }
.sidebar-section-toggle.active { color: var(--sidebar-active-color); }

/* Chevron */
.sidebar-section-toggle .chevron {
    margin-left: auto;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.55;
}

.sidebar-section-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* Sub-items */
.sidebar-sub-items { padding: 0.125rem 0 0.25rem; }

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.75rem 0.32rem 2.375rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.82rem;
    border-radius: 0.375rem;
    margin: 0.05rem 0.5rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-sub-item i { font-size: 0.875rem; width: 1rem; flex-shrink: 0; text-align: center; opacity: 0.85; }
.sidebar-sub-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.sidebar-sub-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-color); font-weight: 600; }

/* Sub-section label */
.sidebar-sub-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem 0.15rem 2.375rem;
    margin: 0 0.5rem;
}

/* Dividers */
.sidebar-divider { border-top: 1px solid rgba(255,255,255,0.07); margin: 0.4rem 0.875rem; }
.sidebar-mini-divider { border-top: 1px solid rgba(255,255,255,0.05); margin: 0.25rem 1.75rem; }

/* Collapsed sidebar — icon-only on desktop */
#sidebar.sidebar-collapsed { width: 56px; min-width: 56px; overflow: visible; }

#sidebar.sidebar-collapsed .sidebar-item span,
#sidebar.sidebar-collapsed .sidebar-section-toggle > span,
#sidebar.sidebar-collapsed .sidebar-sub-items,
#sidebar.sidebar-collapsed .sidebar-divider,
#sidebar.sidebar-collapsed .chevron { display: none; }

/* Prevent Bootstrap collapse panels from showing inside the collapsed rail */
#sidebar.sidebar-collapsed .collapse,
#sidebar.sidebar-collapsed .collapsing { display: none !important; }

/* ── Sidebar flyout panel (shown when collapsed) ─────────────────────────── */
#sidebar-flyout {
    position: fixed;
    left: 56px;           /* flush against the collapsed rail */
    top: var(--topbar-height);
    width: 210px;
    max-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 0.5rem 0;
    box-shadow: 4px 4px 16px rgba(0,0,0,0.45);
    z-index: 1035;
    padding: 0.375rem 0;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#sidebar-flyout.flyout-open { display: block; }

/* Flyout header — mirrors the section toggle label */
#sidebar-flyout .flyout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem 0.4rem 0.75rem;
    color: rgba(255,255,255,0.45);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 0.25rem;
}

/* Flyout clones of sub-items inherit the normal sidebar-sub-item rules
   but without the deep left indent (no icon column offset needed) */
#sidebar-flyout .sidebar-sub-item {
    padding-left: 1rem;
}

#sidebar-flyout .sidebar-sub-label {
    padding-left: 1rem;
}

#sidebar-flyout .sidebar-mini-divider {
    margin: 0.25rem 0.75rem;
}

/* ── Page navigation loading bar ─────────────────────────────────────────── */
#page-load-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 99999;
    transition: none;
    pointer-events: none;
}
#page-load-bar.loading {
    width: 75%;
    transition: width 8s cubic-bezier(0.04, 0.8, 0.2, 1);
}

#sidebar.sidebar-collapsed .sidebar-item,
#sidebar.sidebar-collapsed .sidebar-section-toggle { justify-content: center; padding: 0.6rem; margin: 0.1rem 0.35rem; }

/* Highlight the active flyout trigger */
#sidebar.sidebar-collapsed .sidebar-section-toggle.flyout-active {
    background: var(--sidebar-item-hover-bg);
    color: #fff;
}

/* Main content wrapper */
.main-content-wrapper { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-content-wrapper > main { flex: 1; }

/* Page header bar — standardized full-width page title strip */
.page-header-bar {
    background: var(--sidebar-bg);
    color: rgba(255, 255, 255, 0.95);
    padding: 0.75rem 1.5rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Notification zone — flush below page-header-bar, spacing provided by padding-bottom */
/* flex-direction:column suppresses whitespace text-node anonymous boxes (Razor @if gaps) */
.notification-zone {
    display: flex;
    flex-direction: column;
    padding-bottom: 1.5rem;
}

.notification-zone .alert {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    margin-top: 0;
}

.page-header-bar .page-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.3;
}

.page-header-bar .page-title i { opacity: 0.8; }

/* Constrained page layout — for delete confirmations, simple forms, etc. */
.page-constrained {
    max-width: 680px;
    margin-inline: auto;
}

/* Mobile sidebar */
#sidebarBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0,0,0,0.45);
    z-index: 1025;
}

#sidebarBackdrop.show { display: block; }

@media (max-width: 767.98px) {
    #sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: calc(-1 * var(--sidebar-width));
        height: calc(100vh - var(--topbar-height));
        z-index: 1030;
        transition: left 0.25s ease;
    }

    #sidebar.sidebar-open {
        left: 0;
        box-shadow: 4px 0 16px rgba(0,0,0,0.4);
    }
}

/* ==============================================
   PAGE NAVIGATION LOADING BAR
   ============================================== */

#page-load-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: #60a5fa;
    z-index: 99999;
    transition: none;
    pointer-events: none;
}

#page-load-bar.loading {
    width: 75%;
    transition: width 8s cubic-bezier(0.04, 0.8, 0.2, 1);
}

