/* =========================================
   BASE
========================================= */

.devices-module {
    padding: 20px;
    font-family: system-ui;
    color: #e2e8f0;
}

/* =========================================
   TOP BAR (AVIONICO PULITO)
========================================= */

.top-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* 🔥 CARD ORIGINALI MA MIGLIORATE */
.stat {
    flex: 1;
    background: linear-gradient(135deg, #020617, #020617);
    border: 1px solid #1e293b;
    padding: 16px;
    border-radius: 10px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    position: relative;
    overflow: hidden;

    transition: all 0.2s ease;
}

/* glow leggerissimo (non invasivo) */
.stat::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(59,130,246,0.08), transparent);
    pointer-events: none;
}

/* hover tecnico leggero */
.stat:hover {
    border-color: #334155;
    transform: translateY(-1px);
}

/* numero principale (NEUTRO) */
.stat .big {
    font-size: 30px;
    font-weight: 700;
    color: #e2e8f0; /* 🔥 niente colori giocattolo */
    letter-spacing: 1px;
}

/* label */
.stat div:last-child {
    font-size: 11px;
    color: #64748b;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* =========================================
   DEVICE LIST
========================================= */

.device-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* RIGA BASE */
.device-row {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr 2fr 80px;
    align-items: center;
    padding: 14px;
    border-radius: 10px;
    background: #020617;
    border: 1px solid #1e293b;
    transition: all 0.2s ease;
    position: relative;
}

/* hover tecnico */
.device-row:hover {
    border-color: #334155;
    transform: translateY(-1px);
}

/* =========================================
   STATI
========================================= */

.device-row.low {
    border-left: 3px solid #2ecc71;
}

.device-row.active {
    border-left: 3px solid #f39c12;
}

.device-row.heavy {
    border-left: 3px solid #e74c3c;
    background: linear-gradient(90deg, rgba(239,68,68,0.08), transparent);
    animation: pulseGlow 1.4s infinite;
}

/* =========================================
   TRAFFIC BAR
========================================= */

.device-traffic {
    height: 6px;
    background: #111827;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.device-traffic-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    transition: width 0.3s ease;
}

.device-row.heavy .device-traffic-bar {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* =========================================
   TESTI
========================================= */

.device-row strong {
    color: #e2e8f0;
    font-size: 13px;
}

.device-row div {
    font-size: 13px;
    color: #94a3b8;
}

/* =========================================
   BUTTON
========================================= */

.device-row button {
    background: linear-gradient(135deg, #111827, #020617);
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}


/* =========================================
   BUTTON AUTOPILOTA KILL
========================================= */

.btn-disconnect {
    background: linear-gradient(135deg, #111827, #020617);
    border: 1px solid #334155;
    color: #e2e8f0;

    padding: 6px 12px;
    border-radius: 6px;

    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;

    cursor: pointer;
    transition: all 0.2s ease;
}

/* hover */
.btn-disconnect:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* click */
.btn-disconnect:active {
    transform: scale(0.95);
}


.device-row button:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.device-row button:active {
    transform: scale(0.95);
}

/* =========================================
   ANIMAZIONI
========================================= */

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0px rgba(239,68,68,0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(239,68,68,0.4);
    }
    100% {
        box-shadow: 0 0 0px rgba(239,68,68,0.3);
    }
}

/* =========================================
   LOADING
========================================= */

.loading-box {
    padding: 30px;
    text-align: center;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 12px;
}

.loading-title {
    font-size: 16px;
    color: #38bdf8;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.loading-bar {
    height: 6px;
    background: #111827;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.loading-bar-fill {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #38bdf8, #22c55e);
    animation: loadingMove 1.2s infinite;
}

.loading-text {
    font-size: 13px;
    color: #94a3b8;
}

@keyframes loadingMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}


/* =========================================
   MBPS DINAMICO (SOFT AVIONICO)
========================================= */

/* basso traffico */
.stat.mbps-low .big {
    color: #94a3b8;
}

/* traffico medio */
.stat.mbps-medium .big {
    color: #e2e8f0;
}

/* traffico alto */
.stat.mbps-high .big {
    color: #ffffff;
    text-shadow: 0 0 6px rgba(56,189,248,0.4);
}

.stat.mbps-high {
    border-color: #334155;
    box-shadow: 0 0 8px rgba(56,189,248,0.15);
}



/* =========================================
   AUTOPILOTA BUTTON STATES
========================================= */

/* disabilitato */
.btn-disconnect:disabled {
    background: #020617;
    border-color: #1e293b;
    color: #64748b;
    cursor: not-allowed;
}

/* IN CODA */
.btn-wait {
    color: #f59e0b;
}

/* IN ESECUZIONE */
.btn-run {
    color: #38bdf8;
}

 /* =========================================
   DEVICE ROW BASE (STATO NORMALE)
========================================= */

.device-row {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);

    transition:
        opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.2s cubic-bezier(0.22, 1, 0.36, 1),
        filter 1.2s cubic-bezier(0.22, 1, 0.36, 1);

    will-change: opacity, transform, filter;
}


/* =========================================
   DEVICE WARNING (LAMPEGGIO ROSSO)
========================================= */

.device-row.warning {
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: deviceBlink 1.6s ease-in-out infinite;
}

@keyframes deviceBlink {
    0% {
        box-shadow: 0 0 0 rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
        border-color: rgba(239, 68, 68, 0.9);
    }
    100% {
        box-shadow: 0 0 0 rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 0.3);
    }
}


