/* =========================================================
   GLOBAL RESET & VARIABLES
========================================================= */
:root {
    --wfms-blue: #0274be;
    --wfms-orange: #ee7928;
    --muted: #6c757d;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: clamp(14.5px, 0.83vw, 16px);
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow-x: hidden;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f6f8fb;
}

img {
    /*    max-width: 100%;*/
    /*    height: auto;*/
    height: 55px;
}

/* =========================================================
   GLOBAL MODALS RESPONSIVENESS
========================================================= */
.modal-dialog {
    width: 95%;
    max-width: 32rem;
    margin: 1.75rem auto;
}
.modal-sm {
    max-width: 20rem;
}
.modal-lg {
    max-width: 50rem;
}
.modal-xl {
    width: 92%;
    max-width: 71.25rem;
}
.modal-content {
    border-radius: 0.75rem;
}
.modal-header {
    padding: 1rem 1.25rem;
}
.modal-body {
    padding: 1.25rem;
}
.modal-footer {
    padding: 0.75rem 1rem;
}

/* Modal Internal Typography */
.modal-title {
    font-size: 1.25rem;
}
.modal-body p,
.modal-body span,
.modal-body input,
.modal-body select,
.modal-body textarea,
.modal-body button,
.modal-footer button {
    font-size: 0.875rem;
}
.modal-body label {
    font-size: 0.875rem;
}

/* =========================================================
   GLOBAL LABEL STYLING
========================================================= */
label {
    font-weight: 600 !important;
}

/* =========================================================
   GLOBAL PLACEHOLDER STYLING (FADED)
========================================================= */
::placeholder {
    color: #94a3b8 !important;
    opacity: 0.65 !important;
}
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: #94a3b8 !important;
    opacity: 0.65 !important;
}

/* Soft fade dropdowns & Select2 search-dropdowns when selected option is blank or zero */
select:has(option[value=""]:checked),
select:has(option[value="0"]:checked),
select:has(option[value=""]:checked) + .select2-container .select2-selection__rendered,
select:has(option[value="0"]:checked) + .select2-container .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #7a828a !important;
    opacity: 0.85 !important;
}
select option,
.select2-results__option {
    color: #334155 !important;
    opacity: 1 !important;
}

/* =========================================================
   GLOBAL MODALS RESPONSIVENESS
========================================================= */
.modal-dialog {
    width: 95%;
    max-width: 32rem;
    margin: 1.75rem auto;
}
.modal-sm {
    max-width: 20rem;
}
.modal-lg {
    max-width: 50rem;
}
.modal-xl {
    width: 92%;
    max-width: 71.25rem;
}
.modal-content {
    border-radius: 0.75rem;
}
.modal-header {
    padding: 1rem 1.25rem;
}
.modal-body {
    padding: 1.25rem;
}
.modal-footer {
    padding: 0.75rem 1rem;
}

/* Modal Internal Typography */
.modal-title {
    font-size: 1.25rem;
}
.modal-body p,
.modal-body span,
.modal-body input,
.modal-body select,
.modal-body textarea,
.modal-body button,
.modal-footer button {
    font-size: 0.875rem;
}
.modal-body label {
    font-size: 0.95rem;
}

/* =========================================================
   GLOBAL LABEL STYLING
========================================================= */
label {
    font-weight: 600 !important;
}

/* =========================================================
   GLOBAL PLACEHOLDER STYLING (FADED)
========================================================= */
::placeholder {
    color: #94a3b8 !important;
    opacity: 0.65 !important;
}
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: #94a3b8 !important;
    opacity: 0.65 !important;
}

/* Soft fade dropdowns & Select2 search-dropdowns when selected option is blank or zero */
select:has(option[value=""]:checked),
select:has(option[value="0"]:checked),
select:has(option[value=""]:checked) + .select2-container .select2-selection__rendered,
select:has(option[value="0"]:checked) + .select2-container .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #7a828a !important;
    opacity: 0.85 !important;
}
select option,
.select2-results__option {
    color: #334155 !important;
    opacity: 1 !important;
}

/* =========================================================
   LAYOUT WRAPPER
========================================================= */
.layout-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   SIDEBAR
========================================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 17.5rem;
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s ease, transform .3s ease;
    z-index: 999;
}

/* Collapsed desktop sidebar */
.sidebar.collapsed {
    width: 4rem;
}

/* Sidebar brand */
.sidebar .brand {
    /*     padding: 14px;*/
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    height: 4.0625rem;
}

