﻿/* =========================================================
   GENERAL
   ========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    background: #111;
    color: #eee;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 22px;
    overflow-x: hidden;
    overflow-y: hidden;
}


/* =========================================================
   TOP BAR
   ========================================================= */

#topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #181818;
    border-bottom: 1px solid #444;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    min-width: 0;
    box-sizing: border-box;
}


/* =========================================================
   STATUS LIGHTS
   ========================================================= */

#statusLights {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-right: auto;
    margin-left: 8px;
    min-width: 0;
    overflow: hidden;
}


.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 18px;
}


.status-light {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
    background: #555;
    box-shadow: 0 0 4px rgba(255,255,255,0.2);
}


    .status-light.ok {
        background: #35d04f;
        box-shadow: 0 0 7px rgba(53,208,79,0.8);
    }


    .status-light.error {
        background: #e53935;
        box-shadow: 0 0 7px rgba(229,57,53,0.8);
    }


    .status-light.warning {
        background: #f7c948;
        box-shadow: 0 0 7px rgba(247,201,72,0.85);
    }


/* =========================================================
   FULLSCREEN BUTTON
   ========================================================= */

#fullscreenButton {
    flex: 0 0 auto;
    width: 42px;
    height: 36px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 6px;
    background: #252525;
    color: #eee;
    font-size: 24px;
    cursor: pointer;
}


    #fullscreenButton:hover {
        background: #333;
    }


/* =========================================================
   QUICK ACTIONS
   ========================================================= */

#quickActions {
    position: fixed;
    top: 61px;
    left: 0;
    right: 0;
    z-index: 900;
    height: 61px;
    padding: 10px 14px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #181818;
    border-bottom: 1px solid #444;
    direction: rtl;
    transform: translateY(-100%);
    transition: transform 0.25s ease;
}


    #quickActions.quick-actions-visible {
        transform: translateY(0);
    }


.quick-action {
    min-width: 42px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #252525;
    color: #eee;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-sizing: border-box;
    touch-action: manipulation;
    white-space: nowrap;
}


    .quick-action:hover {
        background: #333;
    }


    .quick-action:active {
        background: #444;
        transform: scale(0.96);
    }


    .quick-action.help-active {
        background: #8fd3ff;
        border-color: #c8ecff;
        color: #111;
        box-shadow: 0 0 0 2px rgba(143,211,255,0.35);
    }


    .quick-action.help-active .question-icon {
        color: #111;
    }


.quick-action-icon {
    position: relative;
    width: 25px;
    height: 25px;
    display: block;
    flex: 0 0 auto;
}


.quick-action-text {
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    color: inherit;
}


.refresh-icon::before {
    content: "";
    position: absolute;
    width: 19px;
    height: 19px;
    left: 3px;
    top: 3px;
    border: 3px solid #8fd3ff;
    border-right-color: transparent;
    border-radius: 50%;
    box-sizing: border-box;
}


.refresh-icon::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 2px;
    width: 0;
    height: 0;
    border-left: 7px solid #8fd3ff;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transform: rotate(-25deg);
}


.question-icon {
    color: #8fd3ff;
    font-size: 23px;
    font-weight: bold;
    line-height: 25px;
    text-align: center;
}


.rename-group-icon::before {
    content: "✎";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -54%);
    color: #8fd3ff;
    font-size: 23px;
    font-weight: bold;
    line-height: 1;
}


.test-email-icon::before {
    content: "✉";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -56%);
    color: #8fd3ff;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
}


.test-email-icon::after {
    content: none;
}


.reset-layout-icon::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 4px;
    border: 2px solid #8fd3ff;
    border-radius: 3px;
    box-sizing: border-box;
}


.reset-layout-icon::after {
    content: "✱";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -57%);
    color: #8fd3ff;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
}


.quick-action.quick-action-disabled {
    opacity: 0.45;
    cursor: default;
}


.quick-action.quick-action-disabled:hover,
.quick-action.quick-action-disabled:active {
    background: #252525;
    transform: none;
}


