/* ==========================================================================
   Listing Layout - YouTube-style layout for server listing pages
   ========================================================================== */

/* Hide base.html navbar and mobile overlay on listing pages */
.listing-layout .header-container { display: none !important; }
.listing-layout .mobile-menu-overlay { display: none !important; }
body.listing-layout {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */

.listing-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0f0f0f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 300;
    display: flex;
    align-items: center;
    overflow: visible;
    transition: top 0.3s ease;
}

.listing-navbar-inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    gap: 12px;
    height: 100%;
}

/* -- Left section -- */
.listing-navbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.listing-hamburger {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: background 0.15s;
}

.listing-hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.listing-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.listing-logo-img {
    display: inline-block;
    width: 160px;
    height: 32px;
    background: url("../images/communityone-logo.ba7f5e42e83a.png") no-repeat center left / contain;
}

/* -- Center section -- */
.listing-navbar-center {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 8px;
    justify-content: center;
}

.listing-search-form {
    flex: 0 1 420px;
    min-width: 120px;
}

.listing-search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.listing-search-box:focus-within {
    border-color: rgba(125, 25, 255, 0.5);
}

.listing-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 14px;
    font-size: 0.875rem;
    outline: none;
    min-width: 0;
}

.listing-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.listing-search-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.listing-search-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Mobile search toggle (hidden on desktop) */
.listing-mobile-search-toggle {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s;
}

.listing-mobile-search-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Mobile NSFW toggle (hidden on desktop) */
.listing-nsfw-mobile {
    display: none !important;
}

/* Back arrow inside search box (hidden on desktop) */
.listing-search-back {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    padding: 6px 10px;
    cursor: pointer;
}

.listing-nav-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.listing-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    border: 1px solid transparent;
}

.listing-pill:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    text-decoration: none;
}

.listing-pill.active {
    background: rgba(125, 25, 255, 0.2);
    border-color: rgba(125, 25, 255, 0.5);
    color: #fff;
    font-weight: 600;
}

/* NSFW toggle in navbar */
.listing-nsfw-toggle {
    display: flex;
    align-items: center;
}

.nsfw-toggle-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.nsfw-toggle-compact input {
    display: none;
}

.nsfw-slider-compact {
    width: 28px;
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    position: relative;
    transition: background 0.2s;
}

.nsfw-slider-compact::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.nsfw-toggle-compact input:checked + .nsfw-slider-compact {
    background: #ef4444;
}

.nsfw-toggle-compact input:checked + .nsfw-slider-compact::after {
    transform: translateX(12px);
}

.nsfw-label-compact {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}

.nsfw-toggle-compact input:checked ~ .nsfw-label-compact {
    color: #ef4444;
}

/* -- Right section -- */
.listing-navbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.listing-navbar-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    font-size: 0.875rem;
    position: relative;
}

.listing-navbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}

.listing-navbar-btn.dropdown-toggle::after {
    display: none;
}

.listing-lang-dropdown .listing-navbar-btn {
    border-radius: 16px;
    padding: 4px 10px;
    gap: 4px;
}

.listing-lang-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.listing-add-server-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    background: #7d19ff;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.listing-add-server-btn:hover {
    background: #6a10e0;
    color: #fff;
    text-decoration: none;
    transform: scale(1.02);
}

.listing-avatar {
    border-radius: 50%;
    width: 28px;
    height: 28px;
    object-fit: cover;
}

.listing-user-dropdown .listing-navbar-btn {
    padding: 4px;
    border-radius: 50%;
}

.listing-login-btn {
    border-radius: 16px !important;
    padding: 5px 14px !important;
    font-weight: 500;
    white-space: nowrap;
}

.listing-navbar .notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid #0f0f0f;
}

.listing-navbar .dropdown-menu {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 0;
    margin-top: 4px;
}

.listing-navbar .dropdown-header {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 16px 4px;
}

.listing-navbar .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    padding: 6px 16px;
    transition: background 0.12s;
}

.listing-navbar .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.listing-navbar .dropdown-item.active {
    background: rgba(125, 25, 255, 0.15);
    color: #fff;
}

