* {
    box-sizing: border-box;
}

:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-card-hover: #2a2a2a;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --accent-color: #3b82f6;
    --border-color: #333;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Rainbow Gradient (Hard Stops) */
    --rainbow-gradient: linear-gradient(180deg,
            #FF0018 0%, #FF0018 16.66%,
            #FFA52C 16.66%, #FFA52C 33.33%,
            #FFFF41 33.33%, #FFFF41 50%,
            #008018 50%, #008018 66.66%,
            #0000F9 66.66%, #0000F9 83.33%,
            #86007D 83.33%, #86007D 100%);

    /* Trans Flag Gradient (Hard Stops) */
    --trans-gradient: linear-gradient(180deg,
            #5BCEFA 0%, #5BCEFA 20%,
            #F5A9B8 20%, #F5A9B8 40%,
            #FFFFFF 40%, #FFFFFF 60%,
            #F5A9B8 60%, #F5A9B8 80%,
            #5BCEFA 80%, #5BCEFA 100%);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.icon-wrapper {
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rainbow-heart {
    background: var(--rainbow-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.trans-heart {
    background: var(--trans-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-label {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* Client Tabs */
.client-tabs-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    gap: 10px;
    padding: 0 5px 15px 5px;
    margin-bottom: 5px;
    /* Less margin between client and game tabs */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.client-tabs-container::-webkit-scrollbar {
    display: none;
}

.client-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 8px;
    /* Square-ish for clients */
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.client-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.client-tab.active {
    background: var(--text-main);
    color: var(--bg-dark);
    border-color: var(--text-main);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.client-info-link {
    text-align: center;
    margin-bottom: 20px;
    display: none;
    /* Hidden by default */
}

.client-info-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.client-info-link a:hover {
    color: #fff;
    background: var(--accent-color);
}

/* Game Tabs */
.game-tabs-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    gap: 10px;
    padding: 0 5px 15px 5px;
    margin-bottom: 20px;
    /* Hide scrollbar for clean look */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.game-tabs-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.game-tab {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
}

.game-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.game-tab.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Controls Styles */
.controls-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .controls-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.search-bar {
    position: relative;
    flex: 1;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent-color);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-group select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

/* Server List Styles */
.server-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-header {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    padding-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.server-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    display: grid;
    /* Badge (80px) | Flag (80px) | Info (1fr) | Stats (auto) */
    grid-template-columns: 80px 80px 1fr auto;
    gap: 15px;
    align-items: center;
}

/* Server List Header */
.server-list-header {
    display: grid;
    grid-template-columns: 80px 80px 1fr auto;
    gap: 15px;
    padding: 0 15px 10px 15px;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    align-items: center;
}

.header-item.right-align {
    text-align: right;
    justify-self: end;
}

.server-item:hover {
    transform: translateY(-2px);
    background-color: var(--bg-card-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.server-game-badge {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.server-game-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.server-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.server-name {
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Helper for colored server names (Quake color codes) */
.server-name span {
    display: inline;
}

.server-flag {
    height: 42px;
    width: 56px;
    /* 4:3 aspect ratio roughly, or just fit content */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: -5px;
    /* Pull closer to badge if needed, or adjust spacing */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.server-flag .flag-icon {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.server-details {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    gap: 15px;
    align-items: center;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.server-stats {
    text-align: right;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.player-count {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.player-count span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 2rem;
}

/* Colors for Quake/COD color codes */
.color-0 {
    color: #000000;
}

.color-1 {
    color: #ff3333;
}

.color-2 {
    color: #33ff33;
}

.color-3 {
    color: #ffff33;
}

.color-4 {
    color: #3333ff;
}

.color-5 {
    color: #33ffff;
}

.color-6 {
    color: #ff33ff;
}

.color-7 {
    color: #ffffff;
}

.color-8 {
    color: #7f7f7f;
}

/* Connect Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.command-box {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.command-box code {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--accent-color);
    font-size: 1.1rem;
    word-break: break-all;
}

.copy-btn {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Connect Button */
.connect-btn {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.connect-btn:hover {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Footer Note */
.footer-note {
    text-align: center;
    font-size: 10px;
    color: #1a1a1a;
    margin-top: 40px;
    cursor: default;
}

@media (max-width: 768px) {
    .server-list-header {
        grid-template-columns: 45px 50px 1fr auto;
        gap: 8px;
        padding: 0 8px 10px 8px;
        font-size: 0.7rem;
    }

    .server-item {
        grid-template-columns: 45px 50px 1fr auto;
        gap: 8px;
        padding: 10px 8px;
    }

    /* Adjust Badge/Flag alignment */
    .server-flag {
        width: 100%;
        margin-right: 0;
        justify-content: center;
    }

    .server-game-badge {
        margin: 0 auto;
    }

    /* Tweak Connect Button for Mobile */
    .connect-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    /* Adjust Font Sizes */
    .server-name {
        font-size: 0.9rem;
    }

    .server-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        font-size: 0.75rem;
    }

    .player-count {
        font-size: 0.9rem;
    }

    /* Ensure header text doesn't break layout if it wraps */
    .header-item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}