/* ================================================================
   AFMS AACTL — Modern UI System
   ================================================================ */

/* ---------------------------------------------------------------
   1. CSS VARIABLES
--------------------------------------------------------------- */
:root {
    /* Brand */
    --nav-bg-from:    #0d1f35;
    --nav-bg-to:      #1a4272;
    --nav-accent:     #16c79a;
    --nav-height:     56px;
    --nav-text:       rgba(255,255,255,0.88);
    --nav-text-hover: #ffffff;
    --nav-drop-bg:    #132b47;
    --nav-drop-hover: #0d1f35;

    /* Surfaces (light mode) */
    --bg-page:        #f0f4f8;
    --bg-card:        #ffffff;
    --bg-input:       #ffffff;
    --border:         #e2e8f0;

    /* Text (light mode) */
    --txt-1:          #1a202c;
    --txt-2:          #4a5568;
    --txt-3:          #718096;

    /* Accent */
    --accent:         #1a6bcc;

    /* Radii */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;

    /* Shadows */
    --s-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --s-md:  0 4px 12px rgba(0,0,0,.09), 0 2px 4px rgba(0,0,0,.06);
    --s-lg:  0 10px 28px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.07);

    /* Transition */
    --t: all 0.2s ease;
}

/* ---------------------------------------------------------------
   2. BASE / TYPOGRAPHY
--------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.65;
    color: var(--txt-1);
    background: var(--bg-page);
    padding-bottom: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: 1.7rem;  font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; }
h2, .h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em;  line-height: 1.3; }
h3, .h3 { font-size: 1.2rem;  font-weight: 600; letter-spacing: -0.01em;  line-height: 1.35; }
h4, .h4 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
h5, .h5 { font-size: 0.95rem; font-weight: 600; }
h6, .h6 { font-size: 0.875rem;font-weight: 600; }
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 { color: var(--txt-1); margin-bottom: 0.5rem; }

p  { color: var(--txt-2); margin-bottom: 0.75rem; }
small, .small { font-size: 0.8rem; }
.text-muted { color: var(--txt-3) !important; }

label { font-size: 13px; font-weight: 500; color: var(--txt-2); margin-bottom: 4px; }
.col-form-label { font-size: 13px; font-weight: 500; color: var(--txt-2); }

/* ---------------------------------------------------------------
   3. NAVBAR / HEADER
--------------------------------------------------------------- */
#masthead.site-header,
#masthead.site-header.bg-primary,
#masthead.site-header.bg-dark,
#masthead.site-header.bg-light,
#masthead.site-header.navbar-light,
#masthead.site-header.navbar-dark {
    background: linear-gradient(90deg, var(--nav-bg-from) 0%, var(--nav-bg-to) 100%) !important;
    box-shadow: 0 2px 16px rgba(0,0,0,.28);
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid rgba(255,255,255,.07);
    transition: box-shadow 0.3s ease;
}

/* Glassmorphism when browser supports it */
@supports (backdrop-filter: blur(12px)) {
    #masthead.site-header {
        background: linear-gradient(
            90deg,
            rgba(13, 31, 53, 0.93) 0%,
            rgba(26, 66, 114, 0.93) 100%
        ) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

/* Container full-width inside header */
#masthead .container {
    max-width: 100% !important;
    padding: 0 20px;
}

/* Navbar row — center all direct children, let brand & nav stretch themselves */
#masthead .navbar {
    padding: 0 !important;
    min-height: var(--nav-height);
    align-items: center;   /* vertical center everything by default */
    flex-wrap: nowrap;
}

/* ── Brand — stretches to full height so border-right covers the full bar ── */
#masthead a.navbar-brand {
    display: flex !important;
    align-items: center;      /* center img + text inside */
    align-self: stretch;      /* stretch to full nav height */
    gap: 10px;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0 18px 0 0;
    margin-right: 8px;
    border-right: 1px solid rgba(255,255,255,.15);
    text-decoration: none !important;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--t);
    max-width: 280px;
}
#masthead a.navbar-brand img {
    height: 30px !important;
    width: auto;
    flex-shrink: 0;
}
#masthead a.navbar-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
}
#masthead a.navbar-brand:hover { color: var(--nav-accent) !important; }

/* ── Dark mode toggle — stays vertically centered ── */
#darkModeToggle {
    align-self: center;         /* don't stretch — stay centered */
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    color: rgba(255,255,255,.9) !important;
    border-radius: var(--r-sm) !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: .02em;
    line-height: 1.4;
    transition: var(--t) !important;
    flex-shrink: 0;
    margin-right: 6px;
}
#darkModeToggle:hover {
    background: rgba(255,255,255,.16) !important;
    border-color: rgba(255,255,255,.4) !important;
    color: #fff !important;
}

