/* =====================================================================
   StaffApplications — module styling
   Loaded on the module's frontend + Staff CP pages only.
   Tuned to sit inside the "Premium" template (dark, amber gradient),
   and degrades sensibly on DefaultRevamp / Default (light or dark).
   ===================================================================== */

:root {
    --sa-gold-1: #F5A623;
    --sa-gold-2: #F3B740;
    --sa-grad: linear-gradient(115deg, #F5A623, #F3B740);
    --sa-ok: #33d17a;
    --sa-info: #4cc9f0;
    --sa-bad: #ff5a5a;
    --sa-violet: #7c5cff;

    /* light-ish defaults (DefaultRevamp / Default, no dark) */
    --sa-surface: rgba(0, 0, 0, 0.02);
    --sa-surface-2: rgba(0, 0, 0, 0.04);
    --sa-border: rgba(0, 0, 0, 0.12);
    --sa-text: #1c2430;
    --sa-text-dim: #5a6472;
    --sa-muted: #8a93a2;
    --sa-radius: 14px;
    --sa-radius-s: 10px;
}

/* Dark: Premium frontend = body.ps, Premium panel = body.ps-panel,
   DefaultRevamp / Default dark mode = body.dark or html.dark */
body.ps,
body.ps-panel,
body.dark,
html.dark body {
    --sa-surface: rgba(255, 255, 255, 0.035);
    --sa-surface-2: rgba(255, 255, 255, 0.06);
    --sa-border: rgba(255, 255, 255, 0.10);
    --sa-text: #eef1f7;
    --sa-text-dim: #b7bdcc;
    --sa-muted: #7f8799;
}

/* ------------------------------------------------------------------ *
 *  Shared primitives
 * ------------------------------------------------------------------ */
.sa-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .55em;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--sa-gold-2);
}
.sa-eyebrow::before {
    content: "";
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--sa-grad);
}

.sa-hint { color: var(--sa-muted); font-size: .82rem; margin: .2rem 0 .5rem; }
.sa-req { color: #e0245e; font-weight: 700; }

/* status pill — used everywhere (frontend + panel).
   background + color come inline from StaffApps::statusBadge() */
.sa-status {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    padding: .34em .85em;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}
.sa-status::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .5;
}

/* ------------------------------------------------------------------ *
 *  Answers block
 * ------------------------------------------------------------------ */
.sa-answers { display: grid; gap: 1px; border: 1px solid var(--sa-border); border-radius: var(--sa-radius); overflow: hidden; }
.sa-answers__row { padding: .95rem 1.1rem; background: var(--sa-surface); }
.sa-answers__q {
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--sa-muted);
    margin-bottom: .3rem;
}
.sa-answers__a { color: var(--sa-text); line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }

/* ------------------------------------------------------------------ *
 *  Timeline — the important bit
 * ------------------------------------------------------------------ */
.sa-timeline { display: flex; flex-direction: column; gap: .8rem; }

.sa-msg {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: .8rem;
    padding: .85rem 1rem .85rem .85rem;
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
}
.sa-msg__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sa-surface-2);
    box-shadow: 0 0 0 1px var(--sa-border);
}
.sa-msg__avatar--ph {
    display: grid; place-items: center;
    font-size: .9rem; font-weight: 700;
    color: #0c0c0c;
    background: var(--sa-grad);
}
.sa-msg__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .25rem;
}
.sa-msg__author { font-weight: 600; color: var(--sa-text); }
.sa-msg__time { font-size: .75rem; color: var(--sa-muted); }
.sa-msg__body { color: var(--sa-text-dim); line-height: 1.6; word-wrap: break-word; }
.sa-msg__body p { margin: 0 0 .4rem; }
.sa-msg__body p:last-child { margin-bottom: 0; }

