/* ====================================================================== */
/*  Ofaami Enterprise Dashboard — Layout                                  */
/*  Fixed gradient sidebar + sticky topbar + scrollable main              */
/*  Ported from the HTML reference, adapted to the Laravel admin shell    */
/* ====================================================================== */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-interface);
    font-size: var(--fz-13);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5, h6 { margin: 0 0 8px; font-weight: 600; line-height: 1.25; color: var(--text); }
p { margin: 0 0 8px; }

img { max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(108,79,232,.22); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------- shell */
.app-body { min-height: 100vh; }

.main-area {
    
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.page { padding: 20px 22px 40px; max-width: 1480px; margin: 0 auto; width: 100%; flex: 1; }

.app-body.sidebar-collapsed .main-area { margin-left: 68px; }
.app-body.sidebar-collapsed .aside { width: 68px; }
.app-body.sidebar-collapsed .aside .aside-body nav label,
.app-body.sidebar-collapsed .aside .nav > li > a .link-title,
.app-body.sidebar-collapsed .aside .nav > li.has-sub-item > a .chev,
.app-body.sidebar-collapsed .aside .nav .sub-menu,
.app-body.sidebar-collapsed .aside .aside-footer .build-text,
.app-body.sidebar-collapsed .aside .user-profile .media-body,
.app-body.sidebar-collapsed .aside .brand .brand-text { display: none; }
.app-body.sidebar-collapsed .aside .aside-body nav,
.app-body.sidebar-collapsed .aside .nav > li > a { justify-content: center; }
.app-body.sidebar-collapsed .aside .nav > li > a .mi { font-size: 19px; }
.app-body.sidebar-collapsed .aside .brand { justify-content: center; }

/* ----------------------------------------------------------------- aside */
.aside {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: width .25s ease, transform .25s ease;
    box-shadow: var(--shadow-dark);
}

.aside .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    min-height: var(--topbar-h);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.aside .brand .logo { display: flex; align-items: center; gap: 9px; }
.aside .brand .logo img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.aside .brand .brand-text { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .2px; }
.aside .brand .brand-text small { display: block; font-size: 9px; font-weight: 500; color: var(--primary-mid); letter-spacing: 1.4px; text-transform: uppercase; }
.aside .brand .aside-close { margin-left: auto; display: none; }

.aside-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 16px; }
.aside-body::-webkit-scrollbar { width: 5px; }
.aside-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border: none; }