/* ── Navbar collapse container — stretches so nav items can fill full height ── */
#masthead .navbar-collapse {
    align-self: stretch;
    display: flex;
    align-items: stretch;
}

/* ── Nav links ── */
#masthead .navbar-nav {
    align-items: stretch;
    height: 100%;
}
#masthead .navbar-nav .nav-item {
    display: flex;
    align-items: stretch;
}
#masthead .navbar-nav > .nav-item > .nav-link {
    display: flex;
    align-items: center;      /* center text inside the stretched link */
    color: var(--nav-text) !important;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .015em;
    padding: 0 12px !important;
    white-space: nowrap;
    position: relative;
    transition: color .2s ease, background .2s ease;
}

/* Slide-up accent underline on hover */
#masthead .navbar-nav > .nav-item > .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--nav-accent);
    border-radius: 3px 3px 0 0;
    transition: width .22s ease;
}
#masthead .navbar-nav > .nav-item > .nav-link:hover,
#masthead .navbar-nav > .nav-item > .nav-link:focus,
#masthead .navbar-nav > .nav-item.active > .nav-link,
#masthead .navbar-nav > .nav-item.current-menu-item > .nav-link,
#masthead .navbar-nav > .nav-item.current-menu-parent > .nav-link {
    color: var(--nav-text-hover) !important;
    background: rgba(255,255,255,.06);
}
#masthead .navbar-nav > .nav-item > .nav-link:hover::after,
#masthead .navbar-nav > .nav-item.active > .nav-link::after,
#masthead .navbar-nav > .nav-item.current-menu-item > .nav-link::after,
#masthead .navbar-nav > .nav-item.current-menu-parent > .nav-link::after {
    width: 70%;
}

/* Bootstrap's auto-generated ::after for dropdown-toggle conflicts — reset it */
#masthead .navbar-nav .dropdown-toggle::after {
    display: inline-block;
    width: 0;
    height: 0;
    content: '';
    border: none;
    margin-left: 5px;
    vertical-align: 0.15em;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    position: static;
    transform: none;
    background: none;
    border-radius: 0;
    transition: none;
}

/* ── Dropdown menu ── */
#masthead .navbar-nav .dropdown-menu {
    background: var(--nav-drop-bg) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    border-radius: var(--r-sm) !important;
    box-shadow: var(--s-lg) !important;
    padding: 6px 0 !important;
    margin-top: 0 !important;
    min-width: 185px;
    animation: navDropIn .15s ease forwards;
}
@keyframes navDropIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}
#masthead .navbar-nav .dropdown-menu .dropdown-item {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,.82) !important;
    padding: 8px 16px !important;
    transition: var(--t);
    border-left: 2px solid transparent;
}
#masthead .navbar-nav .dropdown-menu .dropdown-item:hover,
#masthead .navbar-nav .dropdown-menu .dropdown-item:focus {
    background: var(--nav-drop-hover) !important;
    color: #fff !important;
    border-left-color: var(--nav-accent);
}
#masthead .navbar-nav .dropdown-menu .dropdown-divider {
    border-color: rgba(255,255,255,.1) !important;
    margin: 4px 8px;
}

/* Sub-menus (nested dropdowns) */
#masthead .navbar-nav .dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px !important;
}

/* ── Hamburger ── */
#masthead .navbar-toggler {
    align-self: center;          /* stays centered, never stretches */
    border-color: rgba(255,255,255,.3) !important;
    padding: 5px 9px;
    border-radius: var(--r-sm);
}
#masthead .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255%2C255%2C255%2C0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}
#masthead .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(22,199,154,.3) !important;
    outline: none;
}

/* ---------------------------------------------------------------
   4. BREADCRUMB
--------------------------------------------------------------- */
nav[aria-label="breadcrumb"] {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.breadcrumb {
    margin-bottom: 0;
    padding: 9px 20px;
    border-radius: 0;
    font-size: 12.5px;
    background: transparent;
    align-items: center;
}
.breadcrumb-item a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: var(--txt-3); font-weight: 400; }
.breadcrumb-item + .breadcrumb-item::before { color: #cbd5e0; }

/* ---------------------------------------------------------------
   5. PAGE CONTENT
--------------------------------------------------------------- */
#content.site-content {
    padding-top: 10px !important;
    padding-bottom: 20px;
    min-height: calc(100vh - var(--nav-height) - 80px);
}

