/* =====================================================================
   Gems Prize Bond - adminHMD-style theme (Bootstrap 5 skin)
   Pure styling: no behaviour lives here. Kept in a file (no inline style
   attributes anywhere) so the Content-Security-Policy stays strict.
   Change the look of the whole site from the :root block below.
   ===================================================================== */

:root {
    --hmd-primary: #4f46e5;
    --hmd-primary-dark: #4338ca;
    --hmd-primary-rgb: 79, 70, 229;
    --hmd-primary-soft: #eef0ff;
    --hmd-bg: #f4f6fb;
    --hmd-surface: #ffffff;
    --hmd-border: #e7eaf3;
    --hmd-text: #1c2333;
    --hmd-muted: #6b7488;
    --hmd-radius: 14px;
    --hmd-radius-sm: 10px;
    --hmd-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
    --hmd-sidebar-w: 268px;
    --hmd-topbar-h: 68px;

    --bs-primary: var(--hmd-primary);
    --bs-primary-rgb: var(--hmd-primary-rgb);
    --bs-link-color: var(--hmd-primary);
    --bs-link-color-rgb: var(--hmd-primary-rgb);
    --bs-link-hover-color: var(--hmd-primary-dark);
    --bs-body-bg: var(--hmd-bg);
    --bs-body-color: var(--hmd-text);
    --bs-secondary-color: var(--hmd-muted);
    --bs-border-color: var(--hmd-border);
    --bs-border-radius: var(--hmd-radius-sm);
    --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
}

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 15.5px; } }

body {
    background: var(--hmd-bg);
    color: var(--hmd-text);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }
.text-muted { color: var(--hmd-muted) !important; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: baseline; gap: 2px; font-weight: 900; line-height: 1; }
.brand-gems { color: #16a34a; font-size: 2.7rem; }
.brand-bond { color: #dc2626; font-size: 2.2rem; }
.brand-lg .brand-gems { font-size: 3.5rem; }
.brand-lg .brand-bond { font-size: 2.8rem; }

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

.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--hmd-sidebar-w);
    background: var(--hmd-surface);
    border-right: 1px solid var(--hmd-border);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    height: var(--hmd-topbar-h);
    display: flex; align-items: center;
    padding: 0 1.4rem;
    border-bottom: 1px solid var(--hmd-border);
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 1.1rem .9rem; }
.sidebar-heading {
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #98a0b3; padding: .9rem .8rem .45rem;
}
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .62rem .85rem; margin-bottom: 3px;
    border-radius: var(--hmd-radius-sm);
    color: #4b5468; font-weight: 500; font-size: .95rem;
    transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; color: #8b93a7; transition: color .15s; }
.sidebar-link:hover { background: #f3f5fb; color: var(--hmd-text); }
.sidebar-link:hover i { color: var(--hmd-primary); }
.sidebar-link.active { background: var(--hmd-primary-soft); color: var(--hmd-primary); font-weight: 600; }
.sidebar-link.active i { color: var(--hmd-primary); }
.sidebar-link .badge { margin-left: auto; }

.sidebar-footer { padding: .9rem; border-top: 1px solid var(--hmd-border); }
.sidebar-card {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem .8rem; border-radius: var(--hmd-radius-sm); background: #f6f7fc;
}
.sidebar-card .meta { min-width: 0; line-height: 1.25; }
.sidebar-card .meta strong { display: block; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-card .meta span { font-size: .75rem; color: var(--hmd-muted); }

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    z-index: 1035; display: none;
}

.app-main { min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 992px) { .app-main { margin-left: var(--hmd-sidebar-w); } }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(15, 23, 42, .25); }
    body.sidebar-open .sidebar-backdrop { display: block; }
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1020;
    height: var(--hmd-topbar-h);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--hmd-border);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-title { font-size: 1.02rem; font-weight: 600; margin: 0; color: var(--hmd-text); }
.topbar-sub { font-size: .75rem; color: var(--hmd-muted); display: block; line-height: 1.1; }

.icon-btn {
    position: relative;
    width: 42px; height: 42px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--hmd-border); color: #4b5468;
    font-size: 1.15rem; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hmd-primary-soft); border-color: #d9dcff; color: var(--hmd-primary); }
