/* What's new — the announcement card, the header button's dot and the list.
 * Behaviour: public/js/shared/whats-new.js. The tour itself reuses the
 * walkthrough spotlight (#fkWalkSpot / #fkWalkCard in index.html). */

/* The gold is the walkthrough spotlight's (#fkWalkSpot), so the card, the
   button and the tour read as one thing. Not in tokens.css: nothing else
   in the app uses it. */
.wn-card, #whatsNewBtn {
    --wn-gold: #FFD24A;
    --wn-mint: #3FAE7A;
}

/* Card: bottom-right on desktop, never blocking the dashboard. Below the
   launchers and modals (9200+) so anything the user opens covers it.
   Its border is a green/gold gradient that turns, so it reads as new at a
   glance: the surface fills the padding box, the gradient shows through
   the transparent border. */
@property --wn-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.wn-card {
    position: fixed; right: 20px; bottom: 20px; z-index: 9100;
    width: min(340px, calc(100vw - 32px));
    color: var(--ras-text);
    border: 3px solid transparent; border-radius: var(--ras-radius);
    background:
        linear-gradient(var(--ras-surface), var(--ras-surface)) padding-box,
        conic-gradient(from var(--wn-angle), var(--ras-green), var(--wn-gold), var(--wn-mint), var(--wn-gold), var(--ras-green)) border-box;
    box-shadow: var(--ras-shadow-modal), 0 0 16px 2px rgba(255, 210, 74, 0.45);
    padding: var(--ras-space-4) var(--ras-space-4) var(--ras-space-3);
    font-family: var(--ras-font);
    animation: wn-in .22s ease-out, wn-spin 3s linear infinite;
}
@keyframes wn-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes wn-spin { to { --wn-angle: 360deg; } }

.wn-eyebrow {
    font-size: var(--ras-fs-micro); font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--ras-green);
}
.wn-more { color: var(--ras-muted); font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.wn-title { font-size: var(--ras-fs-lg); font-weight: 700; color: var(--ras-green-deep); margin: 4px 0 4px; }
.wn-text { font-size: var(--ras-fs-base); line-height: 1.5; color: var(--ras-text); }
.wn-actions { display: flex; gap: var(--ras-space-2); margin-top: var(--ras-space-3); flex-wrap: wrap; }

/* Phones: a bottom sheet across the full width, Show me big enough for a
   thumb, the other two side by side under it. */
@media (max-width: 768px) {
    .wn-card {
        left: 0; right: 0; bottom: 0; width: auto;
        border-radius: 14px 14px 0 0; border-bottom: none;
        padding: 10px var(--ras-space-4) calc(var(--ras-space-4) + env(safe-area-inset-bottom, 0px));
        animation: wn-up .22s ease-out, wn-spin 3s linear infinite;
    }
    .wn-card::before {
        content: ''; display: block; width: 36px; height: 4px; border-radius: 2px;
        background: var(--ras-line-strong); margin: 0 auto 10px;
    }
    .wn-actions .wn-show { flex: 1 1 100%; min-height: var(--ras-control-h-touch); }
    .wn-actions .ras-btn:not(.wn-show) { flex: 1 1 0; min-height: var(--ras-control-h-touch); }
}
@keyframes wn-up { from { transform: translateY(100%); } to { transform: none; } }

/* Header button: filled green with a gold edge so it never reads as one
   more outline button next to Logout. While something unseen is waiting,
   a gold dot that pings. */
#whatsNewBtn {
    position: relative;
    background: var(--ras-green); color: var(--ras-on-dark);
    border-color: var(--wn-gold); font-weight: 600;
}
#whatsNewBtn:hover { background: var(--ras-green-hover); color: var(--ras-on-dark); }
#whatsNewBtn.wn-has-new::before,
#whatsNewBtn.wn-has-new::after {
    content: ''; position: absolute; top: -4px; right: -4px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--wn-gold);
}
#whatsNewBtn.wn-has-new::after { box-shadow: 0 0 0 2px var(--ras-surface); }
#whatsNewBtn.wn-has-new::before { animation: wn-ping 1.4s ease-out infinite; }
@keyframes wn-ping { from { transform: scale(1); opacity: .8; } to { transform: scale(2.6); opacity: 0; } }

/* Reduce motion (an OS setting): keep the colours, drop the movement. */
@media (prefers-reduced-motion: reduce) {
    .wn-card { animation: none; }
    #whatsNewBtn.wn-has-new::before { animation: none; display: none; }
}
body.fk-kiosk #whatsNewBtn { display: none !important; }
/* Phones: the header row holds the user badge, this and Logout, and the
   full label pushed them past the width. "✨ New" there. */
#whatsNewBtn .wn-label-short { display: none; }
@media (max-width: 768px) {
    #whatsNewBtn .wn-label-long { display: none; }
    #whatsNewBtn .wn-label-short { display: inline; }
}

/* List of every announcement, from the header button. */
.wn-list {
    position: fixed; inset: 0; z-index: 9400; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.wn-list-panel {
    background: var(--ras-surface); border-radius: var(--ras-radius);
    width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: var(--ras-shadow-modal); font-family: var(--ras-font); overflow: hidden;
}
.wn-list-head {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--ras-green); color: var(--ras-on-dark);
    padding: var(--ras-space-3) var(--ras-space-4); font-weight: 700; font-size: var(--ras-fs-md);
}
.wn-x { background: none; border: none; color: var(--ras-on-dark); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.wn-list-body { overflow-y: auto; padding: var(--ras-space-2) var(--ras-space-4) var(--ras-space-4); }
.wn-row {
    display: flex; gap: var(--ras-space-3); align-items: center;
    padding: var(--ras-space-3) 0; border-bottom: 1px solid var(--ras-line-soft);
}
.wn-row:last-child { border-bottom: none; }
.wn-row-main { flex: 1; min-width: 0; }
.wn-row-meta { font-size: var(--ras-fs-xs); color: var(--ras-muted); }
.wn-new { color: var(--ras-danger); font-weight: 700; }
.wn-draft { color: var(--ras-warn-strong); font-weight: 700; }
@media (max-width: 768px) {
    .wn-list { align-items: flex-end; padding: 0; }
    .wn-list-panel { border-radius: 14px 14px 0 0; max-height: 85vh; }
    .wn-row { flex-direction: column; align-items: stretch; }
}