.help-message {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 3000;
    width: min(700px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    padding: 28px 32px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.96);
    border: 3px solid #8fd3ff;
    border-radius: 14px;
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.5;
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: center;
    box-shadow: 0 10px 36px rgba(0,0,0,0.85);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}


    .help-message.help-message-visible {
        opacity: 1;
        visibility: visible;
    }


.group-rename-overlay {
    position: fixed;
    inset: 0;
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.88);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}


    .group-rename-overlay.group-rename-overlay-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }


.group-rename-panel {
    width: min(760px, calc(100vw - 32px));
    padding: 14px 16px;
    box-sizing: border-box;
    border: 2px solid #8fd3ff;
    border-radius: 14px;
    background: #111;
    box-shadow: 0 10px 32px rgba(0,0,0,0.75);
}


.group-rename-value {
    min-height: 38px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #486a7d;
    border-radius: 10px;
    background: #000;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    direction: ltr;
    word-break: break-word;
}


.group-rename-keyboard {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}


.group-rename-key {
    min-height: 34px;
    border: 1px solid #4f5f69;
    border-radius: 8px;
    background: #222;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
}


    .group-rename-key:hover {
        background: #2f2f2f;
    }


.group-rename-key-wide {
    grid-column: span 4;
}


.group-rename-key-backspace {
    color: #ffd39f;
}


.group-rename-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}


.group-rename-action {
    flex: 1 1 0;
    min-height: 36px;
    border: 1px solid #4f5f69;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}


.group-rename-cancel {
    background: #262626;
    color: #fff;
}


.group-rename-confirm {
    background: #8fd3ff;
    color: #111;
}


.group-rename-space {
    background: #1f2d36;
    color: #d9f2ff;
}


/* =========================================================
   MAIN CONTENT - HORIZONTAL SCROLL AREA
   ========================================================= */

#content {
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    /*
       IMPORTANT:
       The scrolling container itself must remain
       the width of the screen.
    */

    width: 100%;
    min-width: 0;
    max-width: 100%;
    /*
       The widgets create the horizontal overflow.
    */

    overflow-x: auto;
    overflow-y: hidden;
    /*
       Keep scrolling coordinates predictable.
    */

    direction: ltr;
    /*
       Hide scrollbar.
    */

    scrollbar-width: none;
    /*
       Prevent accidental vertical expansion.
    */

    height: calc(100vh - 61px);
}


    #content::-webkit-scrollbar {
        display: none;
    }


/* =========================================================
   WIDGETS
   ========================================================= */

.widget {
    position: relative;
    /*
       IMPORTANT:
       flex-basis is fixed so the widgets cannot shrink.
    */

    flex: 0 0 220px;
    width: 220px;
    height: 220px;
    /* darker, low-contrast background to reduce glare on bright screens */
    background: #1b1b1b;
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 50%;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.6);
    /*
       Restore RTL inside each widget.
    */

    direction: rtl;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


    .widget.widget-dragging {
        cursor: grabbing;
        transform: scale(0.88);
        box-shadow: 0 8px 24px rgba(0,0,0,0.65);
        transition: none;
    }


    .widget.widget-drag-target {
        transform: scale(0.88);
        box-shadow: 0 0 0 5px rgba(143,211,255,0.8), 0 3px 18px rgba(0,0,0,0.55);
    }

    .widget.widget-swap-action {
        box-shadow: 0 0 0 4px rgba(100,200,255,0.6), 0 0 0 8px rgba(100,200,255,0.3), 0 3px 18px rgba(0,0,0,0.55);
        transform: scale(0.88);
        animation: pulse-blue 0.6s ease-in-out infinite;
    }

    .widget.widget-merge-action {
        box-shadow: 0 0 0 4px rgba(100,255,150,0.6), 0 0 0 8px rgba(100,255,150,0.3), 0 3px 18px rgba(0,0,0,0.55);
        transform: scale(0.88);
        animation: pulse-green 0.6s ease-in-out infinite;
    }

    @keyframes pulse-blue {
        0%, 100% { box-shadow: 0 0 0 4px rgba(100,200,255,0.6), 0 0 0 8px rgba(100,200,255,0.3), 0 3px 18px rgba(0,0,0,0.55); }
        50% { box-shadow: 0 0 0 6px rgba(100,200,255,0.8), 0 0 0 10px rgba(100,200,255,0.4), 0 3px 18px rgba(0,0,0,0.55); }
    }

    @keyframes pulse-green {
        0%, 100% { box-shadow: 0 0 0 4px rgba(100,255,150,0.6), 0 0 0 8px rgba(100,255,150,0.3), 0 3px 18px rgba(0,0,0,0.55); }
        50% { box-shadow: 0 0 0 6px rgba(100,255,150,0.8), 0 0 0 10px rgba(100,255,150,0.4), 0 3px 18px rgba(0,0,0,0.55); }
    }


