:root {
    --primary-color: #0088ff; /* Brighter Blue */
    --primary-dark: #0066cc;
    --accent-color: #2ecc71; /* Vibrant Green */
    --accent-dark: #27ae60;
    --bg-color: #121212; /* Deep Dark BG */
    --card-bg: #1e1e1e; /* Slightly Lighter Card BG */
    --text-color: #ecf0f1; /* White/Light Grey Text */
    --text-light: #b0bec5; /* Muted Text */
    --border-color: #2c2c2c; /* Subtle Borders */
    --container-width: 1200px; /* Slightly wider */
    --nav-height: 70px;
    --font-heading: "Cinzel", serif;
    --font-body: "Open Sans", sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(to bottom, #1a1a1a, #121212);
    font-family: var(--font-body);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: #ffffff;
    letter-spacing: 0.5px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #4facfe;
    text-shadow: 0 0 5px rgba(79, 172, 254, 0.5);
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* Top Navigation Bar */
.top-bar {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    height: var(--nav-height);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: #b0bec5;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    border-bottom-color: var(--primary-color);
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-trigger {
    cursor: pointer;
    padding-right: 0.5rem !important;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
    z-index: 1001;
    margin-top: 15px; /* Visual offset */
}

/* Fix hover gap */
.dropdown-menu::after {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

/* Triangle/Arrow for dropdown */
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -6px; /* This is visually inside the menu box, we need it to be above */
    /* Wait, if we use top: -6px, it is relative to the menu border box */
    /* Since we removed margin-top, the menu is touching the header bottom. */
    /* So top: -6px puts it ON TOP of the header, which is good. */
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border-color);
    z-index: 1002;
}

.dropdown:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dropdown-menu li {
    display: block;
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-transform: none; /* Keep sub-items readable */
    font-size: 0.9rem;
    font-weight: normal;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
    padding-left: 1.5rem;
    border-bottom-color: rgba(255, 255, 255, 0.05); /* fix hover border */
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white !important; /* Force white text */
    box-shadow: 0 4px 15px rgba(0, 136, 255, 0.3);
    border-bottom: none; /* remove nav link border */
    white-space: nowrap; /* Prevent text wrapping */
    padding: 0.75rem 1.5rem; /* Ensure consistent padding */
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 255, 0.5);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    color: white !important;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* Server List */
.server-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.server-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.server-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-color);
    transition: background 0.3s;
}

.server-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

.server-card:hover::before {
    background: var(--primary-color);
}

.rank {
    font-size: 1.8rem;
    font-weight: bold;
    color: #555;
    min-width: 50px;
    text-align: center;
    font-family: var(--font-heading);
}

.rank-1 {
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}
.rank-2 {
    color: #bdc3c7;
    text-shadow: 0 0 10px rgba(189, 195, 199, 0.3);
}
.rank-3 {
    color: #cd7f32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
}

/* Banner in Card */
.server-banner-thumb {
    width: 120px;
    height: 60px;
    background-color: #222;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.server-info {
    flex: 1;
}

.server-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.server-info h2 a {
    color: #ffffff;
    text-decoration: none;
}

.server-info h2 a:hover {
    color: var(--primary-color);
}

.server-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.4;
}

.tags {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    color: #bbb;
    font-weight: 600;
}

.server-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    gap: 0.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.vote-count {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-color);
}

.vote-btn {
    padding: 0.6rem 1.5rem;
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.vote-btn:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px rgba(0, 136, 255, 0.4);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    margin-bottom: 2rem;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url("https://cdn.hytale.com/5ed6a6836791e8001254332d_hytale_logo_web.png");
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

/* Overlay gradient for better text readability */
.hero::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-color) 100%);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

.hero p {
    font-size: 1.25rem;
    color: #ddd;
    max-width: 700px;
    margin: 0 auto 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Footer */
footer {
    background: #0d0d0d;
    color: var(--text-light);
    padding: 4rem 0 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-col h3 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col ul a {
    color: var(--text-light);
}

.footer-col ul a:hover {
    color: var(--primary-color);
    padding-left: 5px; /* slight movement effect */
}

.disclaimer {
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.5;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #222;
}

/* Server Page Specific */
.server-header {
    background: rgba(30, 30, 30, 0.5);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.server-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.server-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
}

.server-header-actions {
    display: flex;
    gap: 1rem;
}

.main-content-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.server-description {
    color: var(--text-light);
    line-height: 1.8;
}

.server-banner-full {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.stat-label {
    color: var(--text-light);
    font-weight: 600;
}

.stat-value {
    color: #fff;
    font-weight: bold;
}

.stat-value.highlight {
    color: var(--primary-color);
}
.stat-value.online {
    color: var(--accent-color);
}

/* Mobile Nav Toggle (Hidden on Desktop) */
.nav-toggle,
.nav-toggle-label {
    display: none;
}

@media (max-width: 768px) {
    .nav-toggle-label {
        display: block;
        cursor: pointer;
        padding: 1rem;
    }

    .nav-toggle-label span,
    .nav-toggle-label span::before,
    .nav-toggle-label span::after {
        display: block;
        background: white;
        height: 2px;
        width: 2rem;
        border-radius: 2px;
        position: relative;
    }

    .nav-toggle-label span::before,
    .nav-toggle-label span::after {
        content: "";
        position: absolute;
    }

    .nav-toggle-label span::before {
        bottom: 7px;
    }
    .nav-toggle-label span::after {
        top: 7px;
    }

    /* Mobile Menu Logic */
    .nav-links {
        display: none; /* Hidden by default */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        border-bottom: 1px solid var(--border-color);
        z-index: 2000; /* Ensure mobile menu is on top */
    }

    .nav-toggle:checked ~ .nav-links {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
        display: block;
    }

    /* Mobile Dropdown */
    .dropdown:hover .dropdown-menu {
        display: none; /* Disable hover on mobile */
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.1);
        border: none;
        display: block; /* Always show sub-items in mobile menu list */
        padding-left: 1rem;
        margin-top: 0;
    }

    .dropdown-menu::before {
        display: none; /* Remove triangle on mobile */
    }

    .server-card {
        flex-direction: column;
        text-align: center;
    }

    .server-stats {
        flex-direction: row;
        width: 100%;
        justify-content: center;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-left: 0;
        padding-top: 1rem;
        margin-top: 1rem;
    }

    .server-banner-thumb {
        width: 100%;
        height: 150px;
        margin-bottom: 1rem;
    }

    .main-content-grid {
        grid-template-columns: 1fr;
    }

    .server-header-content {
        flex-direction: column;
        text-align: center;
    }
}
