/* =================================================================
   JIRA COLOR OVERRIDE (GLOBAL)
   ================================================================= */
/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --ds-primary: #f7941d;
    --ds-primary-hover: #e07f0d;

    /* Ghi đè biến gốc của Bootstrap 5 */
    --bs-primary: #f7941d;
    --bs-primary-rgb: 247, 148, 29;
    --bs-link-color: #f7941d;
    --bs-link-hover-color: #e07f0d;

    /* Unified Fonts */
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Ép buộc các class thông dụng */
.bg-primary {
    background-color: var(--ds-primary) !important;
}

.text-primary {
    color: var(--ds-primary) !important;
}

.border-primary {
    border-color: var(--ds-primary) !important;
}

/* Nút bấm */
.btn-primary {
    background-color: var(--ds-primary);
    border-color: var(--ds-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--ds-primary-hover) !important;
    border-color: var(--ds-primary-hover) !important;
}

/* Nút Outline */
.btn-outline-primary {
    color: var(--ds-primary);
    border-color: var(--ds-primary);
}

.btn-outline-primary:hover {
    background-color: var(--ds-primary);
    border-color: var(--ds-primary);
}

/* Tab & Nav */
.nav-pills .nav-link.active,
.dropdown-item.active,
.list-group-item.active {
    background-color: var(--ds-primary) !important;
}

/* Sidebar (Giữ màu Navy đậm đặc trưng hoặc đổi sang Primary tùy bạn) */
#sidebar-wrapper {
    background-color: #0747a6 !important;
    /* Màu Navy chuẩn Jira cũ, rất hợp với màu Primary mới */
}

/* =================================================================
   VST BLUE THEME - GLOBAL STYLES
   ================================================================= */

:root {
    /* Color Palette */
    --ds-background-default: #ffffff;
    /* Nền trang */
    --ds-background-subtle: #f4f6f8;
    /* Nền vùng nội dung */

    /* MÀU CHỦ ĐẠO: VST THEME */
    /* Primary Action Color (VST Orange) */
    --ds-primary: #ee831c;
    --ds-primary-hover: #d67618;

    /* Sidebar Background (VST Navy - Darker to contrast Orange) */
    --ds-sidebar-bg: #091E42;

    --ds-text: #172b4d;
    --ds-text-subtle: #6b778c;
    --ds-border: #dfe1e6;

    --sidebar-width: 260px;
}

/* 1. RESET & TYPOGRAPHY */
html,
body {
    background-color: var(--ds-background-default);
    color: var(--ds-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 14px;
    overflow-x: hidden;
    /* Prevent global horizontal scroll */
    width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ds-text);
    font-weight: 600;
    margin-top: 0;
}

a {
    text-decoration: none;
    color: var(--ds-primary);
    transition: 0.2s;
}

a:hover {
    text-decoration: none;
    color: var(--ds-primary-hover);
}

/* 2. LAYOUT STRUCTURE */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* --- SIDEBAR (MÀU XANH ĐẬM) --- */
#sidebar-wrapper {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--ds-sidebar-bg) !important;
    /* Ép màu xanh */
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    /* SMOOTH TRANSITION */
    transition: margin 0.25s ease-out, left 0.25s ease-out;
}

/* =========================================
   SIDEBAR TOGGLE LOGIC (MOBILE)
   ========================================= */
@media (max-width: 768px) {
    #sidebar-wrapper {
        /* Default: HIDDEN on mobile */
        left: calc(-1 * var(--sidebar-width));
    }

    #wrapper.toggled #sidebar-wrapper {
        /* Toggled: SHOW on mobile (Overlay) */
        left: 0;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        /* Force margin removal */
        /* Content always Full Width on Mobile */
        width: 100%;
        min-width: 100%;
        /* Fix 100vw causing scroll */
    }

    /* Overlay Effect when Sidebar Open */
    #wrapper.toggled #page-content-wrapper::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        /* Handle Close on Click Overlay (Requires JS logic if we want overlay click to close) */
        pointer-events: none;
        /* Let clicks pass through for now, unless we attach 'click' to close */
    }
}

