/* ==========================================================================
   AlKafi ERP — Custom Theme Layer (Phase 1)
   Loaded AFTER Metronic's style.bundle.css to modernize the whole app.
   Palette sampled from the AlKafi logo (navy ring + gold triangle).
   ========================================================================== */

:root {
    /* Brand */
    --ak-navy: #2d3356;
    --ak-navy-dark: #20243b;
    --ak-navy-2: #2a2f52;
    --ak-navy-light: #3a4170;
    --ak-gold: #f6b62c;
    --ak-gold-dark: #e0a41f;
    --ak-gold-soft: rgba(246, 182, 44, 0.14);

    /* Neutrals */
    --ak-page: #f5f6fa;
    --ak-surface: #ffffff;
    --ak-border: #e9ebf2;
    --ak-text: #1e2333;
    --ak-muted: #6b7280;

    /* Metronic variable overrides — propagate brand across components */
    --kt-primary: #2d3356;
    --kt-primary-active: #20243b;
    --kt-primary-light: #eceef5;
    --kt-primary-inverse: #ffffff;
    --kt-body-bg: #f5f6fa;
    --bs-primary: #2d3356;
    --bs-primary-rgb: 45, 51, 86;
    --bs-primary-active: #20243b;
    --bs-primary-inverse: #ffffff;
    --bs-primary-light: #eceef5;
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
    background: var(--ak-page) !important;
    color: var(--ak-text);
    -webkit-font-smoothing: antialiased;
}

.wrapper,
#kt_wrapper {
    background: var(--ak-page);
}

/* Content breathing room — fixes cramped search/total rows on list pages app-wide */
#kt_content_container {
    padding-top: 16px !important;
    padding-bottom: 18px !important;
}
/* When a list card body is p-0, restore a little inner padding for the filter row + table */
#kt_content_container .card-body.p-0 {
    padding: 14px 16px 4px !important;
}
/* Add/Edit forms sit directly in the card with no inner padding — fields were
   flush to the card edges. Pad the form (inner .row has -12px gutters).
   Lighter horizontal padding on mobile so fields don't overflow. */
#kt_content_container .card > form.form,
#kt_content_container .card > .card-body > form.form,
#kt_content_container > form.form {
    padding: 8px 14px 20px !important;
}
@media (min-width: 992px) {
    #kt_content_container .card > form.form,
    #kt_content_container .card > .card-body > form.form,
    #kt_content_container > form.form {
        padding: 8px 26px 22px !important;
    }
}

/* ==========================================================================
   Sidebar (aside)
   ========================================================================== */
#kt_aside,
.aside {
    background: linear-gradient(185deg, var(--ak-navy-dark) 0%, var(--ak-navy-2) 100%) !important;
    border: 0 !important;
    box-shadow: 4px 0 24px rgba(20, 24, 45, 0.12);
}

/* Sidebar width + content offsets — DESKTOP ONLY. On mobile (<992px) the aside
   is an off-canvas drawer and content must stay full-width, so these must not leak. */
@media (min-width: 992px) {
    #kt_aside,
    .aside {
        width: 232px !important;
    }
    .aside-enabled.aside-fixed .wrapper {
        padding-left: 232px !important;
    }
    .aside-enabled.aside-fixed[data-kt-aside-minimize="on"] .wrapper {
        padding-left: 78px !important;
    }
}

/* Brand / logo strip */
#kt_aside .aside-logo {
    background: transparent !important;
    padding: 18px 22px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 6px;
}
#kt_aside .aside-logo .logo {
    height: 40px !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
#kt_aside .aside-toggle i {
    color: #8a90b8 !important;
    transition: color 0.15s ease;
}
#kt_aside .aside-toggle:hover i {
    color: var(--ak-gold) !important;
}

/* Menu container — beat the inline light-grey background */
#kt_aside .aside-menu {
    background: transparent !important;
    padding: 4px 0 20px;
}

/* Menu links */
#kt_aside .menu-link {
    border-radius: 9px !important;
    margin: 1px 14px !important;
    padding: 8px 12px !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}