/* =========================================================
   WIDGET CONTENT
   ========================================================= */

.widget-content {
    position: relative;
    z-index: 3;
    width: 100%;
    padding: 12px 10px 16px 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* push text to bottom so icon has clear space */
    background: transparent;
}


.widget-title {
    font-size: 16px;
    font-weight: 700;
    color: #f3f6f9;
    margin: 0 0 6px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    background: rgba(0,0,0,0.62);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}


.widget-value {
    color: #f7fbff;
    font-size: 20px;
    line-height: 1.1;
    word-break: break-word;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    background: rgba(0,0,0,0.72);
    padding: 6px 12px;
    border-radius: 16px;
    display: inline-block;
}


    .widget-value.ok {
        color: #c8ffd6;
    }


    .widget-value.error {
        color: #ffb3b3;
    }


    .widget-value.neutral {
        color: #c2c6ca;
    }


/* =========================================================
   WIDGET ART
   ========================================================= */

.widget-art {
    position: absolute;
    z-index: 1;
    /* keep the art in the upper portion of the widget so it doesn't overlap text */
    left: 50%;
    top: 8%;
    width: 78%;
    height: 58%;
    transform: translateX(-50%);
    pointer-events: none;
    /* make icon crisper and more visible */
    opacity: 1;
    filter: saturate(1.2) contrast(1.05) brightness(1.0);
}

/* Host icon: strong, clear glyph */
.widget-host::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 40%;
    background: linear-gradient(180deg, #214f7a, #15324a);
    border-radius: 6px;
    box-shadow: inset 0 2px 6px rgba(255,255,255,0.04), 0 4px 12px rgba(0,0,0,0.45);
}

.widget-host::after {
    content: "🖥";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%);
    font-size: 48px;
    line-height: 1;
    color: #eaf6ff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}


.widget-host-uptime::before {
    content: "";
    position: absolute;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #c6f4d2;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-host-uptime::after {
    content: "⏱";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -55%);
    font-size: 62px;
    color: #2f7a46;
}


.widget-host-ip::before {
    content: "";
    position: absolute;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #ffe3a6;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-host-ip::after {
    content: "⌘";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -54%);
    font-size: 64px;
    color: #8a6b20;
}

/* scale down large decorative shapes so icon area does not obscure the text */
.widget-art::before,
.widget-art::after {
    left: 50% !important;
    top: 40% !important; /* position the decorative/icon glyphs toward the upper center */
    transform-origin: 50% 50% !important;
    transform: translate(-50%, -50%) scale(0.9) !important;
}

/* ensure the main icon glyphs are high contrast and do not obscure the bottom area */
.widget-art::after {
    opacity: 1 !important;
    color: rgba(255,255,255,0.98) !important;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
}

/* Ensure text sits above art */
.widget-content,
.widget-title,
.widget-value {
    z-index: 4;
    position: relative;
}


/* =========================================================
   CLOCK
   ========================================================= */

.widget-clock::before {
    content: "";
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 8px solid #8fd3ff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
}


.widget-clock::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 42px;
    background: #24506b;
    left: 50%;
    top: 50%;
    transform-origin: 50% 100%;
    transform: translate(-50%, -100%) rotate(25deg);
    border-radius: 5px;
}


/* =========================================================
   UPTIME
   ========================================================= */

.widget-uptime::before {
    content: "";
    position: absolute;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #b8f0c0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-uptime::after {
    content: "↑";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -56%);
    font-size: 75px;
    font-weight: bold;
    color: #347a42;
}


/* =========================================================
   BACKUP
   ========================================================= */