/* user chip */
.user-profile {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; margin-bottom: 12px;
    border-radius: var(--r-12);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.06);
}
.user-profile .avatar { position: relative; }
.user-profile .status-dot { position: absolute; right: -1px; bottom: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--success); border: 2px solid var(--sidebar-bg-solid); }
.user-profile .media-body { min-width: 0; }
.user-profile .media-body h6 { margin: 0; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-profile .media-body span { display: block; font-size: 10px; color: var(--sidebar-text-dim); text-transform: uppercase; letter-spacing: .6px; }

/* navigation */
.nav-category {
    font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase;
    color: var(--sidebar-text-dim);
    padding: 14px 12px 6px;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-category em { font-style: normal; }

.aside .nav { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.aside .nav > li > a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: var(--r-10);
    color: var(--sidebar-text);
    font-size: 12.5px; font-weight: 500;
    position: relative;
    transition: background .15s ease, color .15s ease, padding .15s ease;
}
.aside .nav > li > a:hover { background: var(--sidebar-hover-bg); color: #fff; }
.aside .nav > li > a.active-menu { background: var(--sidebar-active-bg); color: var(--sidebar-active); box-shadow: inset 2px 0 0 var(--sidebar-badge); font-weight: 600; }
.aside .nav > li > a .mi { font-size: 18px; flex: 0 0 auto; }
.aside .nav > li > a .link-title { flex: 1; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.aside .nav > li > a .count {
    font-size: 9.5px; font-weight: 700;
    background: var(--sidebar-badge); color: #17203F;
    border-radius: var(--r-full); padding: 1px 7px; line-height: 1.5;
}
.aside .nav > li > a .chev { font-size: 15px; opacity: .6; transition: transform .2s ease; }
.aside .nav > li.sub-menu-opened > a .chev { transform: rotate(90deg); }
.aside .nav > li.sub-menu-opened > a { background: var(--sidebar-hover-bg); }

.aside .nav .sub-menu { display: none; padding-left: 12px; }
.aside .nav > li.sub-menu-opened > .sub-menu,
.aside .nav .sub-menu.open { display: block; }
.aside .nav .sub-menu li a {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px 7px 34px;
    border-radius: var(--r-8);
    color: var(--sidebar-text-dim);
    font-size: 12px; font-weight: 400;
    position: relative;
}
.aside .nav .sub-menu li a::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--primary-mid); position: absolute; left: 20px; opacity: .7; }
.aside .nav .sub-menu li a:hover { color: #fff; background: var(--sidebar-hover-bg); }
.aside .nav .sub-menu li a.active-menu { color: var(--sidebar-active); font-weight: 600; }
.aside .nav .sub-menu li a.active-menu::before { background: var(--sidebar-badge); }

/* aside footer */
.aside-footer {
    padding: 12px 14px; font-size: 10px; color: var(--sidebar-text-dim);
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.aside-footer .pill { background: rgba(245,200,66,.14); color: var(--sidebar-badge); border: 1px solid rgba(245,200,66,.28); padding: 1px 8px; border-radius: var(--r-full); font-weight: 600; letter-spacing: .4px; }

/* ---------------------------------------------------------------- topbar */
.header {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    z-index: 1030;
    padding: 0 18px;
    transition: left .25s ease;
    gap: 14px;
}
.app-body.sidebar-collapsed .header { left: 68px; }

.topbar, .header { flex-wrap: nowrap; }
.topbar-inner { display: flex; align-items: center; gap: 12px; width: 100%; }
.topbar-toggle { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--r-10); border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2); cursor: pointer; }
.topbar-toggle:hover { color: var(--primary); border-color: var(--border-strong); }

/* search */
.topbar-search { display: flex; align-items: center; gap: 9px; flex: 1; max-width: 460px; height: 38px; padding: 0 6px 0 14px; background: var(--surface-input); border: 1px solid var(--border); border-radius: var(--r-full); color: var(--text-muted); }
.topbar-search:focus-within { border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(108,79,232,.10); }
.topbar-search .mi { font-size: 18px; }
.topbar-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 12.5px; color: var(--text); }
.topbar-search input::placeholder { color: var(--text-faint); }
.kbd { font-family: var(--font-mono); font-size: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; color: var(--text-muted); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--r-10); border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn .count-badge { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; border-radius: var(--r-full); background: var(--danger); color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff; }
.icon-btn .count-badge.gold { background: var(--sidebar-badge); color: #17203F; }

.topbar-select { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: var(--r-10); background: var(--surface-input); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; font-weight: 500; cursor: pointer; }
.topbar-select:hover { border-color: var(--border-strong); }

.topbar-user { display: flex; align-items: center; gap: 10px; padding: 3px 4px 3px 8px; border-radius: var(--r-full); background: var(--surface-input); border: 1px solid var(--border); cursor: pointer; }
.topbar-user .tu-meta { line-height: 1.15; text-align: left; }
.topbar-user .tu-meta strong { font-size: 12px; font-weight: 600; color: var(--text); display: block; }
.topbar-user .tu-meta span { font-size: 10px; color: var(--text-muted); display: block; }

/* ------------------------------------------------------------ dropdowns */
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-14); box-shadow: var(--shadow-lg); padding: 8px; z-index: 1050; display: none; }
.dd.open .dd-menu { display: block; }
.dd-menu.wide { min-width: 320px; }
.dd-menu .dd-header { padding: 8px 12px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; display: flex; align-items: center; justify-content: space-between; }
.dd-menu .dd-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-10); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.dd-menu .dd-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.dd-menu .dd-item .mi { font-size: 17px; }
.dd-menu .dd-item.flex-between { justify-content: space-between; }
.dd-menu .dd-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-menu .dd-check { color: var(--primary); }

