/* ==========================================================================
   Mardan Law College — admin panel
   ========================================================================== */

:root {
  --adm-navy: #0c2340;
  --adm-navy-700: #14335a;
  --adm-blue: #2e86c1;
  --adm-blue-100: #e8f2fa;
  --adm-gold: #c8a344;
  --adm-ink: #16202e;
  --adm-body: #55637a;
  --adm-muted: #8593a6;
  --adm-line: #e4e9f0;
  --adm-surface: #f4f6fa;
  --adm-sidebar: 268px;

  --adm-sans: "Inter Variable", "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --adm-serif: "Source Serif 4 Variable", "Source Serif Pro", Georgia, serif;
  --adm-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --bs-primary: #14335a;
  --bs-primary-rgb: 20, 51, 90;
  --bs-body-color: #55637a;
  --bs-border-color: #e4e9f0;
  --bs-body-font-family: var(--adm-sans);
  --bs-font-monospace: var(--adm-mono);
}

body.admin-body {
  background: var(--adm-surface);
  font-family: var(--adm-sans);
  color: var(--adm-body);
  font-size: .938rem;
  line-height: 1.6;
  letter-spacing: -.004em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

.admin-body h1, .admin-body h2, .admin-body h3, .admin-body h4, .admin-body h5, .admin-body h6 {
  color: var(--adm-navy);
  font-weight: 620;
  letter-spacing: -.016em;
  line-height: 1.28;
}

/* Figures line up column-to-column in listings and stat cards. */
.admin-body table, .admin-body .value, .admin-body time, .admin-body code {
  font-variant-numeric: tabular-nums;
}
.admin-body code { font-family: var(--adm-mono); font-size: .845em; letter-spacing: -.01em; }

.admin-body a { text-decoration: none; }
.admin-body :focus-visible { outline: 3px solid var(--adm-blue); outline-offset: 2px; border-radius: 4px; }

/* ----------------------------------------------------------------- login */

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;
  background:
    radial-gradient(circle at 15% 15%, rgba(46, 134, 193, .28), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(200, 163, 68, .22), transparent 45%),
    var(--adm-navy);
}

/* Form and developer panel sit side by side from large screens up, matched in
   width and height, so the support details are visible without scrolling. */
.admin-login-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 440px));
  align-items: stretch;
  justify-content: center;
  gap: 1.75rem;
  width: 100%;
  max-width: 920px;
}
@media (max-width: 991.98px) {
  .admin-login-shell {
    grid-template-columns: minmax(0, 440px);
    gap: 1.25rem;
  }
}

.admin-login-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
  border-radius: 18px;
  padding: 2.6rem 2.4rem;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
}
.admin-login-card .login-logo { height: 82px; width: auto; }

/* ------------------------------------------------- developer support panel */