.widget-backup::before {
    content: "";
    position: absolute;
    width: 110px;
    height: 82px;
    background: #c8e7ff;
    border-radius: 10px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-backup::after {
    content: "✓";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -58%);
    font-size: 65px;
    font-weight: bold;
    color: #2876a8;
}


/* =========================================================
   NETWORK
   ========================================================= */

.widget-network::before {
    content: "";
    position: absolute;
    width: 95px;
    height: 95px;
    border-radius: 50%;
    background: #ffe7a8;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-network::after {
    content: "⌁";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -55%);
    font-size: 70px;
    font-weight: bold;
    color: #8a6b20;
}


/* =========================================================
   EMAIL
   ========================================================= */

.widget-email::before {
    content: "";
    position: absolute;
    width: 110px;
    height: 78px;
    background: #d6c7ff;
    border-radius: 10px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-email::after {
    content: "✉";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -57%);
    font-size: 68px;
    color: #6247a5;
}


/* =========================================================
   DISKS
   ========================================================= */

.widget-disks::before {
    content: "";
    position: absolute;
    width: 95px;
    height: 95px;
    border-radius: 50%;
    background: #bde4ff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-disks::after {
    content: "▣";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -55%);
    font-size: 68px;
    color: #28668d;
}


/* =========================================================
   CLOUD
   ========================================================= */

.widget-cloud::before {
    content: "";
    position: absolute;
    width: 120px;
    height: 65px;
    background: #bde9ff;
    border-radius: 40px;
    left: 50%;
    top: 53%;
    transform: translate(-50%, -50%);
}


.widget-cloud::after {
    content: "☁";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -62%);
    font-size: 90px;
    color: #357da3;
}


/* =========================================================
   SPEED
   ========================================================= */

.widget-speed::before {
    content: "";
    position: absolute;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #ffd1b3;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-speed::after {
    content: "⚡";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -55%);
    font-size: 70px;
    color: #a85b24;
}


/* =========================================================
   GIT
   ========================================================= */

.widget-git::before {
    content: "";
    position: absolute;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #ffd8a8;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


.widget-git::after {
    content: "⑂";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -56%);
    font-size: 72px;
    font-weight: bold;
    color: #8a4b14;
}


/* =========================================================
   EMAIL CONTENT
   ========================================================= */

.email-subject {
    max-width: 170px;
    font-size: 17px;
    font-weight: bold;
    line-height: 1.2;
    overflow: hidden;
}


.email-date {
    margin-top: 7px;
    font-size: 14px;
    color: #555;
}


/* =========================================================
   DISK CONTENT
   ========================================================= */

.disk {
    font-size: 19px;
    line-height: 1.35;
    white-space: nowrap;
}


/* =========================================================
   IP CONTENT
   ========================================================= */

.ip-value {
    font-size: 17px;
    line-height: 1.35;
    direction: ltr;
}


/* =========================================================
   SPEED CONTENT
   ========================================================= */

.speed-row {
    margin: 4px 0;
    line-height: 1.15;
}


.speed-label {
    font-size: 15px;
    color: #555;
}


.speed-value {
    font-size: 18px;
    font-weight: bold;
    color: #222;
}


/* =========================================================
   GIT CONTENT
   ========================================================= */

.commit-hash {
    font-size: 17px;
    font-weight: bold;
    color: #fff0d9;
    direction: ltr;
}


.commit-subject {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.2;
}


.commit-date {
    margin-top: 4px;
    font-size: 13px;
    color: #cfd6dc;
    direction: ltr;
}


.host-ip-list {
    font-size: 17px;
    line-height: 1.3;
    direction: ltr;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    #quickActions {
        top: 58px;
        height: 58px;
        padding: 8px 12px;
    }


    #content {
        padding: 15px;
        gap: 15px;
        /*
           Still a fixed-width scrolling viewport.
        */

        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: calc(100vh - 58px);
    }


        #content .widget {
            flex: 0 0 190px;
            width: 190px;
            height: 190px;
        }


    .widget-title {
        font-size: 17px;
    }


    .widget-value {
        font-size: 19px;
    }


    .status-item {
        font-size: 15px;
    }


    #fullscreenButton {
        width: 38px;
        height: 34px;
        font-size: 21px;
    }
}
