:root {
    --primary-dark: #202945;
    --accent-blue: #0097ff;
    --light-grey: #f8f9fa;
    --light-blue-bg: #e9f5ff;
    --text-dark: #343a40;
    --text-muted: #6c757d;
    --accent-green: #198754;
    --light-green-bg: #e8f3ee;
    --dark-green-bg: #d1e7dd;
    --ghost-grey-bg: #f8f9fa;
}

/* ========================================================== */
/* START: DEFINITIVE MOBILE-FIRST LAYOUT                      */
/* ========================================================== */
html, body {
    height: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll on body */
}

.main-container {
    display: flex;
    min-height: 100vh;
}

/* --- Mobile-First Sidebar (Off-Canvas) --- */
.sidebar {
    width: 250px;
    background-color: #ffffff;
    border-right: 1px solid #dee2e6;
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1040;
    transform: translateX(-250px); /* Hidden by default on mobile */
    overflow-y: auto;
}

body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0); /* Slides in when active */
}

.sidebar-content-wrapper {
    padding: 1.5rem;
}

.content {
    width: 100%;
    padding: 2rem;
    padding-top: 5.5rem; /* Space for the mobile header */
    background-color: var(--light-grey);
}

/* --- Mobile Header --- */
.mobile-header {
    display: flex; /* Will be overridden on desktop */
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

    .mobile-header .logo {
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .mobile-header .logo img {
            height: 30px;
        }

        .mobile-header .logo h5 {
            margin: 0;
            font-size: 1.2rem;
        }

/* --- Mobile Overlay --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1039;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

body:not(.sidebar-collapsed) .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

/* ========================================================== */
/* --- Desktop Layout --- */
@media (min-width: 992px) {
    .mobile-header, .sidebar-overlay {
        display: none !important;
    }

    .main-container {
        position: relative;
        height: 100vh;
        overflow: hidden; /* Main container does not scroll */
    }

    .sidebar {
        position: relative; /* Back to normal flow in the container */
        transform: translateX(0) !important;
        transition: width 0.3s ease-in-out;
        height: 100%;
    }

    .content {
        height: 100%;
        overflow-y: auto; /* The CONTENT area is the scrolling part */
        padding: 2rem;
        transition: none; /* No padding transition needed on desktop */
    }

    /* Desktop Collapsed State */
    body.sidebar-collapsed .sidebar {
        width: 88px;
    }

    body.sidebar-collapsed .sidebar-text,
    body.sidebar-collapsed .logo h5 {
        opacity: 0;
        visibility: hidden;
        width: 0;
    }

    body.sidebar-collapsed .nav-link {
        justify-content: center;
    }

    body.sidebar-collapsed .logo img {
        width: 36px;
    }
}
/* ========================================================== */
/* END: DEFINITIVE MOBILE-FIRST LAYOUT                      */
/* ========================================================== */


/* --- Sidebar Content Styles (NOT LAYOUT) --- */
#sidebar-toggle {
    position: absolute;
    top: 1.5rem;
    right: -18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #fff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.sidebar .logo-header {
    margin-bottom: 2rem;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

    .sidebar .logo img {
        width: 40px;
        transition: width 0.3s ease-in-out;
    }

    .sidebar .logo h5 {
        color: var(--primary-dark);
        font-weight: 600;
        margin: 0;
    }

    .sidebar .logo .sidebar-text {
        white-space: nowrap;
        opacity: 1;
        transition: opacity 0.2s ease-in-out;
    }

.sidebar .nav-link {
    color: var(--text-dark);
    font-weight: 400;
    padding: 0.5rem 1rem;
    margin-bottom: 0.1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

    .sidebar .nav-link .bi {
        font-size: 1.2rem;
        color: var(--text-muted);
        transition: color 0.2s ease-in-out;
    }

    .sidebar .nav-link .sidebar-text {
        margin-left: 0.75rem;
    }

    .sidebar .nav-link:hover {
        background-color: var(--light-grey);
    }

    .sidebar .nav-link.active, .sidebar .nav-link.active:hover {
        background-color: var(--light-blue-bg);
        color: var(--accent-blue);
    }

        .sidebar .nav-link.active .bi {
            color: var(--accent-blue);
        }

/* --- HIDE SCROLLBARS --- */
.sidebar::-webkit-scrollbar, .kanban-cards::-webkit-scrollbar {
    display: none;
}

.sidebar, .kanban-cards {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.kanban-card-description.wysiwyg-content {
    overflow-wrap: break-word;
    /* You can also use the older 'word-wrap' property for maximum compatibility */
    word-wrap: break-word;
}

/* ============================================= /
/ --- SPECIAL "APP" PAGE RULES --- /
/ ============================================= */
.content.content--full-height {
    padding: 0;
    display: flex;
    flex-direction: column;
}

    .content.content--full-height > .page-container {
        flex-grow: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 2rem;
    }


/* ============================================= /
/ --- Login Screen Styles --- /
/ ============================================= */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}


/* ============================================= /
/ --- Global Content Styles --- /
/ ============================================= */
.wysiwyg-content p {
    margin-bottom: 0.5rem;
}

.wysiwyg-content ul, .wysiwyg-content ol {
    padding-left: 1.5rem;
}


/* ============================================= /
/ --- Kanban & Project Page Styles --- /
/ ============================================= */
.kanban-header, .gantt-header {
    flex-shrink: 0;
}

.kanban-header {
    flex-shrink: 0;
}

.kanban-board-wrapper {
    flex-grow: 1;
    overflow-x: auto; /* ONLY scroll horizontally here /
overflow-y: hidden; / Disable vertical scroll here */
    padding-bottom: 1rem;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    height: 100%;
    width: max-content;
}

.kanban-lane {
    flex: 0 0 400px;
    min-width: 400px;
    background-color: #f4f5f7;
    border-radius: 0.5rem;
    display: flex; /* This allows the child .kanban-cards to grow */
    flex-direction: column;
    height: 100%;
}

.kanban-lane-title {
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
}


/* For Kanban Page */
.content:has(#kanban-page-container) {
    padding: 0;
    overflow: hidden; /* The main content area should NOT scroll */
}

#kanban-page-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill the fixed-height content area */
    padding: 1rem; /* Apply padding here instead */
}

.kanban-board-wrapper {
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 1rem;
    min-height: 0;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    height: 100%;
    width: max-content;
}

.kanban-lane {
    flex: 0 0 400px;
    min-width: 400px;
    background-color: #f4f5f7;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.kanban-lane-title {
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
}

.kanban-cards {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    min-height: 0;
}

.kanban-card, .project-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
    position: relative;
}

.kanban-card {
    padding: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

    .kanban-card:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

.kanban-card-title {
    font-weight: 600;
    margin-bottom: 0;
    padding-left: 0;
    transition: padding-left 0.3s ease-in-out;
}

.kanban-card.is-priority .kanban-card-title {
    padding-left: 1.5rem;
}

.kanban-card-description {
    flex-grow: 1;
}

.sortable-ghost {
    opacity: 0.4;
    background: #cce5ff;
}

.sortable-drag {
    opacity: 1 !important;
}

.kanban-card-footer {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.kanban-card-dates {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.kanban-card-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8em;
    color: var(--text-muted);
}

.kanban-card-footer-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.kanban-card-assignees {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8em;
    margin-right: auto;
}

.kanban-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.wysiwyg-content.collapsed {
    max-height: 84px;
    overflow: hidden;
    position: relative;
}

    .wysiwyg-content.collapsed::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 30px;
        background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
    }

.show-more-btn {
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-top: 0.25rem;
}

.kanban-archived-section {
    margin-top: auto;
    padding-top: 0.5rem;
}

.kanban-archived-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 500;
}

    .kanban-archived-toggle:hover {
        color: var(--text-dark);
    }

    .kanban-archived-toggle .bi {
        transition: transform 0.2s ease-in-out;
    }

    .kanban-archived-toggle.open .bi {
        transform: rotate(180deg);
    }

.kanban-archived-cards {
    display: none;
    padding-top: 0.5rem;
}

    .kanban-archived-cards.open {
        display: block;
    }

.kanban-card.archived {
    opacity: 0.65;
    background-color: #f8f9fa;
}

    .kanban-card.archived:hover {
        opacity: 1;
    }

.kanban-card-project-pill {
    font-size: 0.75em;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    background-color: var(--light-blue-bg);
    color: var(--accent-blue);
    border-radius: 0.25rem;
    display: inline-block;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.kanban-card-priority-icon {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-size: 1rem;
}

.kanban-card.is-priority {
    border-left: 4px solid #dc3545;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

    .kanban-card.is-priority:hover {
        box-shadow: 0 6px 12px rgba(220, 53, 69, 0.3);
    }

a.project-card-link, a.project-card-link:hover {
    text-decoration: none;
    color: inherit;
}


/* Add these new styles to your "Kanban & Project Page Styles" section */

.kanban-card-header-badges {
    display: flex;
    flex-shrink: 0;
    gap: 0.25rem;
    align-items: center; /* Vertically align badges and button */
}

/* Override the old, large button style */
.js-clone-card {
    position: static; /* No longer absolutely positioned */
    opacity: 1; /* Always visible */
    border-radius: 0.25rem; /* Match badge radius */
    padding: 0.1em 0.4em; /* Make it small like a badge */
    line-height: 1;
    font-size: 0.9em; /* Adjust size */
    width: auto;
    height: auto;
}

    /* Optional: a subtle hover effect */
    .js-clone-card:hover {
        background-color: var(--bs-secondary);
        color: #fff;
    }

/* ============================================= /
/ --- Modal Styles --- /
/ ============================================= */
.modal-dialog.modal-kanban {
    max-width: 90%;
}

@media (min-width: 1400px) {
    .modal-dialog.modal-kanban {
        max-width: 1320px;
    }
}

.comment-list {
    max-height: 200px;
    overflow-y: auto;
}

.comment {
    background: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.checklist-group .form-check {
    margin-left: 1.5rem;
}

.checklist-group .form-control-sm {
    padding: 0.25rem 0.5rem;
}

/* ============================================= /
/ --- Dashboard Page Styles --- /
/ ============================================= */
.dashboard-project-card a {
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s ease-in-out;
}

.dashboard-project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

    .dashboard-project-card:hover a {
        color: var(--accent-blue);
    }

.kpi-card-sm .card-body {
    padding: 1rem;
}

.kpi-card-sm .kpi-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.kpi-card-sm .kpi-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.card-header .form-check-label {
    color: white;
    font-weight: normal;
    font-size: 0.85rem;
}

.card-header .form-check-input {
    cursor: pointer;
}

/* ============================================= /
/ --- Gantt Page Styles --- /
/ ============================================= */
.content:has(#gantt-page-container) {
    overflow: hidden; /* Gantt needs a fixed container */
    padding-top: 0;
    padding-bottom: 0;
}

#gantt-page-container .gantt-header {
    flex-shrink: 0;
}

/* The rest of your Gantt styles are fine. */
#gantt-page-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#gantt-page-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill the entire content area, which is now fixed height */
}

.gantt-header, .gantt-filters {
    flex-shrink: 0;
}
#gantt-page-container .card.flex-grow-1 {
    min-height: 0; /* Important flexbox fix */
}


.gantt-board-wrapper {
    flex-grow: 1;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background-color: #fff;
}

.gantt_task_line.gantt_project {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

    .gantt_task_line.gantt_project .gantt_task_content {
        font-weight: bold;
        color: #343a40;
    }

    .gantt_task_line.gantt_project .gantt_task_progress {
        display: none;
    }

/* ============================================= /
/ --- Utility Styles --- /
/ ============================================= */
.autosize-textarea {
    resize: auto;
    overflow: hidden;
    min-height: 31px;
}

.mention {
    background-color: var(--light-blue-bg);
    color: var(--primary-dark);
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 4px;
}

#comment-editor-container .ql-editor {
    font-size: 0.9rem;
}


/* ============================================= */
/* --- Priority Planner Page Styles --- */
/* ============================================= */
.planner-container {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 12rem);
}