.menu {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

.menu::-webkit-scrollbar {
    width: 5px;
}

.menu::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.menu::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Sidebar navigation */
.sidebar .nav-item {
    margin: 6px 8px;
    border-radius: 10px;
    overflow: hidden;
}

/*    .sidebar .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        font-weight: 600;
        color: var(--wfms-blue);
        border-radius: 8px;
        background: transparent;
        transition: all .18s ease;
        white-space: nowrap;
    }

        .sidebar .nav-link i {
            font-size: 1.125rem;
            width: 26px;
            text-align: center;
        }*/

.sidebar .nav-link {
    display: flex;
    align-items: center;
    /* 🚀 Vertically center icons and text */
    gap: 12px;
    padding: 10px 14px;
    line-height: normal;
    font-size: 0.9062rem;
    font-weight: 600;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--wfms-blue);
    text-decoration: none;
}

.sidebar .nav-link i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1.125rem;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar .nav-link span {
    display: block;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
    /* Better for centering */
    padding-right: 4px;
    font-family: inherit;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link::after {
    content: attr(data-title);
    position: absolute;
    left: 72px;
    background: #1f2937;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity .15s ease;
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--wfms-orange);
}

.sidebar .nav-link:hover i {
    transform: rotate(15deg);
}

/* Hide text when collapsed */
.sidebar.collapsed .nav-link span {
    display: none;
}

/* Disabled links */
.nav-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =========================================================
   SIDEBAR OVERLAY (MOBILE)
========================================================= */
/*.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    z-index: 998;
}

    .sidebar-overlay.show {
        display: block;
    }*/

/* =========================================================
   SIDEBAR OVERLAY (MOBILE ONLY)
========================================================= */

.sidebar-overlay {
    display: none;
}

/* Only show overlay on mobile */
@media (max-width: 991px) {
    .sidebar-overlay.show {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 998;
        display: block;
    }

    img {
        height: 35px;
    }
}


/* =========================================================
   TOPBAR
========================================================= */
.topbar {
    height: 4rem;
    margin-left: 17.5rem;
    background: linear-gradient(90deg, var(--wfms-blue), #1b67a9);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.125rem;
    color: #fff;
    transition: margin-left .25s ease;
}

.topbar.collapsed {
    margin-left: 4rem;
}

.topbar .searchbar input {
    border-radius: 25px;
    padding: 8px 18px;
    border: none;
    width: 320px;
    transition: all .25s ease;
}

.topbar .searchbar input:focus {
    outline: none;
    width: 380px;
}

.topbar .session-select select {
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 600;
    border: none;
    background: #0274be;
    color: #fff;
    cursor: pointer;
}

.topbar .actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Clean Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-top: 1px solid #edf2f7;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer {
    display: none;
}

.company-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}

.company-name-text {
    font-size: 0.8438rem;
    font-weight: 600;
    color: #334155;
    display: block;
    word-break: break-word;
    line-height: 1.4;
}

/* Hide when sidebar is collapsed */
.sidebar.collapsed .sidebar-expanded-only {
    display: none !important;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main {
    margin-left: 17.5rem;
    padding: 1.375rem;
    flex: 1;
    transition: margin-left .25s ease;
}

.main.collapsed {
    margin-left: 4rem;
}

/* =========================================================
   SUBMODULE / CHILD CARDS
   ========================================================= */
.submodules-grid {
    margin-top: 0.375rem;
}

.sub-card {
    padding: 1rem;
    display: flex;
    gap: 0.875rem;
    cursor: pointer;
    transition: all .2s ease;
}

.sub-card:hover {
    transform: translateY(-3px);
}

.sub-card i {
    font-size: 1.875rem;
    color: var(--wfms-blue);
}

.sub-card h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #12263f;
}

.sub-card small {
    color: var(--muted);
    display: block;
    min-height: 2.6em;
}

.sub-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =========================================================
   FOOTER
========================================================= */
.wfms-footer {
    /*    background: #1f2937;*/
    /*    color: #fff;*/
    text-align: center;
    padding: 10px 0;
    border-top: 1px solid #e6e6e6;
}

/* =========================================================
   BREADCRUMBS
========================================================= */
#breadcrumbs {
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

#breadcrumbs ul {
    list-style: none;
    display: flex;
    align-items: center;
    /* 🚀 Center breadcrumb icons and text */
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

#breadcrumbs li+li::before {
    content: ">";
    margin: 0 8px;
    color: #6c757d;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
========================================================= */

/* Tablets & Mobile */
@media (max-width: 991px) {

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    img {
        height: 35px;
    }

    .topbar,
    .main {
        margin-left: 0 !important;
    }

    .topbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 12px;
    }

    .topbar .searchbar input {
        width: 200px;
    }

    #LoginName {
        display: none;
    }

    .submodules-grid .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Mobile */
@media (max-width: 576px) {

    .topbar .searchbar {
        width: 100%;
    }

    img {
        height: 35px;
    }

    .topbar .searchbar input {
        width: 100%;
    }

    .submodules-grid .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sidebar {
        width: 220px;
    }
}


