/* ============================================
   AfryxMed UI Refresh
   Final presentation layer loaded after legacy
   theme files and inline shell styles.
   ============================================ */

:root {
    --af-refresh-bg: #f3f6f8;
    --af-refresh-bg-2: #eaf1f2;
    --af-refresh-surface: #ffffff;
    --af-refresh-surface-2: #f8fafc;
    --af-refresh-border: #dbe5ea;
    --af-refresh-border-soft: #edf2f5;
    --af-refresh-text: #102033;
    --af-refresh-muted: #64748b;
    --af-refresh-primary: #0f766e;
    --af-refresh-primary-2: #155e75;
    --af-refresh-accent: #b7791f;
    --af-refresh-danger: #be123c;
    --af-refresh-sidebar: #101828;
    --af-refresh-sidebar-2: #123238;
    --af-refresh-sidebar-text: #bdc9d6;
    --af-refresh-sidebar-muted: #7f90a3;
    --af-refresh-radius: 8px;
    --af-refresh-shadow: 0 1px 2px rgba(15, 23, 42, 0.07), 0 12px 28px rgba(15, 23, 42, 0.08);
    --af-refresh-shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
    --af-refresh-topbar-height: 68px;
    --af-refresh-sidebar-width: 260px;
}

html[data-theme="dark"],
body[data-layout-mode="dark"],
body[data-theme="dark"] {
    --af-refresh-bg: #151922;
    --af-refresh-bg-2: #10141b;
    --af-refresh-surface: #1d2430;
    --af-refresh-surface-2: #232c39;
    --af-refresh-border: #303b4b;
    --af-refresh-border-soft: #273240;
    --af-refresh-text: #e5edf5;
    --af-refresh-muted: #9aa8b7;
    --af-refresh-primary: #34c38f;
    --af-refresh-primary-2: #49a6c8;
    --af-refresh-accent: #f0b45f;
    --af-refresh-danger: #f46a6a;
    --af-refresh-sidebar: #0d1118;
    --af-refresh-sidebar-2: #10252a;
    --af-refresh-sidebar-text: #c2ccd8;
    --af-refresh-sidebar-muted: #7d8b9c;
    --af-refresh-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 34px rgba(0, 0, 0, 0.24);
    --af-refresh-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.28);
}

html {
    min-width: 320px;
}

body {
    background:
        linear-gradient(180deg, var(--af-refresh-bg) 0%, var(--af-refresh-bg-2) 100%) !important;
    color: var(--af-refresh-text);
}

#layout-wrapper,
.main-content,
.page-content {
    background: transparent !important;
}

#page-topbar {
    min-height: var(--af-refresh-topbar-height);
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom: 1px solid var(--af-refresh-border) !important;
    box-shadow: var(--af-refresh-shadow-soft) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-theme="dark"] #page-topbar,
body[data-layout-mode="dark"] #page-topbar,
body[data-topbar="dark"] #page-topbar,
body[data-theme="dark"] #page-topbar {
    background: rgba(16, 24, 40, 0.95) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.navbar-header {
    min-height: var(--af-refresh-topbar-height);
    height: var(--af-refresh-topbar-height) !important;
    padding-right: 16px !important;
    gap: 10px;
}

.header-item {
    height: var(--af-refresh-topbar-height) !important;
    color: var(--af-refresh-muted) !important;
}

.navbar-header .header-item {
    border-radius: var(--af-refresh-radius) !important;
}

.navbar-header .header-item:hover,
.navbar-header .dropdown .show.header-item {
    background: rgba(15, 118, 110, 0.09) !important;
    color: var(--af-refresh-primary) !important;
}

.noti-icon i {
    color: currentColor !important;
}

.noti-icon .badge,
#notification-badge {
    top: 11px !important;
    right: 6px !important;
    min-width: 18px;
    height: 18px;
    padding: 3px 5px;
    border: 2px solid var(--af-refresh-surface);
    box-shadow: 0 2px 7px rgba(190, 18, 60, 0.22);
}

.app-search {
    padding: 0 !important;
}

.app-search .form-control {
    width: min(440px, 36vw);
    height: 40px !important;
    background: var(--af-refresh-surface-2) !important;
    border: 1px solid var(--af-refresh-border) !important;
    border-radius: var(--af-refresh-radius) !important;
    color: var(--af-refresh-text) !important;
    box-shadow: none !important;
}

.app-search .form-control:focus {
    border-color: var(--af-refresh-primary) !important;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12) !important;
}

.app-search span {
    color: var(--af-refresh-muted) !important;
}

.navbar-brand-box {
    width: var(--af-refresh-sidebar-width) !important;
    min-height: var(--af-refresh-topbar-height);
    background: var(--af-refresh-sidebar) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-brand-box .logo {
    line-height: var(--af-refresh-topbar-height) !important;
}

.navbar-brand-box .logo-lg img,
.navbar-brand-box .logo-sm img {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.22));
}