#kt_aside .menu-title {
    color: #c4c9e2 !important;
    font-weight: 500 !important;
    font-size: 0.92rem;
    letter-spacing: 0.1px;
}
#kt_aside .menu-link:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}
#kt_aside .menu-link:hover .menu-title {
    color: #ffffff !important;
}

/* Icons (inline SVG line icons) — !important needed to beat Metronic's menu-icon cascade */
#kt_aside .menu-link .menu-icon {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    width: 30px !important;
    min-width: 30px !important;
    margin-right: 0 !important;
}
#kt_aside .menu-icon .nav-svg {
    display: block;
    width: 21px !important;
    height: 21px !important;
    stroke: #8f95bd !important;
    fill: none !important;
    transition: stroke 0.15s ease;
}
#kt_aside .menu-link:hover .menu-icon .nav-svg {
    stroke: #ffffff !important;
}

/* Active state */
#kt_aside .menu-link.active {
    background: var(--ak-gold-soft) !important;
    position: relative;
}
#kt_aside .menu-link.active .menu-title {
    color: #ffffff !important;
    font-weight: 600 !important;
}
#kt_aside .menu-link.active .menu-icon .nav-svg,
#kt_aside .menu-item.here > .menu-link .menu-icon .nav-svg {
    stroke: var(--ak-gold) !important;
}
#kt_aside .menu-link.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--ak-gold);
}

/* Bullets — subtle dots replacing the default grey ones */
#kt_aside .menu-bullet .bullet-dot {
    background-color: #565c86 !important;
    width: 5px !important;
    height: 5px !important;
    transition: background-color 0.15s ease;
}
#kt_aside .menu-link:hover .bullet-dot {
    background-color: #9298c4 !important;
}
#kt_aside .menu-link.active .bullet-dot {
    background-color: var(--ak-gold) !important;
    box-shadow: 0 0 0 3px rgba(246, 182, 44, 0.18);
}

/* Make the menu fill the full sidebar width (kills the right-side dead space) */
#kt_aside .aside-menu,
#kt_aside #kt_aside_menu_wrapper,
#kt_aside .menu,
#kt_aside .menu > .menu-item,
#kt_aside .menu > .menu-item > .menu-sub {
    width: 100% !important;
}
#kt_aside .menu-link {
    width: auto;
}
/* Indent guide only for DEEP nested sub-menus (not the top-level column) */
#kt_aside .menu-sub .menu-sub.menu-sub-accordion {
    position: relative;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
}

/* Arrows */
#kt_aside .menu-arrow:after {
    color: #6b719c !important;
}
#kt_aside .menu-link:hover .menu-arrow:after,
#kt_aside .menu-item.show > .menu-link .menu-arrow:after {
    color: #c4c9e2 !important;
}

/* Section separators (optional visual grouping via top-level items) */
#kt_aside .menu > .menu-item > .menu-sub > .menu-item > .menu-item.menu-accordion > .menu-link {
    font-weight: 600 !important;
}

/* Custom scrollbar */
#kt_aside .hover-scroll-overlay-y::-webkit-scrollbar {
    width: 6px;
}
#kt_aside .hover-scroll-overlay-y::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
#kt_aside .hover-scroll-overlay-y::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Collapsed / minimized rail keeps the navy look */
[data-kt-aside-minimize="on"] #kt_aside {
    width: 78px !important;
}
[data-kt-aside-minimize="on"] #kt_aside .aside-brand-text {
    display: none !important;
}
[data-kt-aside-minimize="on"] #kt_aside .aside-logo {
    justify-content: center !important;
}
[data-kt-aside-minimize="on"] #kt_aside .aside-toggle {
    display: none !important;
}
[data-kt-aside-minimize="on"] #kt_aside .menu-link {
    justify-content: center;
}

/* Section headings (grouping labels) */
#kt_aside .ak-nav-section {
    padding: 18px 28px 7px;
    margin-top: 4px;
}
#kt_aside .ak-nav-section span {
    color: #6b719c;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

/* Bottom user card */
#kt_aside {
    display: flex;
    flex-direction: column;
}
#kt_aside .aside-footer {
    padding: 14px 14px 26px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