/* Breadcrumb base */
#breadcrumbs ul li {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.875rem;
}

/* Current breadcrumb (last item) */
.breadcrumb-current {
    color: #6c757d;
    cursor: default;
}

.breadcrumb-link {
    /*color: #0274be;*/
    color: #0274be;
    cursor: pointer;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-current {
    color: #6c757d;
    cursor: default;
}

:root {
    --primary: #0274be;
    --primary-dark: #015a94;
    --accent: #ee7928;
    --accent-dark: #d96518;
    --glass-bg: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.25);
}

/* Floating Chat Icon */
#chatbotIcon {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.75rem;
    z-index: 10000;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

#chatbotIcon:hover {
    transform: scale(1.08);
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    /* Position in bottom-right corner, above the chat icon */
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 520px;
    max-width: 90vw;
    max-height: 80vh;
    min-width: 320px;
    min-height: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(18px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    /* Hidden by default, will be shown via JavaScript */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Show chat window when active */
.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Added expanded state styles */
.chatbot-window.expanded {
    width: 600px;
    height: 700px;
    bottom: 20px;
    right: 20px;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    z-index: 10;
    /* Added background for debugging - remove after testing */
}

/* Edge handles - increased hit area */
.resize-n {
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    cursor: ns-resize;
}

.resize-e {
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
}

.resize-s {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    cursor: ns-resize;
}

.resize-w {
    top: 0;
    left: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
}

/* Corner handles - larger hit area */
.resize-ne {
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nesw-resize;
    /* Increased z-index to ensure corners are above edges */
    z-index: 11;
}

.resize-se {
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 0%, transparent 50%, rgba(2, 116, 190, 0.3) 50%);
    border-bottom-right-radius: 16px;
    z-index: 11;
}

.resize-se:hover {
    background: linear-gradient(135deg, transparent 0%, transparent 50%, rgba(2, 116, 190, 0.5) 50%);
}

.resize-sw {
    bottom: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nesw-resize;
    z-index: 11;
}

.resize-nw {
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 11;
}

/* Header */
.chatbot-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

#closeChatbot {
    cursor: pointer;
    opacity: 0.85;
    font-size: 1.25rem;
}

#closeChatbot:hover {
    opacity: 1;
    color: var(--accent);
}

#expandChatbot:hover {
    opacity: 1;
    color: var(--accent);
}

/* Body */
.chatbot-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
}

/* Scrollbar */
.chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(2, 116, 190, 0.45);
    border-radius: 3px;
}

.chatbot-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
}

/* Messages */
.bot-msg {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    align-self: flex-start;
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 10px;
    max-width: 85%;
    word-wrap: break-word;
}

.user-msg {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    align-self: flex-end;
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 10px;
    max-width: 85%;
    word-wrap: break-word;
}

/* Typing Indicator */
.bot-typing {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(2, 116, 190, 0.25);
    border-radius: 14px;
    width: fit-content;
    margin-bottom: 10px;
}

.bot-typing span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.bot-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.bot-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input */
.chatbot-input {
    padding: 10px;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.95);
}

.chatbot-input input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    outline: none;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.95);
}

.chatbot-input input::placeholder {
    color: #777;
}

.chatbot-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(2, 116, 190, 0.25);
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 90px;
    }

    img {
        height: 35px;
    }

    /* Expanded state on mobile takes full screen */
    .chatbot-window.expanded {
        width: calc(100vw - 20px);
        height: calc(100vh - 40px);
        right: 10px;
        bottom: 20px;
    }

    #chatbotIcon {
        right: 15px;
        bottom: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}


.searchbar {
    position: relative;
    width: 420px;
}

#globalSearch {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9375rem;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    outline: none;
    transition: all .2s ease;
}

#globalSearch:focus {
    border-color: #4f6df5;
    box-shadow: 0 0 0 3px rgba(79, 109, 245, 0.15);
}

.global-search-results {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    max-height: 360px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #eef0f4;
    display: none;
    z-index: 9999;
    animation: fadeIn .15s ease-in-out;
}

/* Scrollbar */
.global-search-results::-webkit-scrollbar {
    width: 6px;
}

.global-search-results::-webkit-scrollbar-thumb {
    background: #cfd6e4;
    border-radius: 10px;
}

.global-search-item {
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background .15s ease, transform .05s ease;
}

.global-search-item:not(:last-child) {
    border-bottom: 1px solid #f1f3f7;
}

.global-search-item strong {
    font-size: 0.9375rem;
    color: #1f2937;
    font-weight: 600;
}

.global-search-item small {
    font-size: 0.8125rem;
    color: #6b7280;
}

.global-search-item:hover {
    background: linear-gradient(90deg, #eef2ff, #ffffff);
    transform: translateX(2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}