/* ⬇️ Customize variables here ⬇️ */
:root {
    /* Theme Colors */
    --background-color: #0d0e13;
    --text-color: white;
    --text-color-secondary: #aeaeae;

    --item-bg: #1f1f26;
    --item-border: #39343d;

    /* Card colors */
    --card-bg: rgba(30, 30, 35, 0.4);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-text: #ffffff;
    --card-text-secondary: #cccccc;
    --card-footer-text: #888888;
    --card-divider: rgba(255, 255, 255, 0.1);

    /* Fonts */
    --font-primary: "Outfit", sans-serif;

    /* Background */
    --bg: url("assets/bg.png");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
}

p,
span {
    color: var(--text-color-secondary);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

body {
    background-image: var(--bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 16px;
}

.status-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--card-text);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-divider);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.server-icon {
    width: 45px;
    height: 45px;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.card-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--card-text);
    margin: 0;
}

.services-section {
    margin-bottom: 24px;
}

.services-section:last-of-type {
    margin-bottom: 16px;
}

.services-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--card-text);
    margin: 0 0 12px 0;
}

.service-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.service-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 5px 0 9px;
    border-bottom: 1px solid var(--card-divider);
}

.service-block:last-child {
    border-bottom: 0;
}

.service-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-count {
    font-size: 12px;
    color: var(--card-text-secondary);
    white-space: nowrap;
}

.online-players {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 5px 0 4px;
}

.player-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 11px 4px 5px;
    border: 1px solid var(--item-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    color: var(--card-text);
    font-size: 12px;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.player-name:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.22);
}

.player-head {
    display: block;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.22);
}

.players-placeholder {
    color: var(--card-footer-text);
    font-size: 11px;
}

.service-name {
    font-size: 14px;
    color: var(--card-text-secondary);
    font-weight: 400;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
}

.status-indicator.online .status-dot {
    background-color: #22c55e;
}

.status-indicator.online .status-text {
    color: #22c55e;
}

.status-indicator.offline .status-dot {
    background-color: #ef4444;
}

.status-indicator.offline .status-text {
    color: #ef4444;
}

.status-indicator.maintenance .status-dot {
    background-color: #f59e0b;
}

.status-indicator.maintenance .status-text {
    color: #f59e0b;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--card-divider);
    font-size: 11px;
}

.copyright {
    color: var(--card-footer-text);
}

.last-updated,
.next-update {
    color: var(--card-footer-text);
}

.next-update {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 420px) {
    .card-footer {
        gap: 10px;
        flex-wrap: wrap;
    }
}

.alert-container {
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.alert {
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid;
    animation: slideIn 0.3s ease-out;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--card-text);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--card-text);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--card-text);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--card-text);
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.alert-warning .alert-icon {
    color: #f59e0b;
}

.alert-error .alert-icon {
    color: #ef4444;
}

.alert-info .alert-icon {
    color: #3b82f6;
}

.alert-success .alert-icon {
    color: #22c55e;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--card-text);
    margin-bottom: 4px;
}

.alert-message {
    font-size: 13px;
    color: var(--card-text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.alert-time {
    font-size: 11px;
    color: var(--card-footer-text);
    opacity: 0.8;
}

.alert-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.alert-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--card-text);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .alert-container {
        max-width: 100%;
    }

    .status-card {
        padding: 24px;
        max-width: 100%;
    }

    .card-footer {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .alert {
        padding: 12px;
        gap: 10px;
    }

    .alert-title {
        font-size: 13px;
    }

    .alert-message {
        font-size: 12px;
    }
}

/* Live Minecraft status additions */
.service-details {
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-count {
    color: var(--card-footer-text);
    font-size: 11px;
    white-space: nowrap;
}
.status-indicator.checking .status-dot {
    background-color: #9ca3af;
}
.status-indicator.checking .status-text {
    color: #9ca3af;
}


/* Minecraft server ping */
.server-ping {
    font-size: 11px;
    color: var(--card-footer-text);
    white-space: nowrap;
    min-width: 42px;
    text-align: right;
}

.server-ping.ping-good {
    color: #22c55e;
}

.server-ping.ping-medium {
    color: #f59e0b;
}

.server-ping.ping-high {
    color: #ef4444;
}


/* Cleaner alignment for Minecraft player count, VPS ping and status */
.service-details {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    justify-content: end;
    column-gap: 13px;
}

.player-count {
    min-width: 76px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.server-ping {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 4px 7px;
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.08);
    color: #22c55e;
    font-size: 11px;
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.server-ping.ping-medium {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.08);
}

.server-ping.ping-high {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.24);
    background: rgba(239, 68, 68, 0.08);
}

@media (max-width: 480px) {
    .service-details {
        column-gap: 7px;
    }

    .player-count {
        min-width: 64px;
        font-size: 10px;
    }

    .server-ping {
        min-width: 48px;
        padding: 4px 5px;
        font-size: 10px;
    }
}


/* Minimal, quieter ping presentation */
.server-ping {
    display: inline;
    min-width: 42px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #a7c9b0;
    font-size: 11px;
    line-height: inherit;
    font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.server-ping.ping-good {
    color: #a7c9b0;
    border: 0;
    background: transparent;
}

.server-ping.ping-medium {
    color: #d8b779;
    border: 0;
    background: transparent;
}

.server-ping.ping-high {
    color: #d98c8c;
    border: 0;
    background: transparent;
}

.service-details {
    column-gap: 12px;
}

@media (max-width: 480px) {
    .service-details {
        column-gap: 8px;
    }
}


/* Subtle player chip with a restrained hover highlight */
.player-name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 3px 10px 3px 5px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--card-text-secondary);
    font-size: 12px;
    line-height: 1;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.player-name:hover {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.105);
    color: var(--card-text);
}