.support-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  padding: 2.6rem 2.4rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .22);
  color: rgba(255, 255, 255, .7);
}
.support-head {
  display: flex; align-items: center; gap: 1rem;
  padding-bottom: 1.15rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.support-mark {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.45rem;
  background: linear-gradient(140deg, var(--adm-blue), var(--adm-gold));
  color: #fff; box-shadow: 0 8px 22px rgba(46, 134, 193, .3);
}
.support-card h2 {
  color: #fff; font-family: var(--adm-serif); font-size: 1.32rem;
  font-weight: 640; letter-spacing: -.02em; margin: 0; line-height: 1.15;
}
.support-role {
  display: block; font-size: .694rem; font-weight: 570; letter-spacing: .1em;
  text-transform: uppercase; color: var(--adm-gold); margin-top: .28rem;
}
.support-text { font-size: .885rem; line-height: 1.68; margin: 0 0 1.25rem; }
.support-text strong { color: #fff; font-weight: 600; }

.support-services { list-style: none; padding: 0; margin: 0 0 1.35rem; display: grid; gap: .58rem; }
.support-services li { display: flex; align-items: center; gap: .7rem; font-size: .858rem; }
.support-services .bi { color: var(--adm-blue); font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }

.support-divider {
  display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem;
  font-size: .688rem; font-weight: 570; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255, 255, 255, .45);
}
.support-divider::before, .support-divider::after {
  content: ""; flex: 1 1 auto; height: 1px; background: rgba(255, 255, 255, .12);
}

.support-contacts { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.support-contacts li {
  display: flex; align-items: center; gap: .8rem; font-size: .9rem;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px; padding: .65rem .85rem;
  transition: background .16s ease, border-color .16s ease;
}
.support-contacts li:hover { background: rgba(255, 255, 255, .09); border-color: rgba(200, 163, 68, .35); }
.support-contacts .bi { color: var(--adm-gold); font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.support-contacts a { color: rgba(255, 255, 255, .85); transition: color .16s ease; }
.support-contacts a:hover { color: var(--adm-gold); }

/* --------------------------------------------------------------- sidebar */

.admin-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--adm-sidebar); z-index: 1040;
  background: var(--adm-navy); color: rgba(255, 255, 255, .72);
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .25s ease;
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

.admin-brand {
  display: flex; align-items: center; gap: .75rem; padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1); flex-shrink: 0;
}
.admin-brand img { height: 42px; width: auto; background: #fff; border-radius: 8px; padding: 3px; }
.admin-brand .name { color: #fff; font-family: var(--adm-serif); font-weight: 640; font-size: 1.02rem; line-height: 1.2; letter-spacing: -.018em; }
.admin-brand .role { display: block; font-size: .672rem; font-weight: 560; letter-spacing: .1em; text-transform: uppercase; color: var(--adm-gold); margin-top: .15rem; }

.admin-nav { padding: 1rem .75rem 2rem; flex: 1 1 auto; }
.admin-nav .nav-heading {
  font-size: .655rem; letter-spacing: .145em; text-transform: uppercase;
  color: rgba(255, 255, 255, .38); padding: 1.1rem .75rem .45rem; font-weight: 620;
}
.admin-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border-radius: 9px; color: rgba(255, 255, 255, .74); font-weight: 520;
  font-size: .895rem; letter-spacing: -.008em;
  margin-bottom: .12rem; transition: background .15s ease, color .15s ease;
}
.admin-nav a.active { font-weight: 570; }
.admin-nav a .bi { font-size: 1.02rem; width: 20px; text-align: center; flex-shrink: 0; }
.admin-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-nav a.active { background: var(--adm-blue); color: #fff; box-shadow: 0 6px 18px rgba(46, 134, 193, .35); }
.admin-nav a .badge { margin-left: auto; }

/* ----------------------------------------------------------------- shell */

.admin-main { margin-left: var(--adm-sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.admin-topbar {
  background: #fff; border-bottom: 1px solid var(--adm-line);
  padding: .8rem 1.5rem; display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 1020;
}
.admin-topbar .page-title { font-size: 1.12rem; margin: 0; }
.admin-content { padding: 1.75rem 1.5rem 3rem; flex: 1 1 auto; }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(12, 35, 64, .5); z-index: 1035; display: none;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.show { transform: none; }
  .admin-main { margin-left: 0; }
}

/* ----------------------------------------------------------------- cards */

.adm-card {
  background: #fff; border: 1px solid var(--adm-line); border-radius: 13px;
  box-shadow: 0 1px 2px rgba(12, 35, 64, .04);
}
.adm-card > .adm-card-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--adm-line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.adm-card > .adm-card-head h2 { font-size: 1rem; margin: 0; }
.adm-card > .adm-card-body { padding: 1.25rem; }

.stat-card {
  background: #fff; border: 1px solid var(--adm-line); border-radius: 13px; padding: 1.15rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; height: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(12, 35, 64, .1); }
.stat-card .icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-card .value {
  font-family: var(--adm-serif); font-size: 1.68rem; font-weight: 640;
  color: var(--adm-navy); line-height: 1; letter-spacing: -.022em;
}
.stat-card .label { font-size: .715rem; color: var(--adm-muted); text-transform: uppercase; letter-spacing: .095em; font-weight: 580; margin-top: .35rem; }

/* ---------------------------------------------------------------- tables */

.adm-table { margin: 0; font-size: .9rem; }
.adm-table thead th {
  background: var(--adm-surface); color: var(--adm-navy); font-weight: 620;
  font-size: .705rem; letter-spacing: .09em; text-transform: uppercase;
  padding: .8rem 1rem; border-bottom: 1px solid var(--adm-line); white-space: nowrap;
}
.adm-table tbody td { padding: .8rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--adm-line); }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover { background: #fbfcfe; }
.adm-table .thumb { width: 62px; height: 46px; object-fit: cover; border-radius: 7px; background: var(--adm-surface); }
.adm-table .row-title { font-weight: 560; color: var(--adm-navy); letter-spacing: -.009em; }
.adm-table .row-sub { font-size: .812rem; color: var(--adm-muted); line-height: 1.5; }

.table-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* ----------------------------------------------------------------- forms */

.admin-body .form-control, .admin-body .form-select {
  border-radius: 9px; border-color: var(--adm-line); padding: .6rem .85rem; font-size: .92rem;
}
.admin-body .form-control:focus, .admin-body .form-select:focus {
  border-color: var(--adm-blue); box-shadow: 0 0 0 .2rem rgba(46, 134, 193, .16);
}
.admin-body .form-label { font-weight: 570; color: var(--adm-navy); font-size: .855rem; letter-spacing: -.008em; margin-bottom: .35rem; }
.admin-body .form-text { font-size: .812rem; line-height: 1.5; color: var(--adm-muted); }
.admin-body .form-check-input:checked { background-color: var(--adm-blue); border-color: var(--adm-blue); }

.image-field { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.image-field .preview {
  width: 132px; height: 100px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--adm-line); background: var(--adm-surface); flex-shrink: 0;
}
.image-field .controls { flex: 1 1 220px; min-width: 220px; }

.editor-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem; background: var(--adm-surface); border: 1px solid var(--adm-line); border-bottom: 0; border-radius: 9px 9px 0 0; }
.editor-toolbar button { border: 1px solid var(--adm-line); background: #fff; border-radius: 6px; padding: .25rem .55rem; font-size: .8rem; color: var(--adm-navy); font-weight: 600; }
.editor-toolbar button:hover { background: var(--adm-blue-100); }
.editor-area { border-radius: 0 0 9px 9px !important; font-family: ui-monospace, Consolas, monospace; font-size: .86rem; line-height: 1.6; }

.seo-preview { background: #fff; border: 1px solid var(--adm-line); border-radius: 9px; padding: 1rem; }
.seo-preview .sp-title { color: #1a0dab; font-size: 1.04rem; line-height: 1.3; }
.seo-preview .sp-url { color: #006621; font-size: .82rem; }
.seo-preview .sp-desc { color: #545454; font-size: .86rem; margin: .25rem 0 0; }

.char-counter { font-size: .76rem; color: var(--adm-muted); }
.char-counter.over { color: #b02a37; font-weight: 700; }

/* ---------------------------------------------------------------- badges */

.badge-soft-success { background: #e3f6ea; color: #17663a; }
.badge-soft-secondary { background: #eceff3; color: #5b6b7f; }
.badge-soft-warning { background: #fdf3e0; color: #9a6a12; }
.badge-soft-info { background: var(--adm-blue-100); color: #1c5c85; }

.repeater-row { border: 1px solid var(--adm-line); border-radius: 10px; padding: 1rem; margin-bottom: .75rem; background: #fff; }

.empty-row { text-align: center; padding: 3rem 1rem; color: var(--adm-muted); }
.empty-row .bi { font-size: 2.6rem; color: var(--adm-line); display: block; margin-bottom: .75rem; }

/* ==========================================================================
   Admission applications
   ========================================================================== */

.badge-soft-danger { background: #fdeaea; color: #a32020; }

.applicant-avatar {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--adm-navy), var(--adm-blue));
  color: #fff; font-weight: 620; font-size: .78rem; letter-spacing: .02em;
}
.applicant-avatar.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.2rem; }

/* Submissions bar chart */
.trend-chart {
  display: flex; align-items: flex-end; gap: .45rem;
  height: 150px; padding-top: 1.25rem;
}
.trend-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bar {
  width: 100%; max-width: 34px; margin-top: auto; position: relative;
  background: linear-gradient(180deg, var(--adm-blue), var(--adm-navy));
  border-radius: 5px 5px 0 0; min-height: 2px;
  transition: filter .16s ease;
}
.trend-col:hover .trend-bar { filter: brightness(1.15); }
.trend-value {
  position: absolute; top: -1.15rem; left: 50%; transform: translateX(-50%);
  font-size: .72rem; font-weight: 620; color: var(--adm-navy);
}
.trend-day { margin-top: .4rem; font-size: .68rem; color: var(--adm-muted); font-variant-numeric: tabular-nums; }

/* Status breakdown bars */
.breakdown-row { margin-bottom: .8rem; }
.breakdown-row:last-of-type { margin-bottom: 0; }
.bd-label { font-size: .84rem; font-weight: 560; color: var(--adm-navy); }
.bd-count { font-size: .82rem; font-weight: 620; color: var(--adm-navy); font-variant-numeric: tabular-nums; }
.bd-track { height: 7px; border-radius: 4px; background: var(--adm-surface); overflow: hidden; }
.bd-fill { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }

/* Detail grid on the review screen */
.detail-item {
  background: var(--adm-surface); border: 1px solid var(--adm-line);
  border-radius: 9px; padding: .65rem .85rem; height: 100%;
}
.di-label {
  display: block; font-size: .66rem; font-weight: 620; letter-spacing: .09em;
  text-transform: uppercase; color: var(--adm-muted);
}
.di-value { display: block; margin-top: .15rem; font-weight: 560; color: var(--adm-navy); font-size: .9rem; word-break: break-word; }

/* Documents */
.doc-row {
  display: flex; align-items: center; gap: .7rem;
  border: 1px solid var(--adm-line); border-radius: 9px;
  padding: .65rem .85rem; font-size: .875rem; font-weight: 540; color: var(--adm-navy);
}
.doc-row .bi { color: var(--adm-blue); font-size: 1.05rem; }
.doc-row.is-missing { opacity: .6; }
.doc-row.is-missing .bi { color: var(--adm-muted); }

/* Status picker */
.status-picker { display: grid; gap: .4rem; }
.status-option { margin: 0; cursor: pointer; }
.status-option input { position: absolute; opacity: 0; pointer-events: none; }
.status-option span {
  display: block; padding: .55rem .85rem; border-radius: 8px; font-size: .875rem; font-weight: 560;
  border: 2px solid var(--adm-line); color: var(--adm-body);
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.status-option:hover span { border-color: var(--sc); }
.status-option input:checked + span {
  border-color: var(--sc); background: color-mix(in srgb, var(--sc) 12%, transparent);
  color: var(--sc); font-weight: 620;
}
.status-option input:focus-visible + span { outline: 3px solid var(--adm-blue); outline-offset: 2px; }

@media print {
  .admin-sidebar, .admin-topbar, .table-actions, .status-picker,
  .adm-card-head .badge, form { display: none !important; }
  .admin-main { margin-left: 0; }
  .adm-card { border: 1px solid #ccc; break-inside: avoid; }
}

/* ==========================================================================
   Filter toolbar
   ========================================================================== */

.filter-bar-wrap {
  padding: .8rem 1.25rem;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-line);
}
.filter-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap;
}
.fb-search { position: relative; flex: 1 1 auto; min-width: 0; }
.fb-search .bi {
  position: absolute; left: .72rem; top: 50%; transform: translateY(-50%);
  color: var(--adm-muted); font-size: .85rem; pointer-events: none;
}
.fb-search .form-control { padding-left: 2.05rem; }
.fb-select { flex: 0 0 auto; width: auto; min-width: 148px; }
.fb-action { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 991.98px) {
  .filter-bar { flex-wrap: wrap; }
  .fb-search { flex: 1 1 100%; }
  .fb-select { flex: 1 1 auto; min-width: 130px; }
}

/* ==========================================================================
   Overflow containment — long names, emails, CNICs and file names must wrap
   inside their card rather than spilling past the border.
   ========================================================================== */

.adm-card, .adm-card-head, .adm-card-body { min-width: 0; }
.adm-card-head h2 { min-width: 0; overflow-wrap: anywhere; }

/* Flex children default to min-width:auto, which refuses to shrink. */
.adm-card .d-flex > *, .stat-card > *, .doc-row > *, .detail-item > * { min-width: 0; }

.adm-table td, .adm-table th { overflow-wrap: anywhere; }
.adm-table .row-title, .adm-table .row-sub { overflow-wrap: anywhere; }

.stat-card { min-width: 0; }
.stat-card .value, .stat-card .label { overflow-wrap: anywhere; }

.detail-item { overflow: hidden; }
.di-value { overflow-wrap: anywhere; }

.doc-row { min-width: 0; }
.doc-row span { overflow-wrap: anywhere; }

.breakdown-row, .bd-label { min-width: 0; overflow-wrap: anywhere; }

.trend-chart { overflow-x: auto; }

.support-contacts a, .support-text { overflow-wrap: anywhere; }

.admin-body pre, .admin-body code { overflow-wrap: anywhere; white-space: pre-wrap; }