#kt_aside .ak-user-card {
    width: 100%;
}
#kt_aside .ak-user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 11px;
    text-decoration: none;
    transition: background 0.15s ease;
}
#kt_aside .ak-user-card:hover {
    background: rgba(255, 255, 255, 0.06);
}
#kt_aside .ak-user-card .ak-avatar {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px;
    border-radius: 10px;
}
#kt_aside .ak-user-card-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}
#kt_aside .ak-user-card-meta .nm {
    color: #eef0f8;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#kt_aside .ak-user-card-meta .rl {
    color: #8b90b8;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#kt_aside .ak-user-card-exit {
    color: #8b90b8;
    display: flex;
    flex: 0 0 auto;
    transition: color 0.15s ease;
}
#kt_aside .ak-user-card:hover .ak-user-card-exit {
    color: var(--ak-gold);
}
/* Minimized rail: hide text bits */
[data-kt-aside-minimize="on"] #kt_aside .ak-nav-section,
[data-kt-aside-minimize="on"] #kt_aside .ak-user-card-meta,
[data-kt-aside-minimize="on"] #kt_aside .ak-user-card-exit {
    display: none !important;
}
[data-kt-aside-minimize="on"] #kt_aside .ak-user-card {
    justify-content: center;
}

/* ==========================================================================
   Header / Topbar
   ========================================================================== */
#kt_header {
    background: var(--ak-surface) !important;
    border-bottom: 1px solid var(--ak-border);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}
/* Fixed header + toolbar left offsets — DESKTOP ONLY (match the sidebar).
   On mobile the sidebar is a drawer, so these stay at Metronic's 0. */
@media (min-width: 992px) {
    .aside-enabled.aside-fixed.header-fixed .header {
        left: 232px !important;
    }
    .aside-enabled.aside-fixed.header-fixed[data-kt-aside-minimize="on"] .header {
        left: 78px !important;
    }
    .aside-enabled.aside-fixed.toolbar-fixed .toolbar {
        left: 232px !important;
    }
    .aside-enabled.aside-fixed.toolbar-fixed[data-kt-aside-minimize="on"] .toolbar {
        left: 78px !important;
    }
}

/* Page title + breadcrumb block */
.ak-page-head {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.ak-page-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--ak-text);
    line-height: 1.2;
    margin: 0;
}
.ak-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--ak-muted);
    margin-top: 2px;
}
.ak-breadcrumb a {
    color: var(--ak-muted);
    text-decoration: none;
}
.ak-breadcrumb a:hover {
    color: var(--ak-navy);
}
.ak-breadcrumb .sep {
    opacity: 0.5;
}

/* Search box */
.ak-search {
    position: relative;
    width: 260px;
    max-width: 34vw;
}
.ak-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa0b5;
    font-size: 1.05rem;
}
.ak-search input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--ak-border);
    background: #f6f7fb;
    border-radius: 10px;
    padding: 0 12px 0 38px;
    font-size: 0.88rem;
    color: var(--ak-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ak-search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--ak-gold);
    box-shadow: 0 0 0 3px rgba(246, 182, 44, 0.15);
}

/* Header icon buttons */
.ak-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    color: #5a6072;
    background: transparent;
    border: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.ak-icon-btn:hover {
    background: #f0f1f6;
    color: var(--ak-navy);
}
.ak-icon-btn i {
    font-size: 1.35rem;
}
.ak-icon-btn .ak-dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--ak-gold);
    border: 2px solid #fff;
    border-radius: 50%;
}

/* Avatar with initials */
.ak-avatar {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--ak-navy) 0%, var(--ak-navy-light) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(45, 51, 86, 0.25);
}
.ak-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 6px 4px 4px;
    border-radius: 12px;
    transition: background 0.15s ease;
}
.ak-user-trigger:hover {
    background: #f0f1f6;
}
.ak-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.ak-user-meta .nm {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ak-text);
}
.ak-user-meta .rl {
    font-size: 0.72rem;
    color: var(--ak-muted);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    border: 1px solid var(--ak-border) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.03) !important;
}
.card .card-header {
    border-bottom: 1px solid #f0f1f5 !important;
    min-height: 62px;
}
.card .card-title,
.card .card-label {
    font-weight: 700 !important;
    color: var(--ak-text) !important;
}

