/*
 * Online BO Application - Redesign Iteration 2 (Refined)
 */

:root {
    /* --- LIGHT THEME --- */
    --bo-primary: #0f172a;
    --bo-accent: #2563eb;
    --bo-accent-hover: #1d4ed8;

    --bo-bg-body: #f8fafc;
    --bo-surface: #ffffff;
    --bo-surface-alt: #f1f5f9;
    --bo-border: #cbd5e1;
    /* Slightly darker border for better visibility */

    --bo-text-main: #0f172a;
    --bo-text-muted: #475569;

    --bo-success: #059669;
    --bo-danger: #dc2626;

    --bo-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --bo-transition: all 0.15s ease-in-out;
}

/* --- DARK THEME --- */
[data-layout-mode=dark] {
    --bo-bg-body: #020617;
    --bo-surface: #0f172a;
    --bo-surface-alt: #1e293b;
    --bo-border: #334155;

    --bo-text-main: #f8fafc;
    --bo-text-muted: #94a3b8;
}

body {
    background-color: var(--bo-bg-body) !important;
    color: var(--bo-text-main);
    font-family: 'Inter', 'IBM Plex Sans', sans-serif;
    line-height: 1.5;
}

/* --- Normal Input Sizing (Bootstrap Standard) --- */
.form-control,
.form-select {
    background-color: var(--bo-surface) !important;
    border: 1px solid var(--bo-border) !important;
    color: var(--bo-text-main) !important;
    border-radius: 0.375rem !important;
    /* 6px */
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    height: auto !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bo-accent) !important;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.1) !important;
}

label {
    color: var(--bo-text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* --- Select2 ULTIMATE FIXES --- */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    background-color: var(--bo-surface) !important;
    border: 1px solid var(--bo-border) !important;
    border-radius: 0.375rem !important;
    height: 38px !important;
    /* Matches standard bootstrap input height */
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--bo-text-main) !important;
    line-height: 36px !important;
    /* Vertically centered */
    padding-left: 0.75rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
    right: 8px !important;
}

/* Dark Mode Specific for Selection Text */
[data-layout-mode=dark] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f8fafc !important;
}

/* Select2 Dropdown */
.select2-dropdown {
    background-color: var(--bo-surface) !important;
    border: 1px solid var(--bo-border) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10001 !important;
}

.select2-results__option {
    padding: 8px 12px !important;
    color: var(--bo-text-main) !important;
    font-size: 0.95rem !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--bo-accent) !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bo-surface-alt) !important;
    color: var(--bo-text-main) !important;
}

/* Search Box inside Select2 */
.select2-search--dropdown {
    padding: 8px !important;
}

.select2-search__field {
    background-color: var(--bo-surface-alt) !important;
    border: 1px solid var(--bo-border) !important;
    color: var(--bo-text-main) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
}

/* --- Topbar --- */
#page-topbar {
    background-color: var(--bo-surface) !important;
    border-bottom: 1px solid var(--bo-border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    transition: var(--bo-transition);
}

/* Sidebar Profile Section */
.first-profile-n {
    padding: 20px 10px !important;
}

.first-profile-n a {
    text-decoration: none !important;
    display: block !important;
}

.first-profile-n img {
    border: 3px solid var(--bo-border) !important;
    padding: 2px !important;
    width: 80px !important;
    height: 80px !important;
    transition: var(--bo-transition);
}

.first-profile-n .text-muted {
    color: var(--bo-text-muted) !important;
    transition: var(--bo-transition);
}

[data-layout-mode=dark] .first-profile-n .text-muted {
    color: #94a3b8 !important;
}

.first-profile-n:hover img {
    border-color: var(--bo-accent) !important;
    transform: scale(1.02);
}

/* --- Card & Layout --- */
.card {
    background-color: var(--bo-surface) !important;
    border: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--bo-surface) !important;
    border-bottom: 1px solid var(--bo-border) !important;
    padding: 1.25rem !important;
    font-weight: 700;
}

/* --- Sidebar Branding --- */
.navbar-brand-box {
    background-color: var(--bo-primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    transition: var(--bo-transition);
}

/* --- Sidebar Links & Structure --- */
.vertical-menu {
    border-right: 1px solid var(--bo-border) !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02) !important;
    transition: var(--bo-transition);
}

/* --- LIGHT SIDEBAR DESIGN (Default/Light Mode - Unified Filled) --- */
body[data-layout-mode=light] .vertical-menu,
body:not([data-layout-mode=dark]) .vertical-menu {
    background-color: #ffffff !important;
    border-right: 1px solid var(--bo-border) !important;
}

body[data-layout-mode=light] .navbar-brand-box,
body:not([data-layout-mode=dark]) .navbar-brand-box {
    background-color: #ffffff !important;
    border-bottom: 1px solid var(--bo-border) !important;
}

/* Sidebar Item Base */
body[data-layout-mode=light] #sidebar-menu #side-menu li a,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu li a {
    color: #475569 !important;
    /* Slate 600 */
    font-weight: 500;
    margin: 4px 12px !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    transition: var(--bo-transition);
    font-size: 0.88rem;
}

/* Hover State */
body[data-layout-mode=light] #sidebar-menu #side-menu li a:hover,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu li a:hover {
    background-color: #f1f5f9 !important;
    color: #2563eb !important;
    /* Brand Blue */
}

/* Active State (Filled Style - Like Dark but Soft Indigo/Blue) */
body[data-layout-mode=light] #sidebar-menu #side-menu li a.active,
body[data-layout-mode=light] #sidebar-menu #side-menu li.mm-active>a,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu li a.active,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu li.mm-active>a {
    background-color: #4f46e5 !important;
    /* Indigo 600 - Unique for Light */
    color: #ffffff !important;
    font-weight: 600;
    border-left: none !important;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2) !important;
}