.vertical-menu {
    width: var(--af-refresh-sidebar-width) !important;
    top: var(--af-refresh-topbar-height) !important;
    background:
        linear-gradient(180deg, var(--af-refresh-sidebar) 0%, var(--af-refresh-sidebar-2) 58%, #0f172a 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.18) !important;
}

.vertical-menu [data-simplebar] {
    height: calc(100vh - var(--af-refresh-topbar-height)) !important;
}

.vertical-menu::before {
    display: none !important;
}

#sidebar-menu {
    padding: 12px 10px 28px !important;
}

#sidebar-menu .menu-title {
    margin: 6px 4px 12px !important;
    padding: 10px 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-left: 0 !important;
    border-radius: var(--af-refresh-radius) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #d6e0ea !important;
    font-size: 11px !important;
    line-height: 1.25;
    letter-spacing: 0.06em !important;
}

#sidebar-menu ul li a {
    min-height: 38px;
    padding: 9px 12px !important;
    margin: 3px 0 !important;
    border: 1px solid transparent !important;
    border-left: 0 !important;
    border-radius: var(--af-refresh-radius) !important;
    color: var(--af-refresh-sidebar-text) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transform: none !important;
}

#sidebar-menu ul li a i {
    min-width: 24px !important;
    margin-right: 9px !important;
    color: var(--af-refresh-sidebar-muted) !important;
}

#sidebar-menu ul li a:hover,
#sidebar-menu ul li a.mm-active,
#sidebar-menu ul li.mm-active > a,
#sidebar-menu ul li a.active,
body[data-sidebar="dark"] .mm-active > a {
    background: rgba(52, 195, 143, 0.13) !important;
    border-color: rgba(52, 195, 143, 0.18) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

#sidebar-menu ul li a:hover i,
#sidebar-menu ul li a.mm-active i,
#sidebar-menu ul li.mm-active > a i,
#sidebar-menu ul li a.active i,
body[data-sidebar="dark"] .mm-active > a i {
    color: var(--af-refresh-primary) !important;
    transform: none !important;
}

#sidebar-menu ul li a.has-arrow::after {
    color: var(--af-refresh-sidebar-muted) !important;
    right: 12px;
}

#sidebar-menu ul li ul.sub-menu {
    margin: 4px 0 8px 33px !important;
    padding: 4px 0 !important;
    border-left: 1px solid rgba(52, 195, 143, 0.26) !important;
    border-radius: 0 !important;
    background: transparent !important;
}

#sidebar-menu ul li ul.sub-menu li a {
    min-height: 32px;
    padding: 7px 10px 7px 14px !important;
    margin: 1px 0 !important;
    color: rgba(214, 224, 234, 0.78) !important;
    background: transparent !important;
    font-size: 12.5px !important;
}

#sidebar-menu ul li ul.sub-menu li a::before {
    display: none !important;
}

#sidebar-menu ul li ul.sub-menu li a:hover,
#sidebar-menu ul li ul.sub-menu li a.active {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #ffffff !important;
}

.main-content {
    margin-left: var(--af-refresh-sidebar-width) !important;
    min-height: 100vh;
}

.page-content {
    padding: calc(var(--af-refresh-topbar-height) + 22px) 22px 78px !important;
}

.container-fluid {
    padding-left: clamp(14px, 1.5vw, 26px) !important;
    padding-right: clamp(14px, 1.5vw, 26px) !important;
}

.page-title-box {
    padding: 0 2px 16px !important;
}

.page-title-box h4,
.page-title-box .page-title {
    color: var(--af-refresh-text) !important;
    font-size: 18px !important;
    text-transform: none !important;
}

.card,
.modal-content,
.dropdown-menu {
    border: 1px solid var(--af-refresh-border) !important;
    border-radius: var(--af-refresh-radius) !important;
    background: var(--af-refresh-surface) !important;
    color: var(--af-refresh-text) !important;
}

.card {
    box-shadow: var(--af-refresh-shadow-soft) !important;
}

.card:hover {
    box-shadow: var(--af-refresh-shadow) !important;
    transform: none !important;
}

.card-header,
.modal-header,
.modal-footer {
    background: var(--af-refresh-surface) !important;
    border-color: var(--af-refresh-border-soft) !important;
}

.card-title,
.modal-title {
    color: var(--af-refresh-text) !important;
}

.btn {
    border-radius: var(--af-refresh-radius) !important;
    font-weight: 600 !important;
}

.btn-primary,
.btn-gradient,
.btn-gradient-success {
    background: linear-gradient(135deg, var(--af-refresh-primary) 0%, var(--af-refresh-primary-2) 100%) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18) !important;
}