.listing-navbar .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.listing-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 220px;
    background: #0f0f0f;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    transition: width 0.2s ease, top 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.listing-sidebar::-webkit-scrollbar {
    width: 6px;
}

.listing-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.listing-sidebar.mini {
    width: 64px;
}

/* -- Sidebar Stats -- */
.sidebar-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 16px;
}

.sidebar-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sidebar-stat-item i {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

.sidebar-stat-number {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.sidebar-stat-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-stat-short {
    display: none;
}

.listing-sidebar.mini .sidebar-stats {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
}

.listing-sidebar.mini .sidebar-stat-full {
    display: none;
}

.listing-sidebar.mini .sidebar-stat-short {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
}

.listing-sidebar.mini .sidebar-stat-label {
    display: none;
}

.listing-sidebar.mini .sidebar-stat-item i {
    display: none;
}

/* -- Sidebar Divider -- */
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 12px;
}

.listing-sidebar.mini .sidebar-divider {
    margin: 4px 8px;
}

/* -- Sidebar Navigation -- */
.sidebar-nav {
    padding: 4px 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    transition: background 0.12s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav-item.active {
    background: rgba(125, 25, 255, 0.12);
    color: #fff;
    font-weight: 500;
}

.sidebar-expand-icon {
    margin-left: auto;
    font-size: 0.625rem;
    transition: transform 0.2s;
    color: rgba(255, 255, 255, 0.3);
}

.sidebar-expand-toggle.expanded .sidebar-expand-icon {
    transform: rotate(180deg);
}

/* -- Sub-menu -- */
.sidebar-sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 0;
}

.sidebar-sub-menu.open {
    max-height: 400px;
}

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 44px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.78rem;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

.sidebar-sub-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}

.sidebar-sub-item i {
    width: 16px;
    text-align: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* -- Mini sidebar overrides -- */
.listing-sidebar.mini .sidebar-nav-label,
.listing-sidebar.mini .sidebar-expand-icon {
    display: none;
}

.listing-sidebar.mini .sidebar-nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
}

.listing-sidebar.mini .sidebar-nav-item i {
    font-size: 1rem;
}

.listing-sidebar.mini .sidebar-sub-menu {
    display: none;
}

.listing-sidebar.mini .sidebar-expandable .sidebar-expand-toggle {
    pointer-events: none;
}

/* -- Sidebar Categories -- */
.sidebar-categories-section {
    padding: 4px 8px 16px;
}

.sidebar-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.35);
    padding: 8px 12px 4px;
    margin: 0;
    font-weight: 600;
}

.listing-sidebar.mini .sidebar-section-title {
    display: none;
}

.sidebar-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.78rem;
    transition: background 0.12s, color 0.12s;
}

.sidebar-cat-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}

.sidebar-cat-item.active {
    color: #fff;
    background: rgba(125, 25, 255, 0.1);
}

.sidebar-cat-item i {
    width: 16px;
    text-align: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-cat-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-sidebar.mini .sidebar-cat-item {
    justify-content: center;
    padding: 8px 0;
    gap: 0;
}

.listing-sidebar.mini .sidebar-cat-item span {
    display: none;
}

.listing-sidebar.mini .sidebar-cat-item i {
    font-size: 0.875rem;
}

/* -- Sidebar Backdrop (mobile) -- */
.listing-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.listing-sidebar-backdrop.visible {
    display: block;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.listing-main {
    margin-left: 220px;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
    transition: margin-left 0.2s ease, margin-top 0.3s ease;
    padding: 16px 24px;
}

.listing-main.sidebar-mini {
    margin-left: 64px;
}

/* ==========================================================================
   CONTENT HELPERS
   ========================================================================== */

.listing-seo-h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 16px;
    line-height: 1.3;
}

.faq-trigger-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    vertical-align: middle;
}

.faq-trigger-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.listing-breadcrumb .subtle-breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 6px;
    padding: 0;
    background: transparent;
}

.listing-breadcrumb .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