.sidebar-heading {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center logo horizontally */
    gap: 10px;
    background-color: var(--ds-sidebar-bg);
    /* VST Navy */
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #dfe1e6;
    /* Subtle separator */
}

/* Menu Item trong Sidebar */
.list-group-item {
    background: transparent !important;
    border: none !important;
    color: #B3BAC5 !important;
    /* Chữ xám nhạt */
    font-weight: 500;
    font-size: 14px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    margin: 2px 8px;
    /* Cách lề */
    border-radius: 4px;
}

.list-group-item:hover {
    background-color: rgba(247, 148, 29, 0.08) !important;
    /* Hover cam nhạt */
    color: #f7941d !important;
}

/* [FIX] Override Bootstrap .list-group-item.active for ALL sidebar menu items */
#sidebar-wrapper .list-group-item.active-menu-item,
#sidebar-wrapper .list-group-item.active-menu-item:focus,
#sidebar-wrapper .list-group-item.active-menu-item:hover,
#sidebar-wrapper .list-group-item.active.active-menu-item,
.list-group-item.active-menu-item,
.list-group-item.active-menu-item:focus,
.list-group-item.active-menu-item:hover {
    background-color: rgba(247, 148, 29, 0.15) !important;
    color: #f7941d !important;
    font-weight: 700 !important;
    border-color: transparent !important;
    border-left: 4px solid #f7941d !important;
    padding-left: 12px;
}

/* Icon trong Sidebar */
.list-group-item i {
    width: 20px;
    text-align: center;
    color: inherit;
    opacity: 1;
}

/* Sub-menu title */
.sidebar-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6B778C;
    /* Tiêu đề nhóm mờ hơn */
    padding: 24px 20px 8px;
    letter-spacing: 0.5px;
}

/* Main Content */
#page-content-wrapper {
    width: 100%;
    margin-left: var(--sidebar-width);
    background-color: var(--ds-background-subtle);
    /* Nền nội dung xám nhạt */
    min-height: 100vh;
}

/* 3. BUTTONS (MÀU XANH) */
.btn-primary {
    background-color: var(--ds-primary);
    border-color: var(--ds-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--ds-primary-hover);
    border-color: var(--ds-primary-hover);
}

/* 4. CARDS & TABLES (JIRA STYLE) */
.jira-card,
.card {
    background-color: #fff;
    border: 1px solid var(--ds-border);
    border-radius: 8px;
    /* Bo tròn mềm mại hơn */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    /* Bóng nhẹ hơn */
}

.jira-header {
    background-color: #fff;
    border-bottom: 1px solid var(--ds-border);
    padding: 15px 30px;
    margin-bottom: 20px;
}

/* Input Fields */
.form-control,
.form-select {
    background-color: #ffffff;
    /* Trắng sạch */
    border: 1px solid #DFE1E6;
    color: var(--ds-text);
    border-radius: 4px;
    padding: 8px 12px;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    border-color: var(--ds-primary);
    box-shadow: 0 0 0 2px rgba(82, 67, 170, 0.2);
    /* Focus highlight */
}

/* Scrollbar đẹp */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #bfc2c7;
    border-radius: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Fix Select2 trên nền xanh */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #ced4da !important;
}

/* ==========================================================
   JIRA GLOBAL NAVIGATION & PAGE HEADER
   ========================================================== */

/* 1. Global Nav (Thanh trắng trên cùng) */
.jira-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #dfe1e6;
    height: auto;
    /* Changed from fixed 60px to auto for responsive height */
    min-height: 60px;
    /* Maintain minimum height */
    padding: 8px 24px;
    /* Adjusted padding for better spacing */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    /* Allow wrapping on small screens/zoom */
    gap: 12px;
    /* Add gap between flex items */
    position: sticky;
    top: 0;
    z-index: 1020;
    max-width: 100vw;
    /* Limit to viewport width */
    /* Luôn nổi trên cùng (cao hơn sidebar 1000) */
}

