/* ==========================================================================
   OTT King – Admin CMS  (Bootstrap 5.3 theme layer)
   Only brand tokens + layout shell live here. Everything else is stock Bootstrap.
   ========================================================================== */
:root {
    --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans Bengali", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #4338ca;
    --bs-border-radius: .5rem;
    --bs-border-radius-lg: .75rem;
    --sb-w: 260px;
    --sb-bg: #0f172a;
    --sb-bg-hover: rgba(255, 255, 255, .06);
    --sb-text: #94a3b8;
    --sb-text-active: #fff;
    --topbar-h: 60px;
}
[data-bs-theme="light"] { --app-bg: #f4f6fb; --card-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06); }
[data-bs-theme="dark"]  { --app-bg: #0b1120; --bs-body-bg: #0f172a; --bs-tertiary-bg: #131c31; --card-shadow: none; --sb-bg: #0a1020; }

body { background: var(--app-bg); font-size: .9rem; }
.btn-primary { --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3; --bs-btn-disabled-bg: #4f46e5; --bs-btn-disabled-border-color: #4f46e5; }
.btn-outline-primary { --bs-btn-color: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4f46e5; --bs-btn-hover-border-color: #4f46e5; --bs-btn-active-bg: #4338ca; }
.text-primary { color: #4f46e5 !important; }
.form-check-input:checked { background-color: #4f46e5; border-color: #4f46e5; }
.form-control:focus, .form-select:focus { border-color: #818cf8; box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .35rem; }
.form-text { font-size: .75rem; }
.required::after { content: " *"; color: var(--bs-danger); }

/* ---------- Shell ---------- */
.app-main { min-height: 100vh; }
@media (min-width: 992px) { .app-main { margin-left: var(--sb-w); } }

/* Sidebar: Bootstrap offcanvas below lg, fixed rail from lg up */
.app-sidebar { --bs-offcanvas-width: var(--sb-w); background: var(--sb-bg); color: var(--sb-text); border: 0; }
@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg { position: fixed !important; inset: 0 auto 0 0; width: var(--sb-w) !important; height: 100vh !important; background: var(--sb-bg) !important; visibility: visible !important; transform: none !important; z-index: 1030; border-right: 1px solid rgba(255, 255, 255, .06) !important; }
}
.sb-brand { height: var(--topbar-h); display: flex; align-items: center; gap: .65rem; padding: 0 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0; }
.sb-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: #4f46e5; color: #fff; display: grid; place-items: center; font-size: 1.05rem; }
.sb-brand .name { color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.sb-nav { padding: .75rem .75rem 1.5rem; overflow-y: auto; flex: 1; }
.sb-nav::-webkit-scrollbar { width: 6px; } .sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }
.sb-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; padding: 1rem .75rem .4rem; }
.sb-link { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .75rem; border: 0; background: none; border-radius: .5rem; color: var(--sb-text); font-weight: 500; font-size: .875rem; text-decoration: none; text-align: left; transition: background .15s, color .15s; }
.sb-link i.ico { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.sb-link:hover { background: var(--sb-bg-hover); color: #e2e8f0; }
.sb-link.active { background: #4f46e5; color: var(--sb-text-active); box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .6); }
.sb-link .chev { margin-left: auto; font-size: .7rem; transition: transform .2s; }
.sb-link[aria-expanded="true"] .chev { transform: rotate(180deg); }
.sb-link[aria-expanded="true"]:not(.active) { color: #e2e8f0; }
.sb-sub { list-style: none; margin: .15rem 0 .35rem 1.35rem; padding: 0 0 0 .85rem; border-left: 1px solid rgba(255, 255, 255, .1); }
.sb-sub .sb-link { font-size: .83rem; padding: .42rem .65rem; }
.sb-sub .sb-link.active { background: rgba(79, 70, 229, .22); color: #fff; box-shadow: none; }
.sb-soon { margin-left: auto; font-size: .6rem; font-weight: 700; padding: .12rem .4rem; border-radius: 4px; background: rgba(251, 191, 36, .15); color: #fbbf24; text-transform: uppercase; }
.sb-foot { padding: .85rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .72rem; color: #64748b; }

/* Topbar */
.app-topbar { height: var(--topbar-h); background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); position: sticky; top: 0; z-index: 1020; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }
.role-badge { font-size: .65rem; letter-spacing: .05em; text-transform: uppercase; }

/* Content */
.app-content { padding: 1.5rem; max-width: 1600px; margin: 0 auto; }
@media (max-width: 575.98px) { .app-content { padding: 1rem .75rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--bs-secondary-color); font-size: .85rem; margin: .15rem 0 0; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--bs-secondary-color); font-size: .75rem; margin-bottom: .35rem; }
.breadcrumb a { text-decoration: none; }

.card { border-color: var(--bs-border-color); box-shadow: var(--card-shadow); }
.card-header { background: transparent; font-weight: 600; }

/* Stat cards */
.stat-card .icon-box { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.stat-card .value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-card .label { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--bs-secondary-color); }
.quick-link { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--bs-border-color); border-radius: .6rem; color: var(--bs-body-color); text-decoration: none; transition: border-color .15s, background .15s; }
.quick-link:hover { border-color: #818cf8; background: rgba(79, 70, 229, .04); color: var(--bs-body-color); }
.quick-link i { font-size: 1.2rem; color: #4f46e5; }

/* Tables */
.table > :not(caption) > * > * { padding: .75rem 1rem; vertical-align: middle; }
.table thead th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--bs-border-color); white-space: nowrap; }
.table-actions { white-space: nowrap; text-align: right; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }
.thumb-lg { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.truncate-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--bs-secondary-color); }
.empty-state i { font-size: 2.5rem; opacity: .5; display: block; margin-bottom: .5rem; }

/* DataTables (Bootstrap 5 integration) */
div.dt-wrap, .dataTables_wrapper { padding: 1rem 1rem .5rem; font-size: .82rem; }
.dataTables_wrapper .dataTables_filter input { margin-left: .5rem; width: 220px; display: inline-block; }
.dataTables_wrapper .dataTables_length select { width: auto; display: inline-block; margin: 0 .35rem; }
.dataTables_wrapper .dataTables_info { color: var(--bs-secondary-color); padding-top: .85rem !important; }
.dataTables_wrapper .pagination { margin-top: .6rem; }
.dataTables_wrapper .page-item.active .page-link { background: #4f46e5; border-color: #4f46e5; }
table.dataTable { margin: .75rem 0 !important; border-collapse: collapse !important; }
table.dataTable thead th { border-bottom: 1px solid var(--bs-border-color) !important; }
table.dataTable.no-footer { border-bottom: 0; }

/* Image picker */
.picker-list { max-height: 240px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: .65rem; padding: .4rem .5rem; border-radius: .4rem; cursor: pointer; font-size: .82rem; }
.picker-item:hover, .picker-item.selected { background: rgba(79, 70, 229, .1); }
.picker-item img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bs-border-color); }

/* Misc */
.page-loader { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
.page-loader.active { display: flex; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.progress.slim { height: 6px; }
.swal2-popup { font-family: var(--bs-font-sans-serif); font-size: .9rem; }
@media print { .app-sidebar, .app-topbar { display: none !important; } .app-main { margin: 0; } }