/* Sub-menu (Dropdown) Handling */
body[data-layout-mode=light] #sidebar-menu #side-menu ul.sub-menu,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu ul.sub-menu {
    background-color: transparent !important;
    padding: 0 !important;
}

body[data-layout-mode=light] #sidebar-menu #side-menu ul.sub-menu li a,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu ul.sub-menu li a {
    padding-left: 40px !important;
    font-size: 0.85rem;
    color: #64748b !important;
    background-color: transparent !important;
}

body[data-layout-mode=light] #sidebar-menu #side-menu ul.sub-menu li a.active,
body:not([data-layout-mode=dark]) #sidebar-menu #side-menu ul.sub-menu li a.active {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
}

/* --- DARK SIDEBAR DESIGN (Preserved/Dark Mode) --- */
body[data-layout-mode=dark] .vertical-menu,
body[data-sidebar=dark] .vertical-menu {
    background-color: #0f172a !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body[data-layout-mode=dark] .navbar-brand-box,
body[data-sidebar=dark] .navbar-brand-box {
    background-color: #0f172a !important;
}

body[data-layout-mode=dark] #sidebar-menu ul li a,
body[data-sidebar=dark] #sidebar-menu ul li a {
    color: #94a3b8 !important;
    margin: 4px 12px !important;
    padding: 8px 15px !important;
    border-radius: 8px !important;
}

body[data-layout-mode=dark] #sidebar-menu ul li a:hover,
body[data-sidebar=dark] #sidebar-menu ul li a:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

body[data-layout-mode=dark] #sidebar-menu #side-menu li a.active,
body[data-layout-mode=dark] #sidebar-menu #side-menu li.mm-active>a,
body[data-sidebar=dark] #sidebar-menu #side-menu li a.active,
body[data-sidebar=dark] #sidebar-menu #side-menu li.mm-active>a {
    background-color: var(--bo-accent) !important;
    color: #ffffff !important;
    border-right: none;
    border-radius: 8px !important;
}

/* Tables Refresh */
.table thead th {
    background-color: var(--bo-surface-alt) !important;
    color: var(--bo-text-muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--bo-border) !important;
}

/* Badges */
.badge {
    padding: 0.5em 0.85rem !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem !important;
    }

    .vertical-menu {
        width: 100% !important;
    }
}

/* --- Topbar Dropdowns (Fix Transparency) --- */
.dropdown-menu {
    background-color: var(--bo-surface) !important;
    border: 1px solid var(--bo-border) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
}

[data-layout-mode=light] .dropdown-menu {
    background-color: #ffffff !important;
}

.dropdown-item {
    color: var(--bo-text-main) !important;
    transition: var(--bo-transition);
}

.dropdown-item:hover {
    background-color: var(--bo-surface-alt) !important;
    color: var(--bo-accent) !important;
}

/* --- Compact Sidebar (Collapsed Mode Fixes) --- */
body.vertical-collpsed .vertical-menu {
    width: 70px !important;
    border-right: none !important;
    /* Remove gap-creating border */
}

/* Ensure no gap when hovering over collapsed icons */
body.vertical-collpsed #sidebar-menu>ul>li:hover>a {
    position: relative;
    z-index: 10002;
    background-color: var(--bo-accent) !important;
    color: #ffffff !important;
}

body.vertical-collpsed #sidebar-menu>ul>li:hover>ul {
    left: 70px !important;
    /* Align exactly to sidebar edge */
    top: 0;
    padding: 10px 0 !important;
    background-color: var(--bo-surface) !important;
    border: 1px solid var(--bo-border) !important;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 8px 8px 0 !important;
}

/* Theme-specific compact sub-menu titles */
[data-layout-mode=light] body.vertical-collpsed #sidebar-menu>ul>li:hover>ul {
    background-color: #ffffff !important;
}

[data-layout-mode=dark] body.vertical-collpsed #sidebar-menu>ul>li:hover>ul {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* --- Dark Mode Persistent Overrides --- */
[data-layout-mode=dark] .dropdown-menu {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

[data-layout-mode=dark] ::-webkit-scrollbar-thumb {
    background: #334155;
}


/* -------------------------------------------- */
.form-select {
    background-color: rgb(55 60 57 / 0%);
}

.form-select:disabled,
.form-control[readonly] {
    background-color: #f3f3f3 !important;
    background-image: none;
    cursor: not-allowed;
}

.form-control::placeholder {
    opacity: 0.6;
}

.form-control[readonly]::placeholder {
    opacity: 1;
}

.form-select option:first-child {
    opacity: 0.6 !important;
}

.form-select:disabled {
    color: #ced4da;
}

.form-select:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    box-shadow: none;
}

.modal-backdrop {
    background-color: dimgray;
}

.twitter-bs-wizard .twitter-bs-wizard-nav .nav-link::after {
    width: 56%;
    left: 73%;
}

.twitter-bs-wizard .twitter-bs-wizard-nav .nav-link.active .step-icon {
    background-color: rgb(75 166 239 / 20%);
    color: #4ba6ef;
    border-color: rgb(75 166 239 / 20%);
}

.twitter-bs-wizard .twitter-bs-wizard-nav .step-icon {
    color: #2b2e3b;
}

.twitter-bs-wizard .twitter-bs-wizard-pager-link li.continue {
    float: right;
    margin-left: 10px;
    margin-right: 10px;
}

.card-body .pagination {
    padding-right: 15px
}

.select2+.select2-container .select2-selection {
    border-radius: 10px;
}

.has-error .select2-selection {
    border-color: rgb(185, 74, 72) !important;
}

.required::after {
    content: "*";
    color: red;
    margin-left: 4px;
}