.icon-btn .badge {
    position: absolute; top: -6px; right: -6px; margin: 0 !important;
    font-size: .65rem; padding: .28em .5em; border: 2px solid #fff;
}
.menu-toggle { display: inline-flex; }
@media (min-width: 992px) { .menu-toggle { display: none; } }

.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    font-weight: 700; font-size: .95rem; color: #fff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }

.user-chip {
    display: inline-flex; align-items: center; gap: .6rem;
    padding: .3rem .75rem .3rem .3rem; border-radius: 999px;
    background: #fff; border: 1px solid var(--hmd-border); color: var(--hmd-text);
    font-weight: 600; font-size: .88rem; cursor: pointer;
}
.user-chip:hover { border-color: #d9dcff; background: #fafaff; }
.user-chip .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown-menu {
    border: 1px solid var(--hmd-border); border-radius: var(--hmd-radius-sm);
    box-shadow: 0 12px 36px rgba(16, 24, 40, .12); padding: .45rem; min-width: 220px;
}
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .92rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item:hover { background: var(--hmd-primary-soft); color: var(--hmd-primary); }
.dropdown-item.text-danger:hover { background: #fdecec; color: #dc2626; }
.dropdown-header-card { padding: .6rem .75rem .5rem; }
.dropdown-header-card strong { display: block; font-size: .92rem; }
.dropdown-header-card span { font-size: .78rem; color: var(--hmd-muted); }

/* ---------- Page content ---------- */
.page-content { flex: 1; padding: 1.75rem 1.5rem 1rem; width: 100%; max-width: 1320px; margin: 0 auto; }
@media (max-width: 575.98px) { .page-content { padding: 1.25rem 1rem .5rem; } }

.page-content h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 1.25rem; }
.page-content h2.h4, .page-content h2.h5, .page-content h2.h6, .page-content h3.h6 { font-weight: 650; letter-spacing: -.005em; }
.page-eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hmd-primary); margin-bottom: .2rem; }
.page-sub { color: var(--hmd-muted); margin: -.8rem 0 1.4rem; }

.app-footer {
    padding: 1.1rem 1.5rem; margin-top: 1rem;
    color: var(--hmd-muted); font-size: .85rem;
    border-top: 1px solid var(--hmd-border); background: transparent;
}
.app-footer .brand-gems { font-size: 1.3rem; }
.app-footer .brand-bond { font-size: 1.1rem; }

/* ---------- Cards / panels ---------- */
.card, .panel {
    background: var(--hmd-surface);
    border: 1px solid var(--hmd-border);
    border-radius: var(--hmd-radius);
    box-shadow: var(--hmd-shadow);
}
.panel { padding: 1.4rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.05rem; font-weight: 650; }
.panel-head p { margin: .15rem 0 0; font-size: .85rem; color: var(--hmd-muted); }
.card-body { padding: 1.25rem; }

/* Forms that sit in the standard "col-md-6" pattern become a panel automatically. */
main > .row > .col-md-6 > form {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border);
    border-radius: var(--hmd-radius); box-shadow: var(--hmd-shadow); padding: 1.6rem;
}
/* Stand-alone post forms (bulk import, upload) get the same panel treatment. */
main > form[method="post"]:not(.d-inline),
main > .row > .col-md-7 > form {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border);
    border-radius: var(--hmd-radius); box-shadow: var(--hmd-shadow); padding: 1.6rem;
}
/* Search / filter bars become toolbars. */
main > form[method="get"] {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border);
    border-radius: var(--hmd-radius); box-shadow: var(--hmd-shadow); padding: .9rem 1.1rem;
}
main > .d-flex > form[method="get"] .form-control { min-width: 220px; }

/* Plain details lists */
main > dl.row, .panel dl.row { margin-bottom: .25rem; }
main > dl.row { background: var(--hmd-surface); border: 1px solid var(--hmd-border); border-radius: var(--hmd-radius); padding: 1rem 1.2rem .4rem; box-shadow: var(--hmd-shadow); margin-left: 0; margin-right: 0; }
dt { color: var(--hmd-muted); font-weight: 500; }
dd { font-weight: 600; }