.planner-source-lane {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    background-color: #e9ecef;
    border-radius: 0.5rem;
}

.planner-lanes-wrapper {
    flex-grow: 1;
    overflow-x: auto;
}

.planner-lanes-container {
    display: flex;
    gap: 1rem;
    height: 100%;
    width: max-content;
}

.planner-lane {
    flex: 0 0 320px;
    min-width: 320px;
    background-color: #f4f5f7;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.planner-lane-title {
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
}

.planner-cards {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 100px;
}

.planner-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: grab;
    transition: all 0.2s ease-in-out;
    position: relative; /* Needed for absolute positioning of the icon */
}

#source-cards .planner-card.is-assigned {
    background-color: var(--light-green-bg);
}

#source-cards .planner-card.placed {
    background-color: var(--ghost-grey-bg);
    border-style: dashed;
    opacity: 0.7;
}

#source-cards .planner-card.is-assigned.placed {
    background-color: var(--light-green-bg);
    border-style: dashed;
    opacity: 0.7;
}

.planner-lane .planner-card.is-assigned {
    background-color: var(--dark-green-bg);
    border-color: var(--accent-green);
}

.sortable-ghost.planner-card {
    opacity: 0.4;
    background: #cce5ff;
}

.planner-lane.planner-lane--loading .planner-cards {
    opacity: 0.5;
    pointer-events: none;
}

