/* ===== Desktop Widgets =====
   Colonne flottante en haut à droite du bureau. Purement décorative /
   informative : elle ne capte pas les clics sauf sur les éléments actifs. */
.desktop-widgets {
    position: absolute;
    top: 26px;
    right: 26px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 268px;
    pointer-events: none;
}

.widget {
    pointer-events: auto;
    background: rgba(13, 17, 26, 0.55);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg), var(--ring-inset);
    padding: 16px 18px;
    opacity: 0;
    transform: translateY(-10px);
    animation: widgetIn 0.5s var(--ease-out) forwards;
    transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease;
}

.widget:hover {
    border-color: rgba(124, 92, 255, 0.22);
}

/* Entrée décalée pour un effet de cascade */
.widget:nth-child(1) { animation-delay: 0.10s; }
.widget:nth-child(2) { animation-delay: 0.20s; }
.widget:nth-child(3) { animation-delay: 0.30s; }

@keyframes widgetIn {
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .widget {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

.widget-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.widget-label i {
    font-size: 0.66rem;
    color: var(--accent);
}

/* ===== Widget horloge ===== */
.widget-clock {
    padding-bottom: 18px;
}

.clock-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.65rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.clock-seconds {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--accent-light);
    margin-left: 5px;
    letter-spacing: 0.02em;
}

/* Le deux-points clignote à la seconde */
.clock-colon {
    animation: clockBlink 2s steps(1, end) infinite;
}

@keyframes clockBlink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0.32; }
}

.clock-date {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.clock-uptime {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.clock-uptime b {
    color: var(--aurora);
    font-weight: 500;
}

/* ===== Widget stats ===== */
.widget-stats .stat-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 0;
}

.widget-stats .stat-row + .stat-row {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    font-size: 0.78rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
}

.stat-icon.htb    { color: #9fef00; background: rgba(159, 239, 0, 0.08);  border-color: rgba(159, 239, 0, 0.18); }
.stat-icon.rootme { color: #ef7676; background: rgba(198, 40, 40, 0.10);  border-color: rgba(198, 40, 40, 0.2); }
.stat-icon.github { color: #c9d1d9; background: rgba(255, 255, 255, 0.05); }

.stat-body {
    flex: 1;
    min-width: 0;
}

.stat-name {
    font-size: 0.74rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* Barre de progression fine */
.stat-bar {
    height: 3px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.stat-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    /* Remplissage animé au chargement (JS pose --fill) */
    animation: statFill 1.1s var(--ease-out) 0.45s forwards;
}

.stat-row.htb    .stat-bar > span { background: linear-gradient(90deg, #6f9f00, #9fef00); }
.stat-row.rootme .stat-bar > span { background: linear-gradient(90deg, #a33232, #ef7676); }
.stat-row.github .stat-bar > span { background: linear-gradient(90deg, #4a5158, #c9d1d9); }

@keyframes statFill {
    to { width: var(--fill, 0%); }
}

@media (prefers-reduced-motion: reduce) {
    .stat-bar > span {
        animation: none;
        width: var(--fill, 0%);
    }
    .clock-colon { animation: none; }
}

/* ===== Widget statut système ===== */
.widget-system .sys-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 5px 0;
    color: var(--text-muted);
}

.widget-system .sys-line b {
    font-weight: 500;
    color: var(--text-secondary);
}

.sys-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: 0.64rem;
    letter-spacing: 0.04em;
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid rgba(0, 210, 106, 0.22);
    color: var(--success);
}

.sys-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Masqué dès que la place manque — les widgets chevaucheraient les fenêtres */
@media screen and (max-width: 1280px), screen and (max-height: 620px) {
    .desktop-widgets {
        display: none;
    }
}
