:root {
    --primary-color: #6C63FF;
    --accent-color: #FF6584;
    --background-color: #F5F7FA;
    --text-color: #333333;
    --sidebar-collapsed-width: 80px;
    --sidebar-expanded-width: 250px;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    font-family: 'Lato', sans-serif;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Poppins', sans-serif;
}

#main-content {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
    margin-left: var(--sidebar-expanded-width);
}

#main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width);
}


.table-hover tbody tr:hover {
    background-color: #f1f3f5;
}

.table th {
    cursor: pointer;
    user-select: none;
}

.table th[data-sort-key]::after {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f0dc";
    opacity: 0.4;
    margin-left: 5px;
}

.table th.sorted-asc::after {
    content: "\f0de";
    opacity: 1;
}

.table th.sorted-desc::after {
    content: "\f0dd";
    opacity: 1;
}


.modal-header {
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

.badge {
    font-size: 0.8rem;
    font-weight: 600;
}

.nav-link {
    padding: 0.75rem 1rem;
    color: #495057;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.25rem;
}

.nav-link .link-text {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}


@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .dashboard-counter {
        margin-bottom: 1rem;
    }
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-expanded-width);
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 1rem;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding-left: 12px;
    padding-right: 12px;
}

#sidebar.collapsed #userMenuDropdown .me-2 {
    margin-right: 0 !important;
}

#sidebar.collapsed .link-text {
    opacity: 0;
}

#sidebar.collapsed .nav-link.active {
    border-radius: 0.375rem;
}

.dropdown-menu {
    width: 100%;
}

.no-resize {
    resize: none;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn {
    transition: transform 0.2s ease;
}

.btn:hover {
    transform: scale(1.05);
}


.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#tickets-table-body tr {
    cursor: pointer;
}

#main-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-content>main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.content-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.content-section>.row {
    flex: 1;
    min-height: 0;
}

.content-section>.row>[class*="col-"] {
    display: flex;
    flex-direction: column;
}

.content-section>.row>[class*="col-"]>.card {
    flex: 1; /* Allows the card to grow and fill the column */
    min-height: 0; /* Important for flexbox scrolling */
    display: flex;
    flex-direction: column;
}

.card>.card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.card-body {
    display: flex;
    flex-direction: column;
}

.scrollable-card-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tab-content {
    flex-grow: 1;
    /* Allows the tab content to fill available space */
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Important for flexbox scrolling */
}

.tab-content>.tab-pane {
    flex-grow: 1;
    /* Ensures the active pane fills the tab-content area */
    overflow-y: auto;
    /* Adds scrolling only to the content pane */
    display: none;
    /* Hide panes by default */
}

.tab-content>.active {
    display: block;
    /* Show the active pane */
}

.description-scroll-container {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.scrollable-list-container {
    max-height: 550px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    padding: .5rem;
}

.placeholder-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}
/* This new rule ensures Summernote's content is contained. */
.note-editor.note-frame {
    border: none;
    box-shadow: none;
}

.note-editor .note-editable {
    overflow-y: auto;
    /* Adjust height to fit within its container */
    max-height: 230px; 
}
/* ========================================= */
/* == NEW OFF-CANVAS RESPONSIVE STYLES    == */
/* ========================================= */

/* Mobile Navigation Bar */
.mobile-nav {
    display: none;
    /* Hidden on desktop */
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    position: fixed;
    /* Changed to fixed */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    /* Ensures it's above other content */
}

#menu-toggle-btn {
    font-size: 1.25rem;
}

/* Sidebar Overlay */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    /* Above content, below sidebar */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Tablet and Mobile Breakpoint */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        /* Allow the entire page to scroll */
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS devices */
    }

    #main-content {
        height: auto;
        /* Allow content to determine the height */
        overflow-y: visible;
        /* Prevent a double scrollbar */
        padding: 1rem;
        padding-top: 66px;
    }

    header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    header h1 {
        font-size: 1.5rem;
        /* Adjust font size for mobile */
    }

    .mobile-nav {
        display: flex;
        /* Show the mobile nav */
        align-items: center;
    }

    #main-content,
    #main-content.collapsed {
        margin-left: 0;
        /* Let content take full width */
        padding-top: 56px;
        /* Add padding to account for the fixed mobile nav height */
    }

    /* Off-canvas sidebar styles */
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        /* Standard width for a slide-out menu */
        transform: translateX(-100%);
        /* Start off-screen */
        transition: transform 0.3s ease-in-out;
        z-index: 1050;
        /* Keep sidebar on top of everything */
        border-right: 1px solid #dee2e6;
        /* Remove the desktop hover effect */
        pointer-events: auto;
    }

    #sidebar.active {
        transform: translateX(0);
        /* Slide in */
    }

    /* Override desktop collapsed/hover styles for mobile */
    #sidebar.collapsed {
        width: 250px;
    }

    #sidebar.collapsed .link-text {
        opacity: 1;
    }

    .row.mb-4 {
        flex-direction: column;
    }

    /* Style the individual summary cards for mobile */
    .row.mb-4 .card-body {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.25rem;
    }

    .row.mb-4 .card-title {
        margin-bottom: 0;
        font-size: 1rem;
    }

    .row.mb-4 .card-text {
        font-size: 1.75rem;
        font-weight: 700;
    }

    /* === NEW STYLES FOR MODAL-BASED MOBILE UI === */
    /* Hide the detail column on mobile */
    #ticket-section .col-md-7,
    #task-section .col-md-7 {
        display: none;
    }

    /* Make the list column take up the full width */
    #ticket-section .col-md-5,
    #task-section .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ========================================= */
/* == SUB-TASK STYLES                     == */
/* ========================================= */

.subtask-item {
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: box-shadow 0.2s ease-in-out;
}

.subtask-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.subtask-item .form-check-label {
    font-weight: 500;
}

.subtask-item .subtask-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

.subtask-item .subtask-description {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding-left: 1.75rem; /* Indent description */
}

#add-subtask-form {
    border: 1px solid #dee2e6;
    padding: 1rem;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

.subtask-completed {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.subtask-completed .form-check-label,
.subtask-completed .subtask-description {
    text-decoration: line-through;
    color: #6c757d;
}

.scrollable-subtask-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    padding: .5rem;
    margin-bottom: 1rem;
}

.accordion-button:not(.collapsed) {
    color: #fff;
    background-color: var(--primary-color);
}

.accordion-button:focus {
    z-index: 3;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(108, 99, 255, 0.25);
}

#ticket-section .col-md-7,
#task-section .col-md-7 {
    height: calc(100vh - 160px); /* Sets a fixed height */
    display: flex;
    flex-direction: column;
}

/* Dashboard Specific Styles */
#dashboard-ticket-pagination-controls,
#dashboard-task-pagination-controls {
    /* Allow pagination buttons to wrap to the next line on smaller screens */
    flex-wrap: wrap;
}

/* Custom Pagination Styles */
.pagination-custom {
    display: flex;
    justify-content: center;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
}

.pagination-custom .page-item .page-link {
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid #dee2e6;
    margin: 0 2px;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.pagination-custom .page-item .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination-custom .page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination-custom .page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination-custom .page-item.disabled .page-link,
.pagination-custom .page-item.disabled .page-link:hover {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination-custom .page-item .page-link-ellipsis {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}