.planner-card-title {
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 0.25rem;
    /* Add padding to the right to prevent long titles from overlapping the icon */
    padding-right: 2rem;
}

.planner-card-project {
    font-size: 0.8em;
    color: var(--text-muted);
}

.planner-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}


/* ============================================= */
/* START: NEW ICON AND FOOTER STYLES             */
/* ============================================= */
.indicator-source {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    flex-shrink: 0;
    font-size: 0.8em;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    color: #fff;
    cursor: help;
    display: inline-flex;
    align-items: center;
}

.indicator-source--assigned {
    background-color: var(--accent-blue);
}

.indicator-source--planned {
    background-color: #6c757d;
}

.indicator-source--both {
    background-color: var(--accent-green);
}

planner-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.75em;
    font-weight: bold;
}

.planner-card-estimate {
    color: var(--text-muted);
}

.planner-card-lane {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.planner-card-dates {
    color: var(--accent-blue);
    text-align: right;
}
/* ============================================= */
/* END: NEW ICON AND FOOTER STYLES               */
/* ============================================= */



/* Add this anywhere in your CSS */
.card .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,0.03);
}



/* Add this to your main CSS file */
a.project-card-link,
a.project-card-link:hover {
    text-decoration: none;
    color: inherit; /* Inherit the default text color */
}