/**
 * iotvsim-header.css
 * Header, pantalla d'acollida i refinaments visuals globals per a iotvSim.
 * Paleta TokyoNight: #0d0d1a, #1e1e1e, #16213e, #7aa2f7, #2ecc71, #e74c3c
 */

/* ── Header / Banner ── */
.iotvsim-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #0d0d1a 0%, #16213e 100%);
    border-bottom: 1px solid #2c3e50;
    flex-shrink: 0;
    z-index: 10050;
    user-select: none;
}

.iotvsim-header__logo {
    font-size: 22px;
    line-height: 1;
}

.iotvsim-header__title {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #c0caf5;
    letter-spacing: 0.5px;
}

.iotvsim-header__title span {
    color: #7aa2f7;
}

.iotvsim-header__subtitle {
    font-size: 11px;
    color: #565f89;
    margin-left: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Pantalla d'acollida (welcome overlay) ── */
.iotvsim-welcome {
    position: fixed;
    inset: 0;
    z-index: 50000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 13, 26, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: iotvsim-fadeIn 0.4s ease-out;
}

@keyframes iotvsim-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.iotvsim-welcome__card {
    background: #1e1e1e;
    border: 1px solid #2c3e50;
    border-radius: 12px;
    padding: 40px 48px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: iotvsim-slideUp 0.5s ease-out;
}

@keyframes iotvsim-slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.iotvsim-welcome__icon {
    font-size: 56px;
    margin-bottom: 12px;
    display: block;
}

.iotvsim-welcome__title {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 28px;
    font-weight: 700;
    color: #c0caf5;
    margin: 0 0 4px;
}

.iotvsim-welcome__title span {
    color: #7aa2f7;
}

.iotvsim-welcome__desc {
    font-size: 14px;
    color: #90a4ae;
    margin: 8px 0 28px;
    line-height: 1.6;
}

.iotvsim-welcome__steps {
    text-align: left;
    margin: 0 0 28px;
    padding: 16px 20px;
    background: #12122a;
    border: 1px solid #3b4261;
    border-radius: 8px;
    font-size: 13px;
    color: #c0caf5;
    line-height: 2;
}

.iotvsim-welcome__steps code {
    background: #0f3460;
    color: #7aa2f7;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.iotvsim-welcome__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.iotvsim-welcome__btn {
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.iotvsim-welcome__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.iotvsim-welcome__btn:active {
    transform: translateY(0);
}

.iotvsim-welcome__btn--primary {
    background: linear-gradient(135deg, #1a4731, #1e5c3a);
    color: #9ece6a;
    border: 1px solid #2ecc71;
}

.iotvsim-welcome__btn--primary:hover {
    background: linear-gradient(135deg, #1e5c3a, #247048);
}

.iotvsim-welcome__btn--secondary {
    background: #3b4261;
    color: #c0caf5;
}

.iotvsim-welcome__btn--secondary:hover {
    background: #4a5274;
}

.iotvsim-welcome__btn--dismiss {
    background: transparent;
    color: #565f89;
    font-size: 12px;
    padding: 6px 12px;
}

.iotvsim-welcome__btn--dismiss:hover {
    color: #90a4ae;
    background: rgba(255, 255, 255, 0.05);
}

/* ── Animació pols verd per al dot de connexió QEMU ── */
@keyframes fw-pulse-green {
    0%   { box-shadow: 0 0 4px #2ecc71; }
    50%  { box-shadow: 0 0 12px #2ecc71, 0 0 20px rgba(46, 204, 113, 0.3); }
    100% { box-shadow: 0 0 4px #2ecc71; }
}

.fw-conn-dot.connected {
    animation: fw-pulse-green 2s ease-in-out infinite;
}

.fw-conn-dot.disconnected {
    animation: none;
}

/* ── Barra de progrés dins compile-status ── */
.fw-progress-bar {
    width: 100%;
    height: 3px;
    background: #2c3e50;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.fw-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #7aa2f7, #2ecc71);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── Responsivitat mòbil ── */
@media (max-width: 768px) {
    /* Amagar la barra de menús estàndard en mòbil */
    .menu-bar {
        font-size: 12px;
    }

    /* Forçar layout vertical per les finestres */
    #app-container {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 36px) !important;
        overflow-y: auto !important;
    }

    /* Les finestres passen a ser blocs estàtics */
    #app-container .window {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 300px;
        border-radius: 0 !important;
        margin: 0 !important;
        flex-shrink: 0;
    }

    /* La finestra firmware ocupa la part superior */
    #firmware-window {
        order: 1;
        max-height: 50vh;
    }

    /* El bessó digital a sota */
    #twin-window {
        order: 2;
        min-height: 350px;
    }

    /* La consola al final */
    #console-window {
        order: 3;
        min-height: 150px;
    }

    /* Amagar la barra de títol de finestra per guanyar espai */
    #app-container .window .window-titlebar {
        padding: 4px 8px;
    }

    /* Welcome card adaptat a mòbil */
    .iotvsim-welcome__card {
        padding: 24px 20px;
    }

    .iotvsim-welcome__title {
        font-size: 22px;
    }

    .iotvsim-welcome__actions {
        flex-direction: column;
    }
}

/* ── Fons global unificat ── */
body {
    background: #0d0d1a !important;
}

#app-container {
    background: #0d0d1a;
}