/* ---------------------------------------------------------------
   6. CARDS
--------------------------------------------------------------- */
.card {
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--s-sm) !important;
    overflow: hidden;
    transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--s-md) !important; }
.card-header {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 18px;
    letter-spacing: .01em;
    border-bottom: 1px solid var(--border) !important;
}
.card-body  { padding: 16px 18px; }
.card-footer {
    padding: 10px 18px;
    border-top: 1px solid var(--border) !important;
    background: rgba(0,0,0,.02) !important;
}

/* ---------------------------------------------------------------
   7. BUTTONS
--------------------------------------------------------------- */
.btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--r-sm) !important;
    padding: 6px 14px;
    letter-spacing: .01em;
    transition: all .18s ease !important;
}
.btn:focus { box-shadow: none !important; outline: none; }
.btn-sm { font-size: 12px; padding: 3px 9px !important; border-radius: 5px !important; }

.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,107,204,.38) !important; }
.btn-success:hover  { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(40,167,69,.38) !important; }
.btn-danger:hover   { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(220,53,69,.38) !important; }
.btn-warning:hover  { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(255,193,7,.38) !important; }
.btn-info:hover     { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(23,162,184,.38) !important; }
.btn-secondary:hover{ transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,117,125,.38) !important; }

/* ---------------------------------------------------------------
   8. FORMS
--------------------------------------------------------------- */
.form-control {
    font-size: 13px;
    border-radius: var(--r-sm) !important;
    border-color: #d1d9e0;
    background-color: var(--bg-input);
    transition: border-color .18s ease, box-shadow .18s ease;
    padding: 6px 10px;
    color: var(--txt-1);
}
.form-control:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(26,108,168,.15) !important;
}
.form-control-sm { font-size: 12px !important; padding: 4px 8px !important; }
.input-group-text {
    font-size: 13px;
    background: #f7fafc;
    border-color: #d1d9e0;
    color: var(--txt-2);
    border-radius: var(--r-sm) !important;
}

/* ---------------------------------------------------------------
   9. TABLES
--------------------------------------------------------------- */
.table { font-size: 13px; }
.table th {
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #4a5568;
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-responsive {
    border-radius: var(--r-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* DataTables controls */
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
    font-size: 13px;
    color: var(--txt-2);
    font-weight: 400;
}
div.dataTables_wrapper div.dataTables_info {
    font-size: 12.5px;
    color: var(--txt-3);
    padding-top: 10px;
}

/* ---------------------------------------------------------------
   10. BADGES
--------------------------------------------------------------- */
.badge {
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 9px !important;
    border-radius: 20px !important;
    letter-spacing: .02em;
}

/* ---------------------------------------------------------------
   11. FOOTER — same gradient as navbar, constrained width
--------------------------------------------------------------- */
footer#colophon,
footer.site-footer,
#colophon.site-footer,
#colophon.bg-primary,
#colophon.bg-dark,
#colophon.bg-light,
#colophon.navbar-dark,
#colophon.navbar-light {
    background: linear-gradient(90deg, var(--nav-bg-from) 0%, var(--nav-bg-to) 100%) !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    font-size: 12.5px;
    padding: 10px 0 !important;
    box-shadow: 0 -2px 16px rgba(0,0,0,.32);
    /* Constrain footer so it doesn't span the full viewport width */
    max-width: 1100px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 10px 10px 0 0 !important;
}
footer#colophon .site-info {
    color: rgba(255,255,255,.75) !important;
}
footer#colophon .site-info a {
    color: var(--nav-accent) !important;
    text-decoration: none;
    font-weight: 500;
}
footer#colophon .site-info a:hover {
    color: #5effd9 !important;
    text-decoration: underline;
}

/* ---------------------------------------------------------------
   12. DARK MODE — navbar gradient override
--------------------------------------------------------------- */
body.dark-mode #masthead.site-header,
body.dark-mode #masthead.site-header.bg-primary,
body.dark-mode #masthead.site-header.bg-dark {
    background: linear-gradient(90deg, #080e14 0%, #0d1f35 100%) !important;
    box-shadow: 0 2px 16px rgba(0,0,0,.55);
    border-bottom-color: rgba(255,255,255,.06) !important;
}
@supports (backdrop-filter: blur(12px)) {
    body.dark-mode #masthead.site-header {
        background: linear-gradient(
            90deg,
            rgba(8, 14, 20, 0.95) 0%,
            rgba(13, 31, 53, 0.95) 100%
        ) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}
