/* ============================================================
   CLSR Real-Time UI
   ============================================================ */

.clsr-rt-toasts {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
}

.clsr-rt-toast {
    background: #1A2C3E;
    color: #FFFFFF;
    border-left: 4px solid #B9F877;
    padding: 14px 18px;
    box-shadow: 0 12px 40px rgba(26, 44, 62, 0.35);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.4;
    animation: clsrRtIn 0.3s ease;
    pointer-events: auto;
}
.clsr-rt-toast strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 2px;
}
.clsr-rt-toast span {
    font-size: 12px;
    color: #C1E0EE;
    display: block;
}
.clsr-rt-toast.tone-warn { border-left-color: #F5C6A0; }
.clsr-rt-toast.tone-warn span { color: #F5C6A0; }
.clsr-rt-toast.tone-ok   { border-left-color: #B9F877; }
.clsr-rt-toast.tone-info { border-left-color: #C1E0EE; }
.clsr-rt-toast.leaving { animation: clsrRtOut 0.3s ease forwards; }

@keyframes clsrRtIn  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes clsrRtOut { to   { transform: translateX(120%); opacity: 0; } }

/* Connection badge */
.clsr-rt-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border: 1px solid #4A6A7A;
}
.clsr-rt-badge::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: #4A6A7A;
}
.clsr-rt-badge.on  { color: #1A2C3E; background: #B9F877; border-color: #B9F877; }
.clsr-rt-badge.on::before  { background: #1A2C3E; animation: clsrRtPulse 1.6s infinite; }
.clsr-rt-badge.off { color: #FFFFFF; background: #4A6A7A; border-color: #4A6A7A; }

@keyframes clsrRtPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.5); }
}

/* Reusable flash when a card updates */
.clsr-rt-flash {
    animation: clsrRtFlash 1.4s ease;
}
@keyframes clsrRtFlash {
    0%   { box-shadow: 0 0 0 0 rgba(185,248,119, 0.75); border-color: #B9F877 !important; }
    100% { box-shadow: 0 0 0 12px rgba(185,248,119, 0); border-color: rgba(74,106,122,0.24) !important; }
}

/* Tiny "live" marker that any page can drop in */
.clsr-live-dot {
    display: inline-block;
    width: 8px; height: 8px;
    margin-right: 6px;
    background: #B9F877;
    animation: clsrRtPulse 1.6s infinite;
}

@media (max-width: 640px) {
    .clsr-rt-toasts { left: 16px; right: 16px; bottom: 16px; max-width: 100%; }
}

/* ============================================================
   TOP LOADING PROGRESS BAR
   ============================================================ */

.clsr-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999999;
    pointer-events: none;
    background: transparent;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.clsr-progress.active {
    opacity: 1;
}

.clsr-progress .clsr-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #B9F877 0%, #92D66B 100%);
    box-shadow: 0 0 10px rgba(185, 248, 119, 0.7), 0 0 5px rgba(185, 248, 119, 0.5);
    transition: width 0.3s ease, opacity 0.4s ease;
}

/* Glowing dot at the right edge of the bar — NProgress-style */
.clsr-progress .clsr-progress-peg {
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    box-shadow:
        0 0 10px #B9F877,
        0 0 5px #B9F877,
        0 0 3px #B9F877;
    opacity: 1;
    transform: rotate(3deg) translate(0px, -2px);
}

/* When the bar reaches 100%, it fades and resets */
.clsr-progress.done .clsr-progress-bar {
    width: 100% !important;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.4s ease;
}

/* Admin panel — align with the navy top bar */
.admin-top-bar ~ .clsr-progress,
body.admin-bar .clsr-progress {
    top: 32px; /* WP admin bar height on desktop */
}
@media screen and (max-width: 782px) {
    body.admin-bar .clsr-progress {
        top: 46px; /* WP admin bar height on mobile */
    }
}