/* ═══════════════════════════════════════════
   UreTech System Health Monitor Widget — Mobile-First CSS
   Prefix: .ure-sh-
   ═══════════════════════════════════════════ */

/* ── Root ── */
.ure-sh-root {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--sh-bg, #060510);
    border-radius: 24px;
    font-family: 'Outfit', sans-serif;
    color: var(--sh-text, #FAFAFA);
    padding: 24px 16px;
}

.ure-sh-root *,
.ure-sh-root *::before,
.ure-sh-root *::after {
    box-sizing: border-box;
}

/* ── LIVE Badge ── */
.ure-sh-live {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 20px;
    padding: 4px 12px 4px 10px;
    z-index: 10;
}

.ure-sh-live__dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F87171;
    animation: ure-sh-pulse-dot 1.5s ease-in-out infinite;
}

.ure-sh-live__text {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #F87171;
}

@keyframes ure-sh-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

/* ── Header ── */
.ure-sh-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.ure-sh-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid rgba(193, 191, 230, 0.2);
    background: rgba(193, 191, 230, 0.08);
    color: #C1BFE6;
    margin-bottom: 12px;
}

.ure-sh-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--sh-text, #FAFAFA);
    line-height: 1.2;
}

.ure-sh-desc {
    font-size: 13px;
    line-height: 1.5;
    margin: 0 auto;
    max-width: 480px;
    opacity: 0.6;
    color: var(--sh-text, #FAFAFA);
}

/* ── Body Layout ── */
.ure-sh-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Gauges Grid ── */
/* Mobile: 2x2 compact */
.ure-sh-gauges {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-items: center;
}

/* ── Gauge Card ── */
.ure-sh-gauge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(193, 191, 230, 0.06);
    border: 1px solid rgba(193, 191, 230, 0.15);
    border-radius: 20px;
    padding: 16px 12px 14px;
    width: 100%;
    max-width: 180px;
    transition: border-color 0.3s, background 0.3s;
}

.ure-sh-gauge-card:hover {
    border-color: rgba(193, 191, 230, 0.3);
    background: rgba(193, 191, 230, 0.1);
}

/* ── Gauge Icon ── */
.ure-sh-gauge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(193, 191, 230, 0.08);
}

.ure-sh-gauge-icon svg {
    display: block;
}

/* ── Gauge SVG Wrapper ── */
.ure-sh-gauge-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile: compact 120px gauges */
.ure-sh-gauge-svg {
    display: block;
    width: 120px;
    height: 120px;
}

.ure-sh-gauge-fill {
    will-change: stroke-dashoffset, stroke;
}

/* ── Gauge Center Text ── */
.ure-sh-gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    pointer-events: none;
}

.ure-sh-gauge-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--sh-text, #FAFAFA);
    font-variant-numeric: tabular-nums;
}

.ure-sh-gauge-unit {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.5;
    text-transform: uppercase;
    line-height: 1;
    margin-top: 2px;
}

/* ── Gauge Label ── */
.ure-sh-gauge-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Server Rack ── */
/* Mobile: hidden */
.ure-sh-rack {
    display: none;
    background: rgba(193, 191, 230, 0.06);
    border: 1px solid rgba(193, 191, 230, 0.15);
    border-radius: 20px;
    padding: 16px;
}

.ure-sh-rack__title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin-bottom: 12px;
    text-align: center;
}

.ure-sh-rack__grid {
    display: grid;
    gap: 8px;
}

.ure-sh-rack__unit {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(193, 191, 230, 0.04);
    border: 1px solid rgba(193, 191, 230, 0.08);
    border-radius: 8px;
    padding: 6px 10px;
}

.ure-sh-rack__unit-label {
    font-size: 9px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    opacity: 0.4;
    white-space: nowrap;
    min-width: 48px;
}

.ure-sh-rack__leds {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    flex: 1;
}

.ure-sh-rack__led {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sh-led-off, rgba(193, 191, 230, 0.1));
    transition: background 0.3s, box-shadow 0.3s;
}