.btn-primary:hover,
.btn-gradient:hover,
.btn-gradient-success:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--af-refresh-primary) !important;
    border-color: rgba(15, 118, 110, 0.42) !important;
}

.btn-outline-primary:hover {
    background: rgba(15, 118, 110, 0.1) !important;
    color: var(--af-refresh-primary) !important;
}

.form-control,
.form-select,
.select2-container--default .select2-selection--single,
.select2-container--bootstrap-5 .select2-selection {
    border-radius: var(--af-refresh-radius) !important;
    border-color: var(--af-refresh-border) !important;
    background: var(--af-refresh-surface-2) !important;
    color: var(--af-refresh-text) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--af-refresh-primary) !important;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13) !important;
}

.table-responsive,
.dataTables_wrapper {
    border-radius: var(--af-refresh-radius);
}

.table {
    color: var(--af-refresh-text) !important;
    border-color: var(--af-refresh-border-soft) !important;
}

.table thead th,
.table.table-dark thead th {
    background: var(--af-refresh-surface-2) !important;
    color: var(--af-refresh-muted) !important;
    border-bottom: 1px solid var(--af-refresh-border) !important;
    letter-spacing: 0.04em !important;
}

.table tbody td {
    border-color: var(--af-refresh-border-soft) !important;
}

.table tbody > tr > *:first-child {
    background: inherit !important;
    color: var(--af-refresh-text) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-bottom-color: var(--af-refresh-border-soft) !important;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(15, 118, 110, 0.07) !important;
}

.badge {
    border-radius: 6px !important;
}

.dropdown-menu {
    box-shadow: var(--af-refresh-shadow) !important;
    padding: 7px !important;
}

.dropdown-item {
    border-radius: 6px !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(15, 118, 110, 0.09) !important;
    color: var(--af-refresh-primary) !important;
}

.footer {
    left: var(--af-refresh-sidebar-width) !important;
    background: transparent !important;
    border-top: 1px solid var(--af-refresh-border) !important;
    color: var(--af-refresh-muted) !important;
}

.vertical-collpsed .main-content {
    margin-left: 72px !important;
}

.vertical-collpsed .navbar-brand-box,
.vertical-collpsed .vertical-menu {
    width: 72px !important;
}

.vertical-collpsed .footer {
    left: 72px !important;
}

.vertical-collpsed #sidebar-menu ul li a {
    justify-content: center;
}

.vertical-collpsed #sidebar-menu ul li a i {
    margin-right: 0 !important;
}

/* Login page refresh */
.bg-mesh {
    background:
        linear-gradient(135deg, #edf7f5 0%, #f8fafc 52%, #fff7ed 100%) !important;
}

.bg-mesh .orb {
    display: none !important;
}

.bg-mesh::after {
    background-image:
        linear-gradient(rgba(15, 118, 110, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, 0.055) 1px, transparent 1px) !important;
    background-size: 48px 48px !important;
}

.login-shell {
    max-width: 1060px !important;
}

.login-card {
    border-radius: var(--af-refresh-radius) !important;
    background: #ffffff !important;
    border: 1px solid rgba(15, 118, 110, 0.14) !important;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.16) !important;
}

.panel-left {
    background: linear-gradient(160deg, #101828 0%, #123238 100%) !important;
}

.panel-left::before {
    display: none !important;
}

.brand-icon {
    border-radius: var(--af-refresh-radius) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.brand-text span,
.hero-text h1 .gradient {
    background: linear-gradient(135deg, #5eead4, #f0b45f) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

.feat,
.form-header .badge-row,
.field-input,
.pw-toggle,
.btn-submit {
    border-radius: var(--af-refresh-radius) !important;
}

.feat i,
.feat.accent i,
.feat.teal i,
.feat.green i {
    color: #5eead4 !important;
}

.form-header .badge-row {
    background: rgba(15, 118, 110, 0.1) !important;
    color: #0f766e !important;
}

.field-input:focus {
    border-color: #0f766e !important;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12) !important;
}

.remember-label input[type="checkbox"] {
    accent-color: #0f766e !important;
}

.forgot-link,
.pw-toggle:hover {
    color: #0f766e !important;
}

.btn-submit {
    background: linear-gradient(135deg, #0f766e 0%, #155e75 100%) !important;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28) !important;
}

.btn-submit:hover {
    box-shadow: 0 14px 32px rgba(15, 118, 110, 0.34) !important;
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 0 !important;
    }

    .footer {
        left: 0 !important;
    }

    .vertical-menu {
        left: -260px;
    }

    body.sidebar-enable .vertical-menu {
        left: 0;
    }

    .navbar-brand-box {
        width: 72px !important;
    }

    .app-search .form-control {
        width: min(360px, 42vw);
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: calc(var(--af-refresh-topbar-height) + 14px) 10px 76px !important;
    }

    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .login-card {
        max-width: 450px;
    }
}
