/* =====================================================================
   The Order of the Lamp — Admin Dashboard
   Redesigned: polished, smooth, fully responsive.
   ===================================================================== */
:root {
    --navy: #0A1958; --navy-deep: #060f3a; --navy-2: #16307f;
    --gold: #D4C17F; --gold-deep: #b89b52; --baby-blue: #89CFF0;
    --ink: #1b2233; --muted: #687087; --cloud: #f3f5fb; --cloud-2: #e9eef8;
    --line: #e4e9f3; --white: #fff;
    --ok: #157347; --ok-bg: #e7f6ec; --ok-bd: #b6e0c4;
    --err: #b3261e; --err-bg: #fdeceb; --err-bd: #f3c2bd;
    --font-head: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 1px 2px rgba(10,25,88,.06), 0 2px 8px rgba(10,25,88,.05);
    --shadow: 0 10px 30px rgba(10,25,88,.09);
    --shadow-lg: 0 24px 60px rgba(10,25,88,.18);
    --r: 16px; --r-sm: 11px;
    --sidebar-w: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); background: var(--cloud); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); }
svg { width: 20px; height: 20px; flex: none; }
img { max-width: 100%; }

/* ---------------- Layout ---------------- */
.admin { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
    background: linear-gradient(185deg, var(--navy) 0%, var(--navy-deep) 100%);
    color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; z-index: 60;
}
.sidebar__brand { display: flex; align-items: center; gap: .65rem; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; text-decoration: none; color: #fff; }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: 38px; height: 38px; }
.sidebar__brand b { font-family: var(--font-head); font-size: .98rem; line-height: 1.05; display: block; }
.sidebar__brand .tag { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-top: 3px; }
.sidebar nav { display: grid; gap: 2px; align-content: start; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; color: rgba(255,255,255,.8); padding: .62rem .8rem; border-radius: 10px; font-weight: 500; font-size: .93rem; text-decoration: none; transition: background .15s ease, color .15s ease, transform .15s ease; }
.sidebar nav a svg { width: 18px; height: 18px; }
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.sidebar nav a.is-active { background: linear-gradient(100deg, var(--gold), #e7d9a6); color: var(--navy); font-weight: 700; box-shadow: 0 6px 16px rgba(212,193,127,.3); }
.sidebar__foot { padding-top: 12px; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.12); display: grid; gap: 2px; }
.sidebar__foot a { color: rgba(255,255,255,.72); display: flex; align-items: center; gap: .55rem; padding: .55rem .8rem; border-radius: 10px; text-decoration: none; font-size: .88rem; }
.sidebar__foot a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }

/* App bar (mobile only) */
.appbar {
    display: none; position: sticky; top: 0; z-index: 50;
    align-items: center; gap: 12px; padding: 12px 16px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.appbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; }
.icon-btn:hover { background: var(--cloud-2); }

.scrim { position: fixed; inset: 0; background: rgba(6,15,58,.5); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 55; }

.main { padding: 30px 36px 80px; max-width: 1040px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { margin: 0; font-size: 1.85rem; }
.topbar .view-site { font-size: .88rem; font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.topbar .view-site:hover { background: var(--cloud-2); text-decoration: none; }

.lead { color: var(--muted); margin: -10px 0 22px; max-width: 640px; }

/* ---------------- Stats ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--cloud-2); color: var(--navy); margin-bottom: 10px; }
.stat .n { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat .l { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.stat a { font-size: .8rem; font-weight: 600; display: inline-block; margin-top: 8px; }

/* ---------------- Panels ---------------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.panel > h2 { margin: 0 0 4px; font-size: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.panel .count { color: var(--muted); font-weight: 400; font-size: .85rem; }
.panel .hint { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head .hint { margin: 4px 0 0; }

/* Contextual preview card */
.preview {
    display: flex; gap: 16px; align-items: center; padding: 12px;
    background: linear-gradient(180deg, var(--cloud), #fff); border: 1px solid var(--line);
    border-radius: 14px; margin-bottom: 20px;
}
.preview img { width: 200px; height: 137px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--line); flex: none; box-shadow: var(--shadow-sm); }
.preview__body { min-width: 0; }
.preview__tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-deep); background: #fbf6e6; border: 1px solid #efe3bd; padding: .2rem .55rem; border-radius: 999px; }
.preview__body h3 { margin: 8px 0 4px; font-size: 1.05rem; }
.preview__body p { margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.preview__body .link { font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }

/* ---------------- Forms ---------------- */
.frm { display: grid; gap: 16px; }
.frm.cols2 { grid-template-columns: 1fr 1fr; }
.frm .full { grid-column: 1 / -1; }
.field label, label.lbl { font-weight: 600; font-size: .88rem; color: var(--navy); display: block; margin-bottom: .35rem; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
    width: 100%; font-family: var(--font-body); font-size: .96rem; padding: .65rem .8rem; border: 1.5px solid var(--line);
    border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--baby-blue); box-shadow: 0 0 0 4px rgba(137,207,240,.25); }
.help { color: var(--muted); font-size: .8rem; margin-top: .35rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-family: var(--font-body); font-weight: 600; font-size: .92rem;
    padding: .62rem 1.15rem; border-radius: 10px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); box-shadow: 0 10px 22px rgba(10,25,88,.25); }
.btn-gold { background: linear-gradient(100deg, var(--gold), #e3d3a0); color: var(--navy); }
.btn-gold:hover { box-shadow: 0 10px 22px rgba(212,193,127,.4); }
.btn-light { background: var(--cloud-2); color: var(--navy); }
.btn-light:hover { background: #dde5f4; }
.btn-danger { background: #fff; color: var(--err); border-color: #f0c4c0; }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { padding: .42rem .8rem; font-size: .83rem; }
.btn-block { width: 100%; }

/* Sticky save bar */
.savebar { position: sticky; bottom: 16px; z-index: 20; margin-top: 8px; display: flex; justify-content: flex-end; }
.savebar .btn { box-shadow: var(--shadow); }

/* ---------------- Item rows / cards ---------------- */
.item { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; background: var(--cloud-2); display: grid; place-items: center; color: var(--navy); overflow: hidden; }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .meta { flex: 1; min-width: 0; }
.item .meta b { color: var(--navy); }
.item .meta small { color: var(--muted); display: block; }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.avatar-mini { width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; overflow: hidden; border: 2px solid var(--gold); flex: none; }
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

.grid-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gcard { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.gcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.gcard .media { aspect-ratio: 16/10; background: #0b1020; display: grid; place-items: center; color: #fff; }
.gcard .media img { width: 100%; height: 100%; object-fit: cover; }
.gcard .media iframe { width: 100%; height: 100%; border: 0; }
.gcard .cap { padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.gcard .cap span { font-size: .86rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Portrait gallery (graduates) */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--cloud-2); aspect-ratio: 4/5; box-shadow: var(--shadow-sm); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tile__no { position: absolute; top: 6px; left: 6px; background: rgba(6,15,58,.78); color: #fff; font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.tile__del { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(255,255,255,.92); color: var(--err); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s ease; }
.tile:hover .tile__del, .tile:focus-within .tile__del { opacity: 1; }
.tile__del svg { width: 16px; height: 16px; }
.tile__cap { position: absolute; inset: auto 0 0 0; background: linear-gradient(0deg, rgba(6,15,58,.85), transparent); color: #fff; font-size: .72rem; padding: 18px 8px 6px; }

/* Alerts (toast-like) */
.alert { border-radius: 12px; padding: 13px 16px; margin-bottom: 20px; font-weight: 500; display: flex; align-items: center; gap: .6rem; box-shadow: var(--shadow-sm); animation: aSlideDown .35s ease; }
.alert svg { width: 20px; }
.alert-success { background: var(--ok-bg); border: 1px solid var(--ok-bd); color: #14532d; }
.alert-error { background: var(--err-bg); border: 1px solid var(--err-bd); color: #7f1d1d; }
.alert-info { background: #eef5fd; border: 1px solid #c7defa; color: #14306e; }
@keyframes aSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Accordion editors */
details.editor { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
details.editor > summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--navy); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
details.editor > summary::-webkit-details-marker { display: none; }
details.editor > summary:hover { background: var(--cloud); }
details.editor[open] > summary { border-bottom: 1px solid var(--line); }
details.editor .body { padding: 18px; }
.summary-edit { color: var(--muted); font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }

.section-title { font-family: var(--font-head); color: var(--navy); font-size: 1.05rem; border-left: 4px solid var(--gold); padding-left: 10px; margin: 28px 0 12px; }
.muted-msg { color: var(--muted); padding: 14px; text-align: center; background: var(--cloud); border-radius: 12px; border: 1px dashed var(--line); }

/* ---------------- Uploader (drag & drop) ---------------- */
.uploader { display: block; position: relative; border: 2px dashed #c8d3ea; border-radius: 14px; background: var(--cloud); padding: 22px; text-align: center; transition: border-color .15s ease, background .15s ease; cursor: pointer; overflow: hidden; }
.uploader:hover, .uploader.is-drag { border-color: var(--baby-blue); background: #eef7fe; }
.uploader input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.uploader__ic { width: 46px; height: 46px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; color: var(--navy); margin: 0 auto 10px; }
.uploader__t { font-weight: 600; color: var(--navy); font-size: .95rem; }
.uploader__t b { color: var(--navy-2); }
.uploader__s { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.uploader__preview { display: none; margin-top: 14px; align-items: center; gap: 12px; justify-content: center; }
.uploader.has-file .uploader__preview { display: flex; }
.uploader.has-file .uploader__prompt { display: none; }
.uploader__preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.uploader__preview .name { font-size: .85rem; color: var(--ink); font-weight: 600; word-break: break-all; text-align: left; }

/* Bare file inputs (officer photo, flyer, video poster) — on-brand, no raw OS look */
input[type=file]:not(.uploader input) {
    display: block; width: 100%; font: inherit; font-size: .9rem; color: var(--muted);
    background: var(--cloud); border: 1.5px dashed var(--line); border-radius: var(--r-sm);
    padding: 9px 12px; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
input[type=file]:not(.uploader input):hover { border-color: var(--baby-blue); background: #eef7fe; }
input[type=file]:not(.uploader input)::file-selector-button {
    font: inherit; font-weight: 600; font-size: .85rem; margin: 0 12px 0 0; padding: 8px 16px;
    border: 0; border-radius: 8px; background: var(--navy); color: #fff; cursor: pointer;
    transition: background .15s ease;
}
input[type=file]:not(.uploader input):hover::file-selector-button { background: var(--navy-2); }
/* WebKit fallback for older engines */
input[type=file]:not(.uploader input)::-webkit-file-upload-button {
    font: inherit; font-weight: 600; font-size: .85rem; margin: 0 12px 0 0; padding: 8px 16px;
    border: 0; border-radius: 8px; background: var(--navy); color: #fff; cursor: pointer;
}

/* ---------------- Modal ---------------- */
dialog.a-modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, 94vw); box-shadow: var(--shadow-lg); background: #fff; color: var(--ink); overflow: visible; }
dialog.a-modal::backdrop { background: rgba(6,15,58,.55); backdrop-filter: blur(3px); }
dialog.a-modal[open] { animation: aPop .26s cubic-bezier(.2,.9,.3,1.2); }
@keyframes aPop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.a-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.a-modal__head h3 { margin: 0; font-size: 1.2rem; }
.a-modal__body { padding: 22px; max-height: 72vh; overflow: auto; }
.a-modal__foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--cloud); border-radius: 0 0 18px 18px; }
.modal-close { background: none; border: 0; color: var(--muted); cursor: pointer; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.modal-close:hover { background: var(--cloud-2); color: var(--navy); }

/* segmented control */
.seg { display: inline-flex; background: var(--cloud-2); border-radius: 11px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: .5rem .9rem; border-radius: 8px; font: inherit; font-weight: 600; font-size: .86rem; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.seg button.is-active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 50% -10%, rgba(137,207,240,.18), transparent), linear-gradient(160deg, var(--navy), var(--navy-deep)); padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 410px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card img { width: 60px; height: 60px; margin: 0 auto 14px; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: .9rem; margin: 0 0 24px; }
.login-card .frm { text-align: left; }
.login-card .btn { width: 100%; margin-top: 8px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 960px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .admin { grid-template-columns: 1fr; }
    .appbar { display: flex; }
    .sidebar {
        position: fixed; top: 0; left: 0; width: min(290px, 86vw); height: 100vh;
        transform: translateX(-105%); transition: transform .28s cubic-bezier(.4,0,.2,1);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .scrim { opacity: 1; visibility: visible; }
    .topbar { display: none; }            /* app bar replaces it on mobile */
    .main { padding: 20px 18px 70px; }
    .preview img { width: 130px; height: 90px; }
}
@media (max-width: 560px) {
    .frm.cols2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid-cards { grid-template-columns: 1fr; }
    .preview { flex-direction: column; align-items: flex-start; }
    .preview img { width: 100%; height: 150px; }
    .panel { padding: 18px; }
    .a-modal__body { padding: 18px; }
}
