/* Flash animation for latestLogLine */
.latest-log-line.flash {
    animation: latestLogFlash 0.6s;
}

@keyframes latestLogFlash {
    0% { background: #ffe066; color: #222; }
    60% { background: #fffbe6; color: #222; }
    100% { background: transparent; color: inherit; }
}
/* ========================================
   VINE MONITOR - INFO BAR & COUNTDOWN TIMER
   Status bar with item counts and next-poll countdown
   ======================================== */

#toolbar-2 {
    position: fixed;
    top: var(--header-height, 56px);
    left: 0;
    width: 100vw;
    z-index: 999;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-between;
    background: var(--surface);
    border-top: 0.5px solid rgba(229, 229, 231, 0.45);
    box-sizing: border-box;
    padding: 2px 0 2px 4px;
    gap: 4px 8px;
}

#toolbar-2.status-login-warning {
    background: linear-gradient(180deg, #fff4cc 0%, #fff8df 100%);
    border-top: 1px solid #ffb300;
    box-shadow: inset 0 0 0 1px rgba(255, 179, 0, 0.35);
}

#item-counts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex: 1 1 200px;
    max-width: 100%;
}

#btnToggleHeader {
    flex: 0 0 auto !important;
    flex-shrink: 0;
    padding: 3px 6px;
    font-size: 12px;
    white-space: nowrap;
    align-self: center;
}

#summaryBar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-between;
    gap: 4px 8px;
    padding: 2px 4px;
    color: var(--muted-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
}

#poll-and-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    flex: 0 0 auto;
    max-width: none;
    margin-right: 0 !important;
    padding-right: 0 !important;
}

#toolbar-2:has(#item-counts + #poll-and-status) {
    justify-content: center;
}

#toolbar-2:has(#item-counts + #poll-and-status) #poll-and-status {
    justify-content: center;
}

#poll-and-status .action-link {
    margin: 0;
}

/* Countdown timer */
#countdownBar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    border-radius: 4px;
    transition: all 0.3s ease;
}

#countdownBar:hover {
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.4);
}

#countdownText {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 11px;
    min-width: 16px;
    text-align: center;
    color: var(--text);
}

#countdownText.polling-active {
    animation: countdown-gear-spin 1s linear infinite;
    color: var(--muted-text);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
}

#countdownCircle {
    position: relative;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}

.countdown-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-circle-bg {
    fill: none;
    stroke: rgba(74, 158, 255, 0.35);
    stroke-width: 10;
}

.countdown-circle-fill {
    fill: none;
    stroke: url(#countdownGradient);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s linear;
}

#countdownIcon {
    display: inline-block;
    animation: pulse-clock 2s infinite;
    font-size: 16px;
    flex: 0 0 auto;
}

/* Status bar text */

.status-login-warning .status-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1em;
    line-height: 1;
    transform-origin: center;
    animation: pulse-warning 0.9s ease-in-out infinite;
}

/* Charts panel - desktop side panel */
.charts-panel {
    position: fixed;
    right: -30%;
    top: 0;
    width: 30%;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: right 0.3s ease-in-out;
}

.charts-panel.open {
    right: 0;
}

.charts-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--muted-surface);
    flex: 0 0 auto;
}

.charts-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.btn-close-charts {
    padding: 4px 8px;
    font-size: 18px;
    background: none;
    border: none;
    color: var(--muted-text);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-close-charts:hover {
    color: var(--text);
}

.charts-content {
    flex: 1;
    overflow: auto;
    padding: 8px;
}

.charts-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

/* Charts button */
.btn-charts {
    font-size: 11px !important;
    padding: 6px 9px !important;
    background: #ffffff !important;
    border-color: #ededee !important;
}

.btn-charts:hover {
    background: #f2f0f0 !important;
    border-color: var(--primary) !important;
}

/* Mobile - charts as bottom sheet */
@media (max-width: 768px) {
    .charts-panel {
        position: fixed;
        bottom: -90vh;
        top: auto;
        right: 0;
        width: 100%;
        height: 90vh;
        border-left: none;
        border-top: 2px solid var(--border);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
        transition: bottom 0.3s ease-in-out;
        border-radius: 16px 16px 0 0;
    }

    .charts-panel.open {
        bottom: 0;
    }

    .charts-header {
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding: 16px 16px 8px 16px;
    }

    .charts-header h2 {
        font-size: 16px;
    }
}

/* Mobile - toolbar-2 wrapping (matches toolbar-1 behavior) */
@media (max-width: 768px) {
    #toolbar-2 {
        flex-wrap: wrap;
        gap: 0;
        padding: 4px;
        justify-content: center;
    }
    #toolbar-2 > * {
        font-size: 12px;
    }
    #toolbar-2 .btn {
        padding: 5px;
        font-size: 12px;
    }
    #item-counts {
        justify-content: center;
        flex: 1 1 100%;
    }
    #summaryBar {
        flex: 0 1 auto;
        justify-content: center;
    }
    #poll-and-status {
        justify-content: center;
        flex: 1 1 100%;
        gap: 0;
    }
}

/* Keyframes (unchanged) */
@keyframes countdown-gear-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulse-clock {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(1.1); }
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.55; }
}