/* =========================================
   AI BOX (AUTOPILOTA INTELLIGENCE)
========================================= */

.ai-box {
    background: linear-gradient(180deg, #020617, #020617);
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;

    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}


/* titolo principale */
.ai-title {
    font-size: 13px;
    color: #38bdf8;
    letter-spacing: 1px;
    margin-bottom: 6px;
}


/* blocco insight globale */
.ai-global {
    font-size: 12px;
    color: #e2e8f0;
    margin-bottom: 8px;
    line-height: 1.4;
}


/* singola riga AI */
.ai-line {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
    line-height: 1.3;

    padding-left: 2px;
}


/* separazione visiva tra insight e analysis */
.ai-box .ai-title + .ai-title {
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(30, 41, 59, 0.6);
}


/* effetto hover leggero (premium feel) */
.ai-line:hover {
    color: #e2e8f0;
    transition: color 0.2s ease;
}

/* =========================================
   AUTOPILOT MODE
========================================= */

.ai-mode-box {
    margin-bottom: 10px;
}

.ai-mode-title {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.ai-mode-buttons {
    display: flex;
    gap: 6px;
}

.ai-btn {
    flex: 1;
    background: #020617;
    border: 1px solid #1e293b;
    color: #94a3b8;
    padding: 6px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
}

.ai-btn:hover {
    border-color: #38bdf8;
    color: #e2e8f0;
}

.ai-btn {
    position: relative;
}

.ai-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    
    background: #020617;
    border: 1px solid #1e293b;
    color: #94a3b8;
    
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    
    white-space: nowrap;
    z-index: 10;
}



.ai-btn.active {
    border-color: #38bdf8;
    color: #e2e8f0;
    background: rgba(56, 189, 248, 0.08);

    /* retro luce soft */
box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

/* SYSTEM NOTICE BAR */

#systemNoticeBar {
    position: fixed;
    top: -120px; /* FIX mobile */
    left: 0;
    width: 100%;
    padding: 14px;
    text-align: center;
    font-weight: 500;
    z-index: 9999;
    transition: top 0.4s ease;
}

/* visibile */
#systemNoticeBar.active {
    top: 0;
}

/* tipi */
.notice-info {
    background: #1f4f7a;
    color: #fff;
}

.notice-warning {
    background: #d4a62a;
    color: #000;
}

.notice-critical {
    background: #8b0000;
    color: #fff;
}

/* mobile fix */
@media (max-width: 768px) {
    #systemNoticeBar {
        font-size: 14px;
        padding: 12px;
    }
}