/* --------------------------------------------------------------- footer */
.app-footer { border-top: 1px solid var(--border); padding: 15px 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--text-muted); background: var(--bg-card); }
.app-footer .dot { color: var(--success); }
.app-footer a { color: var(--primary); }

/* ------------------------------------------------------------- overlays */
.offcanvas-overlay { position: fixed; inset: 0; background: rgba(11, 15, 40, .45); backdrop-filter: blur(2px); z-index: -1; opacity: 0; transition: opacity .2s ease; }
.offcanvas-overlay.active,
.offcanvas-overlay.aside-active,
.offcanvas-overlay.show { opacity: 1; z-index: 1035; }
.offcanvas-overlay.aside-active { z-index: 1031; }
.offcanvas-overlay.show { z-index: 1035; }

.preloader { position: fixed; inset: 0; background: var(--bg); z-index: 9999999; display: flex; align-items: center; justify-content: center; transition: opacity .35s ease, visibility .35s; }
.preloader::after { content: none; }
.preloader.done { opacity: 0; visibility: hidden; }
.preloader .pl-spin { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------- */
/*  Laravel shell compat — main.js drives the sidebar via body classes     */
/*  `aside-folded` (desktop collapse) and `aside-open` (mobile drawer).   */
/* ---------------------------------------------------------------------- */
body.aside-folded .main-area { margin-left: 68px; }
body.aside-folded .header { left: 68px; }
body.aside-folded .aside { width: 68px; }
body.aside-folded .aside .aside-body nav .nav-category,
body.aside-folded .aside .nav > li > a .link-title,
body.aside-folded .aside .nav > li.has-sub-item > a .chev,
body.aside-folded .aside .nav .sub-menu,
body.aside-folded .aside .aside-footer .build-text,
body.aside-folded .aside .user-profile .media-body,
body.aside-folded .aside .brand .brand-text,
body.aside-folded .aside .app-footer { display: none; }
body.aside-folded .aside .nav > li > a .count { display: none; }
body.aside-folded .aside .aside-body nav,
body.aside-folded .aside .nav > li > a { justify-content: center; }
body.aside-folded .aside .nav > li > a .mi { font-size: 19px; }
body.aside-folded .aside .brand { justify-content: center; }

body.aside-folded.open-aside-folded .main-area { margin-left: var(--sidebar-w); }
body.aside-folded.open-aside-folded .header { left: var(--sidebar-w); }
body.aside-folded.open-aside-folded .aside { width: var(--sidebar-w); }
body.aside-folded.open-aside-folded .aside .aside-body nav .nav-category,
body.aside-folded.open-aside-folded .aside .nav > li > a .link-title,
body.aside-folded.open-aside-folded .aside .nav > li.has-sub-item > a .chev,
body.aside-folded.open-aside-folded .aside .aside-footer .build-text,
body.aside-folded.open-aside-folded .aside .user-profile .media-body,
body.aside-folded.open-aside-folded .aside .brand .brand-text { display: flex; }
body.aside-folded.open-aside-folded .aside .aside-body nav,
body.aside-folded.open-aside-folded .aside .nav > li > a { justify-content: flex-start; }
body.aside-folded.open-aside-folded .aside .nav > li > a .mi { font-size: 18px; }

@media (max-width: 991.98px) {
    .aside { transform: translateX(-100%); box-shadow: none; }
    .app-body.menu-open .aside { transform: translateX(0); box-shadow: var(--shadow-dark); }
    body.aside-open .aside { transform: translateX(0); box-shadow: var(--shadow-dark); }
    body.aside-open .offcanvas-overlay { display: block; }
    .main-area { margin-left: 0; }
    .header { left: 0; }
    body.aside-folded .main-area { margin-left: 0; }
    body.aside-folded .header { left: 0; }
    body.aside-open.aside-folded .aside { width: var(--sidebar-w); }
    .topbar-search { max-width: none; }
    #message_count { display: none; }
}