/* 2. Page Header (Tiêu đề trang nội bộ) */
.jira-page-header {
    margin: 24px 32px 16px 32px;
    /* Căn lề chuẩn Jira */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.jira-page-title {
    font-size: 24px;
    font-weight: 600;
    color: #172b4d;
    margin: 0;
    line-height: 1.25;
}

.jira-breadcrumbs {
    font-size: 12px;
    color: #6b778c;
    margin-bottom: 4px;
}

/* 3. Container nội dung */
.jira-page-content {
    padding: 0 32px 40px 32px;
    /* Padding đều 2 bên */
}

/* Fix lại thẻ Card cho phẳng */
.card,
.jira-card {
    border: 1px solid #dfe1e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Update shadow */
    border-radius: 8px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dfe1e6;
}

/* --- SIDEBAR DROPDOWN ARROW --- */
.sidebar-arrow {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

a[data-bs-toggle="collapse"][aria-expanded="true"] .sidebar-arrow {
    transform: rotate(90deg);
}

a[data-bs-toggle="collapse"][aria-expanded="false"] .sidebar-arrow {
    transform: rotate(0deg);
}

.list-group-item:hover .sidebar-arrow {
    opacity: 1;
}

/* =========================================
   JIRA MODAL GLOBAL STYLE
   ========================================= */

/* 1. Modal Content */
.jira-modal-content,
.modal-content {
    border-radius: 8px;
    /* Rounded 8px */
    border: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    /* Deep shadow */
    background-color: #fff;
}

/* 2. Header */
.jira-modal-header,
.modal-header {
    padding: 24px 24px 0 24px;
    border-bottom: none !important;
    background-color: #fff !important;
    /* Luôn là nền trắng */
    color: #172b4d !important;
    /* Chữ màu tối */
}

.jira-modal-title,
.modal-title {
    font-size: 20px;
    font-weight: 500;
    color: #172b4d;
}

.btn-close {
    opacity: 0.5;
}

/* 3. Body & Inputs */
.jira-modal-body,
.modal-body {
    padding: 16px 24px;
}

/* Ép tất cả input trong modal theo style Jira */
.modal-body .form-control,
.modal-body .form-select {
    background-color: #f4f5f7 !important;
    border: 2px solid #f4f5f7 !important;
    border-radius: 3px !important;
    color: #172b4d !important;
    font-size: 14px !important;
    padding: 8px 10px !important;
    transition: all 0.2s;
}

.modal-body .form-control:hover,
.modal-body .form-select:hover {
    background-color: #ebecf0 !important;
    border-color: #ebecf0 !important;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    background-color: #fff !important;
    border-color: #4c9aff !important;
    box-shadow: none !important;
}

.modal-body label {
    font-size: 12px;
    font-weight: 600;
    color: #44546f;
    margin-bottom: 4px;
    text-transform: none;
    /* Bỏ uppercase nếu có */
}

/* 4. Footer */
.jira-modal-footer,
.modal-footer {
    padding: 20px 24px;
    border-top: none !important;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background-color: #fff;
}

/* Nút bấm trong Modal */
.modal-footer .btn-primary,
.modal-footer .btn-success,
.modal-footer .btn-warning {
    background-color: #f7941d !important;
    /* Cam VST */
    border: none !important;
    font-weight: 600 !important;
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 3px;
}

.modal-footer .btn-primary:hover {
    background-color: #e07f0d !important;
}

.modal-footer .btn-secondary,
.modal-footer .btn-light {
    background: transparent !important;
    color: #42526e !important;
    border: none !important;
    font-weight: 600 !important;
}

.modal-footer .btn-secondary:hover {
    background-color: rgba(9, 30, 66, 0.08) !important;
}

/* =========================================
   JIRA STYLE LOGIN PAGE
   ========================================= */

.login-layout {
    background-color: var(--ds-background-subtle);
    /* Nền xám #f4f5f7 */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-image: url('https://aid-frontend.prod.atl-paas.net/atlassian-id/front-end/5.0.543/static/media/left.14707620.svg'), url('https://aid-frontend.prod.atl-paas.net/atlassian-id/front-end/5.0.543/static/media/right.513364f3.svg');
    background-repeat: no-repeat, no-repeat;
    background-position: left bottom, right bottom;
    background-size: 30%, 30%;
}

.login-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 400px;
    padding: 32px 40px;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    /* border-top: 4px solid var(--ds-primary); Không cần viền trên nếu muốn giống Jira mới nhất */
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
    color: var(--ds-text);
}

.login-logo i {
    font-size: 40px;
    color: var(--ds-primary);
}

.login-title {
    font-size: 16px;
    font-weight: 700;
    color: #5e6c84;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
}

.login-footer a {
    color: var(--ds-primary);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* =========================================
   FIX COLORS: JIRA BLUE OVERRIDE
   ========================================= */

/* 1. Ép màu cho text-primary (Icon, Link) */
.text-primary {
    color: #f7941d !important;
}

/* 2. Ép màu cho Tab (Nav-tabs) */
.nav-tabs .nav-link {
    color: #5e6c84;
    /* Màu xám khi chưa chọn */
    font-weight: 600;
}

.nav-tabs .nav-link:hover {
    color: #f7941d;
    /* Hover màu cam */
    border-color: #dfe1e6;
}

.nav-tabs .nav-link.active {
    color: #f7941d !important;
    /* Active màu cam */
    border-color: #dfe1e6 #dfe1e6 #fff;
    background-color: #fff;
}


/* Đảm bảo Icon trong tab ăn theo màu chữ */
.nav-link i {
    color: inherit;
}

/* =========================================
   MOBILE OPTIMIZATION (GLOBAL & MODULES)
   ========================================= */
@media (max-width: 768px) {

    /* 1. GLOBAL LAYOUT */
    .jira-navbar {
        padding: 8px 15px;
        min-height: 50px;
    }

    .jira-page-content {
        padding: 0 10px 20px 10px;
        /* Reduce padding side */
    }

    .jira-page-header {
        margin: 15px 15px 10px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .jira-page-header .d-flex {
        width: 100%;
        justify-content: space-between;
    }

    /* 2. LOGIN PAGE */
    .login-layout {
        padding: 15px;
        background-image: none !important;
    }

    .login-card {
        padding: 20px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .login-logo img {
        height: 60px !important;
    }

    /* 3. MODALS (Full width on mobile) */
    .modal-dialog {
        margin: 10px;
    }

    .jira-modal-header,
    .jira-modal-body,
    .jira-modal-footer {
        padding: 15px;
    }

    /* 4. TABLES (General) */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stacked Table for Data-heavy views (Optional helper class) */
    .table-stack-mobile thead {
        display: none;
    }

    .table-stack-mobile tr {
        display: block;
        border-bottom: 2px solid #ebecf0;
        margin-bottom: 10px;
    }

    .table-stack-mobile td {
        display: block;
        width: 100%;
        padding: 5px 0;
        border: none;
    }

    /* 5. WEWORK BOARD */
    .board-container {
        height: calc(100vh - 110px);
    }

    .board-filter-bar {
        flex-wrap: wrap;
        gap: 5px;
        padding: 10px !important;
    }

    .kanban-column {
        min-width: 85vw;
        margin-right: 10px;
        scroll-snap-align: center;
    }

    .board-canvas {
        justify-content: flex-start;
        padding: 0 10px 10px 10px;
        scroll-snap-type: x mandatory;
    }

    /* 6. BASE REQUESTS & LISTS */
    .list-group-item {
        padding: 15px;
        /* Comfortable touch area */
    }

    /* Make flex list items stack on mobile for readability */
    .list-group-item.d-flex.align-items-center.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .list-group-item .d-flex.align-items-center.gap-3,
    .list-group-item .d-flex.align-items-center.gap-4 {
        width: 100%;
        justify-content: space-between;
    }

    /* 7. GLOBAL FLEX TOOLBARS (Filter bars, Header actions) */
    .jira-card .d-flex {
        flex-wrap: wrap;
        /* Allow wrapping */
    }

    .jira-card .d-flex>div,
    .jira-card .d-flex>form {
        margin-bottom: 5px;
        /* Spacing when wrapped */
    }
}