:root {
    --bg-dark: #121214;
    --card-bg: #202024;
    --accent: #ffc107; /* Yellowtones Yellow */
    --accent-glow: rgba(255, 193, 7, 0.2);
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

#layout-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Sidebar Styles */
#sidebar {
    display: none; /* Hidden on small screens */
    width: 280px;
    background: var(--card-bg);
    border: 1px solid #333;
    border-radius: 16px;
    /* Fixed positioning to pin to left edge */
    position: fixed;
    left: 30px;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 100;
}

/* Custom Scrollbar for Sidebar */
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
}

.sidebar-header small {
    color: var(--text-muted);
}

.sidebar-item {
    padding: 12px 20px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-item:hover {
    background: #252529;
}

.sidebar-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.sidebar-count {
    background: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #ccc;
}

.sidebar-loader {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Sidebar Breakpoint: Only show if screen is wide enough to not overlap centered main */
@media (min-width: 1550px) {
    #sidebar {
        display: block;
    }
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    margin: 0 auto; /* Keep the dashboard centered */
    box-sizing: border-box; 
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #333;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-container {
    display: flex;
    gap: 10px;
    position: relative;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: #202024;
    border: 1px solid #333;
    border-radius: 6px;
    margin-top: 5px;
    z-index: 2000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    overflow: hidden;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #2a2a2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #ccc;
    transition: background 0.1s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #2a2a2e;
    color: var(--text-main);
}

.suggestion-count {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent);
}

#server-search {
    background: #202024;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 200px;
    transition: border-color 0.2s;
}

#server-search:focus {
    outline: none;
    border-color: var(--accent);
}

.logo {
    font-size: 2rem;
    color: var(--accent);
}

h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.refresh-btn:hover {
    background: var(--accent);
    color: #121214;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Hero Section */
.server-hero {
    text-align: center;
    margin-bottom: 25px;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.region { background: #3f51b5; color: white; }
.map { background: #009688; color: white; }
.version { background: #607d8b; color: white; }

/* IP Copy Styling */
.ip-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.copy-btn {
    background: #333;
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #333;
    transition: transform 0.2s, border-color 0.2s;
    height: 100%;
    box-sizing: border-box;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: #444;
}

.clickable {
    cursor: pointer;
    position: relative;
}

.clickable:hover {
    border-color: var(--accent);
    background: #2a2a2e;
}

.sub-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-icon {
    font-size: 2rem;
    color: var(--accent);
    background: rgba(255, 193, 7, 0.1);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-sub-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sub-stat {
    display: flex;
    justify-content: space-between;
}

.sub-stat .label {
    font-weight: 400;
}

.sub-stat .value {
    color: var(--text-main);
    font-weight: 600;
}

.big-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

/* Player Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.5s ease;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-box {
    background: #1a1a1e;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #2a2a2e;
    text-align: center;
}

.info-box h4 {
    margin: 0 0 10px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.info-box p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.monospace {
    font-family: 'Consolas', 'Monaco', monospace;
    background: #111;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
    color: var(--accent);
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease; /* Ensure all properties animate */
    border: none;
    cursor: pointer;
}

.discord {
    background: #5865F2;
    color: white;
}

.discord:hover {
    background: #4752c4;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.3);
}

.link-action {
    background: transparent !important;
    border: 1px solid var(--accent) !important;
    color: var(--accent) !important;
}

.link-action:hover {
    background: var(--accent) !important;
    color: #121214 !important;
    box-shadow: 0 5px 15px var(--accent-glow);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 16px;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

#mod-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* Custom Scrollbar for Modal and JSON View */
.modal-body::-webkit-scrollbar,
.json-view::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.modal-body::-webkit-scrollbar-track,
.json-view::-webkit-scrollbar-track {
    background: #121214;
    border-radius: 0 0 16px 0;
}

.modal-body::-webkit-scrollbar-thumb,
.json-view::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.json-view::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.mod-item {
    background: #121214;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #ddd;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.mod-item:hover {
    background-color: #1a1a1d;
    border-color: #444;
}

.mod-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.mod-placeholder {
    width: 40px;
    height: 40px;
    background: #222;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
}

.mod-item span {
    font-weight: 500;
}

/* Footer */
.footer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #222;
    padding-top: 20px;
    color: #555;
    font-size: 0.8rem;
    margin-top: 20px;
}

.footer-controls p {
    margin: 0;
}

.attribution {
    min-width: 150px;
    text-align: right;
    color: #444;
    font-size: 0.75rem;
    white-space: nowrap;
}

.text-btn {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: color 0.2s;
    font-family: inherit;
    min-width: 80px;
    text-align: left;
    white-space: nowrap;
}

.text-btn:hover {
    color: var(--accent);
}

/* JSON Viewer */
.large-modal {
    max-width: 800px;
}

.json-view {
    background: #111;
    color: #ccc;
    padding: 15px;
    border-radius: 6px;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    margin: 0;
    white-space: pre-wrap;       
    word-wrap: break-word;       
}

.json-key { color: #ffc107; font-weight: bold; }
.json-string { color: #a5d6a7; }
.json-number { color: #ce93d8; }
.json-boolean { color: #64b5f6; }
.json-null { color: #ef9a9a; }

/* States */
.hidden { display: none !important; }

.status-msg {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
}

.error { color: var(--danger); }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Responsive / Compact Mode for shorter screens */
@media (max-height: 850px) {
    .container {
        padding: 10px 20px;
    }

    header {
        padding: 10px 0;
        margin-bottom: 15px;
    }

    .server-hero {
        margin-bottom: 20px;
    }

    .stats-grid {
        gap: 15px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 15px;
        gap: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .big-number {
        font-size: 1.5rem;
    }

    .info-grid {
        gap: 15px;
        margin-bottom: 20px;
    }

    .info-box {
        padding: 15px;
    }

    .actions {
        margin-bottom: 20px;
    }

    .action-btn {
        padding: 10px 25px;
    }
}

/* Scrollbar styling for main page if it does scroll */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center; /* Center items */
        gap: 15px;
    }

    .header-content {
        justify-content: center;
        width: 100%;
        text-align: center;
    }

    .search-container {
        width: 100%;
        max-width: 400px; /* Prevent it from getting too wide on tablets */
    }

    #server-search {
        width: 100%; /* Fill container */
        flex: 1;
    }

    /* Footer Adjustments */
    .footer-controls {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .footer-controls p {
        order: 2; /* Put timestamp in middle */
    }

    .text-btn {
        order: 1; /* Advanced button top */
        width: auto; /* Let it size naturally */
        text-align: center;
    }

    .attribution {
        order: 3; /* Attribution bottom */
        width: 100%;
        text-align: center;
    }
}