body.dark-mode nav[aria-label="breadcrumb"] {
    background: #161b22;
    border-bottom-color: #30363d;
    box-shadow: none;
}
body.dark-mode .breadcrumb-item a { color: #58a6ff; }
body.dark-mode .breadcrumb-item.active { color: #8b949e; }
body.dark-mode .breadcrumb-item + .breadcrumb-item::before { color: #484f58; }

body.dark-mode #content.site-content { background: #0d1117 !important; }
body.dark-mode .card { border-color: #21262d !important; box-shadow: 0 2px 8px rgba(0,0,0,.4) !important; }
body.dark-mode .card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.5) !important; }
body.dark-mode .card-header { border-bottom-color: #21262d !important; }
body.dark-mode .card-footer { border-top-color: #21262d !important; background: rgba(255,255,255,.02) !important; }
body.dark-mode .form-control { border-color: #30363d; background: #21262d; color: #e6edf3; }
body.dark-mode .input-group-text { background: #161b22; border-color: #30363d; color: #8b949e; }
body.dark-mode label,
body.dark-mode .col-form-label { color: #c9d1d9; }
body.dark-mode p { color: #c9d1d9; }
body.dark-mode h1,body.dark-mode h2,body.dark-mode h3,
body.dark-mode h4,body.dark-mode h5,body.dark-mode h6 { color: #f0f6fc; }
body.dark-mode .table th { color: #8b949e; }
body.dark-mode nav[aria-label="breadcrumb"],
body.dark-mode div.dataTables_wrapper div.dataTables_length label,
body.dark-mode div.dataTables_wrapper div.dataTables_filter label { color: #8b949e; }

/* ---------------------------------------------------------------
   13. RESPONSIVE
--------------------------------------------------------------- */

/* XL — slightly tighter nav links */
@media (max-width: 1199.98px) {
    #masthead .navbar-nav > .nav-item > .nav-link {
        padding: 0 9px !important;
        font-size: 12.5px;
    }
}

/* LG — collapsed nav */
@media (max-width: 991.98px) {
    :root { --nav-height: 52px; }

    #masthead a.navbar-brand { font-size: 13.5px; padding-right: 14px; }
    #masthead a.navbar-brand img { height: 26px !important; }

    /* Mobile nav panel */
    #masthead .navbar-collapse {
        background: var(--nav-drop-bg);
        border-top: 1px solid rgba(255,255,255,.08);
        margin: 0 -20px;
        padding: 6px 0 10px;
        box-shadow: 0 8px 20px rgba(0,0,0,.25);
    }
    #masthead .navbar-nav { flex-direction: column; }
    #masthead .navbar-nav .nav-item { display: block; }
    #masthead .navbar-nav > .nav-item > .nav-link {
        min-height: 44px;
        padding: 0 18px !important;
        border-bottom: 1px solid rgba(255,255,255,.05);
        font-size: 13px;
    }
    /* Hide slide underline on mobile */
    #masthead .navbar-nav > .nav-item > .nav-link::after { display: none; }

    /* Nested dropdown inside mobile */
    #masthead .navbar-nav .dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(0,0,0,.18) !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        animation: none !important;
    }
    #masthead .navbar-nav .dropdown-menu .dropdown-item {
        padding: 9px 28px !important;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,.04);
    }

    /* Table sizing */
    .table th, .table td { font-size: 12px; padding: 6px 8px !important; }
    .table .btn { font-size: 11px; padding: 2px 6px !important; }
}

/* MD */
@media (max-width: 767.98px) {
    body { font-size: 13px; }
    .card-body { padding: 12px; }
    .breadcrumb { font-size: 11.5px; padding: 6px 12px; }

    div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_filter {
        text-align: left !important;
        margin-bottom: 8px;
    }

    .table th, .table td { font-size: 12px; padding: 5px 6px !important; white-space: nowrap; }
    .table .btn-sm { padding: 2px 5px !important; font-size: 10px !important; }

    .pagination { justify-content: center !important; flex-wrap: wrap; }

    h1,.h1 { font-size: 1.4rem; }
    h2,.h2 { font-size: 1.2rem; }
    h3,.h3 { font-size: 1.05rem; }
}

/* SM */
@media (max-width: 575.98px) {
    .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }
    .card-header, .card-body { padding: 10px 12px; }
    h4,.h4 { font-size: 1rem; }
    .btn { font-size: 12px; }
    #masthead a.navbar-brand { font-size: 12.5px; border-right: none; padding-right: 0; max-width: 180px; }
    #masthead a.navbar-brand span { display: none; }
}