.ure-sh-rack__led--on {
    background: var(--sh-led-on, #4ADE80);
    box-shadow: 0 0 6px var(--sh-led-on, #4ADE80);
}

/* ═══════════════════════════════════════════
   Tablet (768px+)
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {
    .ure-sh-root {
        padding: 32px 28px;
    }

    .ure-sh-title {
        font-size: 28px;
    }

    .ure-sh-desc {
        font-size: 14px;
    }

    .ure-sh-badge {
        font-size: 11px;
        padding: 6px 16px;
    }

    .ure-sh-header {
        margin-bottom: 28px;
    }

    /* Gauges: 2x2, larger */
    .ure-sh-gauges {
        gap: 16px;
    }

    .ure-sh-gauge-card {
        max-width: 220px;
        padding: 20px 16px 16px;
        border-radius: 24px;
    }

    .ure-sh-gauge-svg {
        width: 150px;
        height: 150px;
    }

    .ure-sh-gauge-value {
        font-size: 32px;
    }

    .ure-sh-gauge-unit {
        font-size: 13px;
    }

    /* Rack: visible as horizontal bar below gauges */
    .ure-sh-rack {
        display: block;
    }

    .ure-sh-rack__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .ure-sh-rack__led {
        width: 7px;
        height: 7px;
    }
}

/* ═══════════════════════════════════════════
   Desktop (1024px+)
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
    .ure-sh-root {
        padding: 48px 40px;
    }

    .ure-sh-title {
        font-size: 32px;
    }

    .ure-sh-desc {
        font-size: 15px;
        max-width: 560px;
    }

    .ure-sh-header {
        margin-bottom: 32px;
    }

    .ure-sh-live {
        top: 24px;
        right: 24px;
        padding: 5px 14px 5px 12px;
    }

    .ure-sh-live__text {
        font-size: 11px;
    }

    /* Rack-right layout: gauges left, rack right */
    .ure-sh-root--rack-right .ure-sh-body {
        flex-direction: row;
        align-items: flex-start;
    }

    .ure-sh-root--rack-right .ure-sh-gauges {
        flex: 1;
    }

    .ure-sh-root--rack-right .ure-sh-rack {
        width: 260px;
        flex-shrink: 0;
    }

    .ure-sh-root--rack-right .ure-sh-rack__grid {
        grid-template-columns: 1fr;
    }

    /* Rack-bottom layout: all stacked */
    .ure-sh-root--rack-bottom .ure-sh-body {
        flex-direction: column;
    }

    .ure-sh-root--rack-bottom .ure-sh-gauges {
        grid-template-columns: repeat(4, 1fr);
    }

    .ure-sh-root--rack-bottom .ure-sh-rack__grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    /* Gauges: larger on desktop */
    .ure-sh-gauge-svg {
        width: var(--sh-gauge-size, 150px);
        height: var(--sh-gauge-size, 150px);
    }

    .ure-sh-gauge-card {
        max-width: 260px;
        padding: 24px 20px 18px;
    }

    .ure-sh-gauge-value {
        font-size: 36px;
    }

    .ure-sh-gauge-unit {
        font-size: 14px;
    }

    .ure-sh-gauge-label {
        font-size: 13px;
    }

    .ure-sh-body {
        gap: 24px;
    }

    .ure-sh-rack__led {
        width: 8px;
        height: 8px;
    }
}

/* ═══════════════════════════════════════════
   Large (1440px+)
   ═══════════════════════════════════════════ */
@media (min-width: 1440px) {
    .ure-sh-root {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    .ure-sh-title {
        font-size: 36px;
    }

    /* Gauges: 200px */
    .ure-sh-gauge-svg {
        width: 200px;
        height: 200px;
    }

    .ure-sh-gauge-card {
        max-width: 280px;
    }

    .ure-sh-gauge-value {
        font-size: 40px;
    }

    .ure-sh-root--rack-right .ure-sh-rack {
        width: 300px;
    }
}

/* ═══════════════════════════════════════════
   Accessibility — Reduced Motion
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .ure-sh-live__dot {
        animation: none;
        opacity: 0.8;
    }

    .ure-sh-gauge-fill {
        transition: none !important;
    }

    .ure-sh-rack__led {
        transition: none;
    }

    .ure-sh-gauge-card {
        transition: none;
    }
}