/* ---------- Stat cards ---------- */
.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.25rem; height: 100%; text-align: left; }
.stat-icon {
    width: 50px; height: 50px; flex: 0 0 auto; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem;
    background: var(--hmd-primary-soft); color: var(--hmd-primary);
}
.stat-icon.green  { background: #e6f7ee; color: #12a150; }
.stat-icon.amber  { background: #fff4de; color: #d98a00; }
.stat-icon.rose   { background: #fdecec; color: #dc2626; }
.stat-icon.sky    { background: #e5f4fd; color: #0a8bd6; }
.stat-icon.violet { background: #f1eaff; color: #7c3aed; }
.stat-label { font-size: .82rem; color: var(--hmd-muted); font-weight: 500; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }

/* ---------- Tables ---------- */
.table-responsive {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border);
    border-radius: var(--hmd-radius); box-shadow: var(--hmd-shadow);
}
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: #f7f8ff;
    margin-bottom: 0; font-size: .93rem;
}
.table > thead > tr > th {
    background: #f8f9fd; color: #6b7488; border-bottom: 1px solid var(--hmd-border);
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: .85rem 1rem; white-space: nowrap;
}
.table > tbody > tr > td { padding: .85rem 1rem; border-color: #eef0f6; vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tbody > tr:hover > * { --bs-table-bg-state: var(--bs-table-hover-bg); }
.table td, .table th { overflow-wrap: anywhere; }
.table-responsive > .table > thead > tr:first-child > th:first-child { border-top-left-radius: var(--hmd-radius); }
.table-responsive > .table > thead > tr:first-child > th:last-child { border-top-right-radius: var(--hmd-radius); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--hmd-radius-sm); font-weight: 600; font-size: .92rem; padding: .5rem 1rem; transition: all .15s; }
.btn-sm { font-size: .82rem; padding: .35rem .7rem; border-radius: 8px; }
.btn-lg { font-size: 1rem; padding: .7rem 1.5rem; border-radius: 12px; }

.btn-primary {
    --bs-btn-bg: var(--hmd-primary); --bs-btn-border-color: var(--hmd-primary);
    --bs-btn-hover-bg: var(--hmd-primary-dark); --bs-btn-hover-border-color: var(--hmd-primary-dark);
    --bs-btn-active-bg: var(--hmd-primary-dark); --bs-btn-active-border-color: var(--hmd-primary-dark);
    --bs-btn-disabled-bg: var(--hmd-primary); --bs-btn-disabled-border-color: var(--hmd-primary);
    box-shadow: 0 4px 12px rgba(var(--hmd-primary-rgb), .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--hmd-primary); --bs-btn-border-color: #cfd3ff;
    --bs-btn-hover-bg: var(--hmd-primary); --bs-btn-hover-border-color: var(--hmd-primary);
    --bs-btn-active-bg: var(--hmd-primary); --bs-btn-active-border-color: var(--hmd-primary);
}
.btn-outline-secondary {
    --bs-btn-color: #4b5468; --bs-btn-border-color: var(--hmd-border); --bs-btn-bg: #fff;
    --bs-btn-hover-bg: #f3f5fb; --bs-btn-hover-color: var(--hmd-text); --bs-btn-hover-border-color: #d5d9e8;
    --bs-btn-active-bg: #eceffa; --bs-btn-active-color: var(--hmd-text); --bs-btn-active-border-color: #d5d9e8;
}
.btn-outline-danger { --bs-btn-border-color: #f6c9c9; --bs-btn-bg: #fff; }
.btn-outline-success { --bs-btn-border-color: #bfe9d1; --bs-btn-bg: #fff; }
.btn-success { --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #138a3f; --bs-btn-hover-border-color: #138a3f; }
.btn-danger { --bs-btn-bg: #e5484d; --bs-btn-border-color: #e5484d; --bs-btn-hover-bg: #cf3a3f; --bs-btn-hover-border-color: #cf3a3f; }
.btn-link { color: var(--hmd-primary); font-weight: 600; text-decoration: none; }
.btn-link:hover { color: var(--hmd-primary-dark); text-decoration: underline; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .86rem; color: #3d4659; margin-bottom: .4rem; }
.form-control, .form-select {
    border-radius: var(--hmd-radius-sm); border-color: #dde1ee; padding: .6rem .85rem; background-color: #fff;
}
.form-control-sm, .form-select-sm { padding: .3rem .6rem; border-radius: 8px; }
.form-control:focus, .form-select:focus {
    border-color: var(--hmd-primary);
    box-shadow: 0 0 0 .22rem rgba(var(--hmd-primary-rgb), .15);
}
.form-check-input:checked { background-color: var(--hmd-primary); border-color: var(--hmd-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .22rem rgba(var(--hmd-primary-rgb), .15); border-color: var(--hmd-primary); }
.text-danger.field-validation-error, span.text-danger { font-size: .82rem; }
.search-input { max-width: 260px; }
.limit-field { width: 100%; max-width: 260px; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; border-radius: 999px; padding: .4em .8em; font-size: .75rem; }
.badge.bg-success   { background: #e6f7ee !important; color: #0f8a4b !important; }
.badge.bg-secondary { background: #eef0f6 !important; color: #5b6479 !important; }
.badge.bg-warning   { background: #fff4de !important; color: #b86e00 !important; }
.badge.bg-danger    { background: #fdecec !important; color: #c92a2a !important; }
.badge.bg-danger.rounded-pill { background: #ef4444 !important; color: #fff !important; }
.badge.bg-light     { background: #f4f6fb !important; color: #3d4659 !important; border-color: var(--hmd-border) !important; }

/* ---------- Alerts / lists ---------- */
.alert { border: 1px solid transparent; border-radius: var(--hmd-radius-sm); padding: .9rem 1.1rem; box-shadow: none; }
.alert-success { background: #eaf8f0; border-color: #c5ebd7; color: #0f6b3b; }
.alert-danger  { background: #fdeeee; border-color: #f8cfcf; color: #a12626; }
.alert-warning { background: #fff7e6; border-color: #fbe3b0; color: #8a5a00; }
.alert-info    { background: #e9f5fd; border-color: #c4e3f7; color: #0b5d8f; }

.list-group { border-radius: var(--hmd-radius); overflow: hidden; border: 1px solid var(--hmd-border); box-shadow: var(--hmd-shadow); }
.list-group-item { border-color: #eef0f6; padding: 1rem 1.25rem; }
.list-group-item-success { background: var(--hmd-primary-soft); color: var(--hmd-text); border-left: 3px solid var(--hmd-primary); }

/* ---------- Pagination footer ---------- */
.page-content .d-flex.justify-content-between.align-items-center.mt-3 {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border); border-radius: var(--hmd-radius);
    padding: .7rem 1.1rem; box-shadow: var(--hmd-shadow); flex-wrap: wrap; gap: .6rem;
}

/* ---------- Hero (home / error / access denied) ---------- */
.hero {
    text-align: center; padding: 4rem 1.5rem; margin-top: .5rem;
    background:
        radial-gradient(900px 300px at 15% -10%, rgba(var(--hmd-primary-rgb), .14), transparent 60%),
        radial-gradient(700px 260px at 95% 110%, rgba(22, 163, 74, .12), transparent 60%),
        var(--hmd-surface);
    border: 1px solid var(--hmd-border); border-radius: 20px; box-shadow: var(--hmd-shadow);
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 800; letter-spacing: -.02em; }
.hero .lead { color: var(--hmd-muted); max-width: 640px; margin: 0 auto 1.8rem; }

/* ---------- Auth pages ---------- */
.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(var(--hmd-primary-rgb), .16), transparent 60%),
        radial-gradient(800px 380px at 100% 110%, rgba(22, 163, 74, .13), transparent 60%),
        var(--hmd-bg);
}
.auth-card {
    background: var(--hmd-surface); border: 1px solid var(--hmd-border); border-radius: 20px;
    box-shadow: 0 20px 60px rgba(16, 24, 40, .10); padding: 2rem;
}
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; }
.auth-card .btn-primary { min-width: 120px; }

/* ---------- Misc ---------- */
.visually-hidden-focusable:focus { position: fixed; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem .8rem; border-radius: 8px; box-shadow: var(--hmd-shadow); }
.navbar-nav .nav-link.btn-link { text-decoration: none; }