/* ==========================================================================
   Tables
   ========================================================================== */
/* High specificity (#id) so it beats per-page @push('styles') thead overrides */
body #kt_content .table thead th,
body #kt_content_container thead th,
body #kt_content thead th,
.table > thead th,
.table thead th {
    background-color: #eef1f8 !important;
    color: #3f465c !important;
    text-transform: uppercase;
    font-size: inherit !important;   /* match the table body font size */
    font-weight: 700 !important;     /* bold header */
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--ak-border) !important;
    padding-top: 13px !important;
    padding-bottom: 13px !important;
}
/* Neutralize per-page dark thead backgrounds */
body #kt_content thead,
body #kt_content_container thead {
    background-color: transparent !important;
}
.table > tbody > tr {
    transition: background 0.12s ease;
}
.table.table-hover > tbody > tr:hover,
.table > tbody > tr:hover {
    background: #f8f9fd;
}
.table td,
.table th {
    vertical-align: middle;
}
.table-rounded,
.card .table {
    border-radius: 0 0 14px 14px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
/* Match Metronic's own selector specificity (.btn.btn-primary…) so hover/active win */
.btn.btn-primary,
.btn-primary {
    background-color: var(--ak-navy) !important;
    border-color: var(--ak-navy) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(45, 51, 86, 0.18);
}
.btn.btn-primary:hover:not(.btn-active),
.btn.btn-primary:focus:not(.btn-active),
.btn.btn-primary:active:not(.btn-active),
.btn.btn-primary.active,
.btn.btn-primary.show,
.btn-check:checked + .btn.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--ak-navy-dark) !important;
    border-color: var(--ak-navy-dark) !important;
    color: #fff !important;
}
.btn-warning,
.btn-gold {
    background: var(--ak-gold) !important;
    border-color: var(--ak-gold) !important;
    color: #3a2f05 !important;
}
.btn-warning:hover,
.btn-gold:hover {
    background: var(--ak-gold-dark) !important;
    border-color: var(--ak-gold-dark) !important;
}
.btn-light-primary {
    background: var(--kt-primary-light) !important;
    color: var(--ak-navy) !important;
}
.btn {
    border-radius: 9px;
    font-weight: 600;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-control,
.form-select {
    border: 1px solid #e3e6ef !important;
    border-radius: 9px !important;
    color: var(--ak-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--ak-gold) !important;
    box-shadow: 0 0 0 3px rgba(246, 182, 44, 0.15) !important;
}
.form-label,
label.required,
.fw-semibold.fs-6 {
    color: #3b4257;
}
.form-control-solid,
.form-select-solid {
    background: #f6f7fb !important;
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
    border-radius: 7px;
    font-weight: 600;
    padding: 0.45em 0.7em;
}

/* ==========================================================================
   Breadcrumb inside content (Metronic default)
   ========================================================================== */
.breadcrumb .breadcrumb-item a {
    color: var(--ak-muted);
}
.breadcrumb .breadcrumb-item a:hover {
    color: var(--ak-navy);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    color: var(--ak-text);
    border: 1px solid var(--ak-border);
}
.pagination .page-item.active .page-link {
    background: var(--ak-navy) !important;
    border-color: var(--ak-navy) !important;
    color: #fff !important;
}

/* ==========================================================================
   Links & misc
   ========================================================================== */
a.text-hover-primary:hover,
.text-hover-primary:hover {
    color: var(--ak-navy) !important;
}
.text-primary {
    color: var(--ak-navy) !important;
}
.symbol.symbol-circle > img,
.symbol > img {
    object-fit: cover;
}

/* Footer */
#kt_footer {
    border-top: 1px solid var(--ak-border);
    background: var(--ak-surface);
}
#kt_footer a {
    color: var(--ak-muted) !important;
}

/* Responsive: hide search + user text on small screens */
@media (max-width: 991.98px) {
    .ak-search { display: none; }
    .ak-user-meta { display: none; }
    .ak-page-title { font-size: 1rem; }
}

