body {
    background: #1a1d29;
}

.directory-section {
    background: #1a1d29;
    padding: 4rem 1.5rem;
    min-height: calc(100vh - 200px);
}

.directory-header {
    text-align: center;
    margin-bottom: 3rem;
}

.directory-header h1 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.directory-header p {
    color: #9ca4c7;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.section-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.section-tab {
    padding: 0.75rem 1.5rem;
    background: rgba(36, 40, 56, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #b0b3b8;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.section-tab:hover {
    background: rgba(36, 40, 56, 0.8);
    border-color: rgba(255, 92, 0, 0.3);
    color: #ffffff;
}

.section-tab.active {
    background: linear-gradient(135deg, rgba(255, 92, 0, 0.2) 0%, rgba(255, 140, 66, 0.2) 100%);
    border-color: rgba(255, 92, 0, 0.5);
    color: #ff8c42;
}

.leaderboard-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    border-radius: 999px;
    color: #4caf50;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.search-filters {
    max-width: 1200px;
    margin: 0 auto 3rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.sort-dropdown-wrapper {
    position: relative;
    min-width: 200px;
}

.search-bar {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-bar input {
    width: 100%;
    background: rgba(36, 40, 56, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: rgba(255, 92, 0, 0.5);
    background: rgba(36, 40, 56, 0.8);
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca4c7;
}

.filter-dropdown-wrapper {
    position: relative;
    min-width: 200px;
}

.filter-dropdown {
    width: 100%;
    background: rgba(36, 40, 56, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff8c42' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
}

.filter-dropdown:focus {
    outline: none;
    border-color: rgba(255, 92, 0, 0.5);
    background-color: rgba(36, 40, 56, 0.8);
}

.filter-dropdown:hover {
    border-color: rgba(255, 92, 0, 0.3);
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.server-card {
    background: rgba(36, 40, 56, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.server-banner {
    width: calc(100% + 4rem);
    height: 120px;
    margin: -2rem -2rem 1rem -2rem;
    object-fit: cover;
    object-position: var(--banner-pos-x, 50%) var(--banner-pos-y, 50%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.server-card:hover {
    border-color: rgba(255, 92, 0, 0.3);
    background: rgba(36, 40, 56, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.server-card.featured {
    border-color: rgba(240, 76, 155, 0.4);
    background: linear-gradient(135deg, rgba(36, 40, 56, 0.6) 0%, rgba(240, 76, 155, 0.05) 100%);
}

.server-card.featured::before {
    content: "⭐ Featured";
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #f04c9b 0%, #d63c8d 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.server-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.server-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    flex-shrink: 0;
}

.server-info h3 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.server-info .member-count {
    color: #9ca4c7;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.server-description {
    color: #b8bcc8;
    line-height: 1.6;
    margin: 1rem 0;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.server-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.server-tag {
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #b8bcc8;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    width: fit-content;
}

.server-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.server-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #28a745;
    font-size: 0.85rem;
    font-weight: 500;
}

.server-verified i {
    color: #28a745;
}

.join-button {
    background: linear-gradient(135deg, #ff5c00 0%, #ff8c42 100%);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.join-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 92, 0, 0.4);
}

.server-view-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #b8bcc8;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.server-view-btn:hover {
    border-color: rgba(255, 92, 0, 0.5);
    color: #fff;
}


.server-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.server-detail-overlay[hidden] {
    display: none !important;
}
.server-detail-overlay:not([hidden]) {
    display: flex;
}
.server-detail-panel {
    --accent: #ff5c00;
    max-width: 760px;
    width: 100%;
    background: linear-gradient(165deg, rgba(26, 29, 41, 0.98) 0%, rgba(18, 20, 28, 0.99) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 24px 48px rgba(0,0,0,0.45), 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.server-detail-banner {
    width: calc(100% + 3.5rem);
    height: 220px;
    margin: -1.75rem -1.75rem 0.75rem -1.75rem;
    object-fit: cover;
    object-position: var(--banner-pos-x, 50%) var(--banner-pos-y, 50%);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.server-detail-meta {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 1rem 1.25rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.server-detail-left {
    min-width: 0;
}
.server-detail-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: 250px;
}
.server-detail-right .server-tags {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
    max-width: 340px;
}
.server-detail-right .server-tag {
    font-size: 0.78rem;
    padding: 0.28rem 0.62rem;
    border-radius: 11px;
}
.server-detail-right .join-button {
    align-self: flex-end;
}
.server-detail-report-note {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #9ea8c8;
    font-size: 0.82rem;
    line-height: 1.5;
}
.server-detail-report-note a {
    color: #ff8c42;
    text-decoration: none;
}
.server-detail-report-note a:hover {
    text-decoration: underline;
}
.server-detail-logo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    object-position: var(--logo-pos-x, 50%) var(--logo-pos-y, 50%);
    border: 2px solid rgba(255,255,255,0.12);
    margin-top: -54px;
    position: relative;
    z-index: 3;
    background: #12141c;
    margin-bottom: 0.45rem;
}
.server-detail-title-wrap h3 {
    margin: 0;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.35rem;
    display: inline-block;
    min-width: min(220px, 100%);
}
.server-detail-panel .detail-desc {
    color: #b8bcc8;
    line-height: 1.6;
    margin: 1rem 0;
    font-size: 0.95rem;
}
.server-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.server-detail-banner-wrap {
    position: relative;
}
.server-detail-banner-wrap .server-detail-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 2;
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.35);
}
.server-detail-header h3 {
    flex: 1;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
}
.server-detail-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #e4e9f7;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.server-detail-close:hover { color: #fff; background: rgba(255,255,255,0.15); }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #9ca4c7;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .servers-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .search-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-bar {
        min-width: 100%;
    }
    
    .filter-dropdown-wrapper {
        width: 100%;
        min-width: 100%;
    }
    .sort-dropdown-wrapper {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-dropdown {
        width: 100%;
    }
    .server-detail-meta { grid-template-columns: 1fr; }
    .server-detail-right {
        align-items: flex-start;
        min-width: 0;
    }
    .server-detail-right .server-tags {
        justify-content: flex-start;
        max-width: 100%;
    }
    .server-detail-logo {
        margin-top: -34px;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .servers-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1101px) and (max-width: 1400px) {
    .servers-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
