/* ============================================================
   CNC Status Widget - Chatter Control v1.5
   Single solid color bar
   ============================================================ */

.cnc-status-widget {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: 'Courier New', monospace;
    user-select: none;
}

/* Single solid bar */
.cnc-bar {
    width: 80px;
    height: 240px;
    border-radius: 8px;
    border: 2px solid #333;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    background-color: #2a2a2a;
    position: relative;
    overflow: hidden;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* State label centered in bar */
.cnc-bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #444;
    text-transform: uppercase;
    z-index: 2;
    white-space: nowrap;
    transition: color 0.4s ease;
}

/* ---- OFFLINE (default dark) ---- */
.cnc-status-widget .cnc-bar {
    background-color: #2a2a2a;
}
.cnc-status-widget .cnc-bar-label {
    color: #444;
}

/* ---- RUNNING (green) ---- */
.cnc-status-widget.running .cnc-bar {
    background-color: #1a7a30;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(26,122,48,0.6);
}
.cnc-status-widget.running .cnc-bar-label {
    color: #fff;
    text-shadow: 0 0 8px rgba(50,255,100,0.8);
}

/* ---- ALARM (red) ---- */
.cnc-status-widget.alarm .cnc-bar {
    background-color: #cc2200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(204,34,0,0.6);
}
.cnc-status-widget.alarm .cnc-bar-label {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,100,50,0.8);
}

/* ---- IDLE (amber) ---- */
.cnc-status-widget.idle .cnc-bar {
    background-color: #cc8800;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(204,136,0,0.6);
}
.cnc-status-widget.idle .cnc-bar-label {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,200,50,0.8);
}

/* Amber blink after going idle */
@keyframes cnc-bar-blink {
    0%, 100% {
        background-color: #cc8800;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(204,136,0,0.6);
    }
    50% {
        background-color: #2a2a2a;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }
}
.cnc-status-widget.idle-blink .cnc-bar {
    animation: cnc-bar-blink 1s ease-in-out infinite;
}
.cnc-status-widget.idle-blink .cnc-bar-label {
    color: #ffcc44;
}

/* ---- Progress track (inside bar, fills from bottom) ---- */
.cnc-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(to top, #44ff88, #00cc55);
    opacity: 0.35;
    transition: height 2s ease;
    z-index: 1;
}

/* ---- Machine label ---- */
.cnc-machine-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ccc;
    text-transform: uppercase;
    text-align: center;
    max-width: 80px;
    line-height: 1.3;
}

/* ---- Program info ---- */
.cnc-program-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 28px;
}

.cnc-program-num {
    font-size: 10px;
    color: #888;
    letter-spacing: 0.5px;
}

.cnc-time-info {
    font-size: 9px;
    color: #666;
    letter-spacing: 0.5px;
}

.cnc-status-widget.has-data .cnc-program-num { color: #aaa; }
.cnc-status-widget.has-data.running .cnc-program-num { color: #44ff88; }
.cnc-status-widget.has-data.alarm .cnc-program-num { color: #ff6644; }
.cnc-status-widget.has-data.idle .cnc-program-num { color: #ffcc44; }
.cnc-status-widget.has-data.idle-blink .cnc-program-num { color: #ffcc44; }