.listing-breadcrumb .breadcrumb-item a:hover {
    color: rgba(255, 255, 255, 0.7);
}

.listing-breadcrumb .breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.5);
}

.listing-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   MOBILE (<=768px)
   ========================================================================== */

@media (max-width: 768px) {
    .listing-sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 250;
    }

    .listing-sidebar.mini {
        width: 260px;
        transform: translateX(-100%);
    }

    .listing-sidebar.mobile-open {
        transform: translateX(0);
    }

    .listing-sidebar.mini.mobile-open {
        transform: translateX(0);
    }

    /* Always show labels on mobile when open */
    .listing-sidebar.mini.mobile-open .sidebar-nav-label,
    .listing-sidebar.mini.mobile-open .sidebar-expand-icon {
        display: inline;
    }

    .listing-sidebar.mini.mobile-open .sidebar-nav-item {
        justify-content: flex-start;
        padding: 8px 12px;
        gap: 12px;
    }

    .listing-sidebar.mini.mobile-open .sidebar-sub-menu {
        display: block;
    }

    .listing-sidebar.mini.mobile-open .sidebar-section-title {
        display: block;
    }

    .listing-sidebar.mini.mobile-open .sidebar-cat-item {
        justify-content: flex-start;
        padding: 6px 12px;
        gap: 10px;
    }

    .listing-sidebar.mini.mobile-open .sidebar-cat-item span {
        display: inline;
    }

    .listing-sidebar.mini.mobile-open .sidebar-stats {
        flex-direction: row;
        padding: 12px 16px;
    }

    .listing-sidebar.mini.mobile-open .sidebar-stat-label {
        display: block;
    }

    .listing-sidebar.mini.mobile-open .sidebar-stat-item i {
        display: block;
    }

    .listing-sidebar.mini.mobile-open .sidebar-expandable .sidebar-expand-toggle {
        pointer-events: auto;
    }

    .listing-main,
    .listing-main.sidebar-mini {
        margin-left: 0;
        padding: 12px 12px;
    }

    /* Mobile: show search icon + NSFW in right section, hide center */
    .listing-mobile-search-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .listing-nsfw-mobile {
        display: flex !important;
    }

    .listing-nsfw-desktop {
        display: none !important;
    }

    .listing-navbar-center {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #0f0f0f;
        z-index: 10;
        padding: 8px 8px;
        gap: 0;
    }

    .listing-navbar-center.mobile-search-open {
        display: flex;
    }

    .listing-navbar-center.mobile-search-open .listing-search-form {
        flex: 1;
    }

    .listing-navbar-center.mobile-search-open .listing-search-back {
        display: flex;
        align-items: center;
    }

    .listing-nav-pills {
        display: none;
    }

    .listing-search-form {
        max-width: none;
    }

    .listing-add-server-text {
        display: none;
    }

    .listing-add-server-btn {
        padding: 6px 10px;
        border-radius: 50%;
    }

    .listing-lang-dropdown,
    .whats-new-bell {
        display: none !important;
    }

    .listing-navbar-right {
        gap: 0;
    }

    .listing-navbar-right .listing-navbar-btn,
    .listing-navbar-right .listing-add-server-btn {
        padding: 6px 6px;
    }

    .listing-login-btn {
        padding: 4px 10px !important;
        font-size: 0.75rem;
    }
}

/* ==========================================================================
   SMALL MOBILE (<=480px)
   ========================================================================== */

@media (max-width: 480px) {
    .listing-navbar-inner {
        padding: 0 8px;
        gap: 6px;
    }

    .listing-logo-img {
        width: 32px;
        height: 32px;
        background-image: url("../images/CO_logo_reverse_small.ce7a21797d36.png") !important;
        background-position: center !important;
    }

    .listing-main {
        padding: 10px 8px;
    }

    .listing-sidebar.mobile-open,
    .listing-sidebar.mini.mobile-open {
        width: 240px;
    }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
    .listing-sidebar,
    .listing-navbar,
    .listing-sidebar-backdrop {
        display: none !important;
    }

    .listing-main,
    .listing-main.sidebar-mini {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
}