/* tag chips */
.sa-tag {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .22em .55em;
    border-radius: 999px;
    line-height: 1;
}
.sa-tag--internal { background: rgba(245, 166, 35, .18); color: var(--sa-gold-2); }
.sa-tag--team     { background: rgba(76, 201, 240, .18); color: #8fe1ff; }
.sa-tag--you      { background: rgba(124, 92, 255, .18); color: #b6a4ff; }

/* left accent per message type */
.sa-msg::before {
    content: "";
    position: absolute;
    left: 0; top: 10px; bottom: 10px;
    width: 3px;
    border-radius: 3px;
    background: var(--sa-border);
}
.sa-msg--team::before      { background: linear-gradient(var(--sa-info), #6ee0ff); }
.sa-msg--internal::before  { background: var(--sa-grad); }
.sa-msg--internal          { background: color-mix(in srgb, var(--sa-gold-1) 6%, var(--sa-surface)); }
.sa-msg--applicant::before { background: linear-gradient(var(--sa-violet), #b6a4ff); }

/* status change — compact, no avatar column */
.sa-msg--status {
    grid-template-columns: 1fr;
    padding: .6rem 1rem;
    background: transparent;
    border-style: dashed;
    align-items: center;
}
.sa-msg--status::before { display: none; }
.sa-msg--status .sa-msg__body { color: var(--sa-text); font-size: .9rem; }
.sa-msg--status .sa-status { margin-left: .35rem; }

/* ------------------------------------------------------------------ *
 *  Position cards (frontend list)
 * ------------------------------------------------------------------ */
.sa-positions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.sa-position {
    display: flex;
    flex-direction: column;
    padding: 1.3rem;
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), border-color .25s, box-shadow .3s;
}
.sa-position:hover {
    transform: translateY(-4px);
    border-color: rgba(245, 166, 35, .4);
    box-shadow: 0 18px 50px -20px rgba(245, 166, 35, .35);
}
.sa-position__icon {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    margin-bottom: .9rem;
    font-size: 1.1rem;
    color: #0c0c0c;
    background: var(--sa-grad);
}
.sa-position__name { font-size: 1.15rem; font-weight: 700; color: var(--sa-text); margin-bottom: .35rem; }
.sa-position__desc { color: var(--sa-text-dim); font-size: .9rem; line-height: 1.55; flex: 1; }
.sa-position__foot { margin-top: 1.1rem; }
.sa-position__closed { color: var(--sa-muted); font-size: .82rem; margin-top: .5rem; }

/* ------------------------------------------------------------------ *
 *  My applications table
 * ------------------------------------------------------------------ */
.sa-applist { width: 100%; border-collapse: collapse; }
.sa-applist th {
    text-align: left;
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sa-gold-2);
    padding: .6rem .5rem;
    border-bottom: 1px solid var(--sa-border);
}
.sa-applist td { padding: .8rem .5rem; border-bottom: 1px solid var(--sa-border); color: var(--sa-text-dim); }
.sa-applist tr:last-child td { border-bottom: none; }
.sa-applist a { color: var(--sa-text); font-weight: 600; }

/* ------------------------------------------------------------------ *
 *  Panel: compose boxes (internal note vs public reply)
 * ------------------------------------------------------------------ */
.sa-compose { border-radius: var(--sa-radius); overflow: hidden; border: 1px solid var(--sa-border); }
.sa-compose__head {
    padding: .7rem 1rem;
    font-weight: 600;
    font-size: .82rem;
    display: flex; align-items: center; gap: .5rem;
}
.sa-compose--internal .sa-compose__head { background: rgba(245, 166, 35, .14); color: var(--sa-gold-2); }
.sa-compose--public .sa-compose__head   { background: rgba(76, 201, 240, .14); color: #8fe1ff; }
.sa-compose__body { padding: 1rem; background: var(--sa-surface); }

/* ------------------------------------------------------------------ *
 *  Panel: side meta card
 * ------------------------------------------------------------------ */
.sa-meta { display: grid; gap: .9rem; }
.sa-meta__row { display: flex; justify-content: space-between; gap: 1rem; font-size: .86rem; }
.sa-meta__k { color: var(--sa-muted); }
.sa-meta__v { color: var(--sa-text); font-weight: 600; text-align: right; }

/* keep bootstrap muted text legible on dark */
body.ps .text-muted { color: var(--sa-muted) !important; }
