/* Session timer indicator + warning modal.
 * Driven by /assets/js/session-timer.js, which only activates when the
 * bs-rt-exp cookie is present — on unauthenticated pages both #session-timer-*
 * elements stay hidden because the JS bails before showing them. */

/* ── Indicator stack ───────────────────────────────────────────────── */

/* Pills live inside the sidebar footer (above the user info block) so they
 * sit visually next to the logged-in user. Flowing layout — no position
 * fixed — they share the sidebar's bottom anchor via .menu-footer-stack. */
.session-timer-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 6px;
}

.session-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    background: #f4f6fa;
    border: 1px solid #c7d0dd;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

/* JWT pill: slightly slimmer, but NOT translucent — the user needs to read it. */
.jwt-timer {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    background: #f8fafc;
    border-color: #d4dbe5;
}

.jwt-timer .session-timer-icon {
    width: 11px;
    height: 11px;
}

/* JWT about to refresh: teal flash to confirm the keepalive is firing. */
.jwt-timer--soon {
    border-color: #14b8a6;
    background: #ccfbf1;
}

.jwt-timer--soon .session-timer-icon,
.jwt-timer--soon .session-timer-label,
.jwt-timer--soon .session-timer-time {
    color: #115e59;
}

.session-timer[hidden] {
    display: none !important;
}

.session-timer-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #475569;
}

.session-timer-label {
    color: #475569;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.session-timer-time {
    margin-left: auto;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.85rem;
}

/* Warn state: amber when ≤ 5 min remain. */
.session-timer--warn {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

.session-timer--warn .session-timer-icon,
.session-timer--warn .session-timer-label {
    color: #92400e;
}

.session-timer--warn .session-timer-time {
    color: #7c2d12;
}

/* Critical state: red, pulsing — last minute. */
.session-timer--critical {
    background: #fee2e2;
    border-color: #dc2626;
    color: #7f1d1d;
    animation: session-timer-pulse 1s infinite;
}

.session-timer--critical .session-timer-icon,
.session-timer--critical .session-timer-label {
    color: #991b1b;
}

.session-timer--critical .session-timer-time {
    color: #7f1d1d;
}

@keyframes session-timer-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Brief confirmation flash when activity-driven refresh succeeds and the
 * countdown silently jumps back to 4:00:00. Without this the user has no
 * feedback that their activity was registered. */
.session-timer--just-refreshed {
    animation: session-timer-flash 1.5s ease-out;
}

@keyframes session-timer-flash {
    0%   { background: #d1fae5; border-color: #10b981; }
    100% { background: #f4f6fa; border-color: #c7d0dd; }
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.session-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}

.session-modal[hidden] {
    display: none !important;
}

.session-modal-card {
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    padding: 1.5rem;
}

.session-modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #111;
}

.session-modal-body {
    margin: 0 0 1.25rem;
    color: #444;
    font-size: 0.92rem;
    line-height: 1.5;
}

.session-modal-countdown {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    margin: 0 0.15rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.session-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.session-modal-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font: inherit;
    cursor: pointer;
}

.session-modal-btn:hover {
    background: #f4f4f5;
}

.session-modal-btn--primary {
    background: var(--behnke-design, #004f8b);
    border-color: var(--behnke-design, #004f8b);
    color: #fff;
}

.session-modal-btn--primary:hover {
    background: var(--behnke-design-hover, #003e6f);
}