.player-head {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
}


/* Make the player count easier to read and keep it grouped with ping */
.player-count {
    color: #d6d6dc;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05px;
    min-width: 92px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.service-details {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 480px) {
    .player-count {
        min-width: 76px;
        font-size: 11px;
    }

    .service-details {
        gap: 8px;
    }
}


/* Small centered credit below the status card */
.site-credit {
    width: 100%;
    margin: 14px auto 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.48);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.2px;
}


/* Lobby TPS: match the ping size and color the numeric value by performance. */
#lobby-performance.server-performance {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto !important;
    gap: 3px;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--card-footer-text) !important;
    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    font-variant-numeric: tabular-nums;
}

#lobby-performance #lobby-tps {
    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    color: var(--card-footer-text);
}

#lobby-performance #lobby-tps.performance-good {
    color: #a7c9b0 !important;
}

#lobby-performance #lobby-tps.performance-medium {
    color: #d8b779 !important;
}

#lobby-performance #lobby-tps.performance-low {
    color: #d98c8c !important;
}

@media (max-width: 480px) {
    #lobby-performance.server-performance,
    #lobby-performance #lobby-tps {
        font-size: 10px !important;
    }
}

/* TPS unit is intentionally quiet and ping-sized; only the numeric value changes color. */
#lobby-performance .performance-unit {
    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    color: #888888 !important;
}
@media (max-width: 480px) {
    #lobby-performance .performance-unit {
        font-size: 10px !important;
    }
}

/* Align player count, ping, TPS and status into identical columns on every Minecraft row. */
.service-details {
    display: grid !important;
    grid-template-columns: minmax(82px, 1fr) 42px 50px max-content;
    align-items: center;
    justify-content: stretch;
    column-gap: 8px;
    width: 260px;
    max-width: calc(100% - 62px);
    flex: 0 0 260px;
}

.service-details .player-count {
    min-width: 0 !important;
    width: auto;
    text-align: right;
    white-space: nowrap;
}

.service-details .server-ping {
    min-width: 0 !important;
    width: 42px;
    text-align: center;
}

.service-details .server-performance,
.service-details .server-performance-placeholder {
    width: 50px;
    min-width: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
}

.service-details .server-performance-placeholder {
    visibility: hidden;
}

.service-details .status-indicator {
    justify-self: end;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .service-details {
        grid-template-columns: minmax(70px, 1fr) 40px 46px max-content;
        column-gap: 6px;
        width: 250px;
        max-width: calc(100% - 54px);
        flex-basis: 250px;
    }

    .service-details .server-ping {
        width: 40px;
    }

    .service-details .server-performance,
    .service-details .server-performance-placeholder {
        width: 46px;
        min-width: 46px;
    }
}


/* Alert administration link */
.admin-link { color: inherit; text-decoration: none; opacity: .72; }
.admin-link:hover { color: #a7c9b0; opacity: 1; text-decoration: underline; }

/* TPS: color both the number and the unit consistently. */
#lobby-performance.performance-good .performance-unit { color: #a7c9b0 !important; }
#lobby-performance.performance-medium .performance-unit { color: #d8b779 !important; }
#lobby-performance.performance-low .performance-unit { color: #d98c8c !important; }
