/* home.css for Online Games Theme */

/* General Layout Options for Home */
.theme-default.home-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    background: #f0f0f0;
}

.home-header {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px 5px 20px;
    /* Reduced bottom padding to balance logo spacing */
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Left Logo Centered */
.home-logo-left {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    /* Allows clicking through if overlaps */
}

.home-logo-left a {
    pointer-events: auto;
    /* Re-enable click for the link */
}

.home-logo-left img {
    height: 48px;
    width: auto;
    display: block;
}

/* Right Nav and Share */
.home-nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Expandable Desktop Nav Pill */
.desktop-nav-pill {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    width: 42px;
    /* Starts as a circle */
    height: 42px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.desktop-nav-pill.expanded {
    width: 320px;
    /* Expand to fit content */
}

.desktop-more-btn {
    width: 42px;
    height: 42px;
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
    padding: 0;
}

.desktop-more-btn:hover {
    color: #2E3A44;
}

.home-nav-links {
    display: flex;
    gap: 20px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding-left: 5px;
    padding-right: 20px;
    margin: 0;
}

.desktop-nav-pill.expanded .home-nav-links {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

.home-nav-links a {
    color: #475569;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.home-nav-links a:hover {
    color: #2E3A44;
}

/* Share Button Adjustment */
.home-view .theme-share-btn {
    position: static;
    margin: 0;
    background: #fff;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Left Action & Mobile More Button Style */
.home-header-left-action .mobile-menu-btn,
.mobile-nav-actions .mobile-more-btn {
    background: #fff;
    border: none;
    font-size: 1.2rem;
    color: #475569;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: color 0.2s, transform 0.2s;
    padding: 0;
}

.home-header-left-action .mobile-menu-btn:hover,
.mobile-nav-actions .mobile-more-btn:hover {
    color: #2E3A44;
    transform: scale(1.05);
}

/* Main Full Width Card container */
.home-view .theme-container {
    max-width: 1400px;
    width: calc(100% - 40px);
    margin: 0 auto 40px;
    padding: var(--theme-spacing-xl) var(--theme-spacing-lg);
    background: var(--theme-bg);
    border-radius: var(--theme-radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Soft premium shadow */
}

/* Adjust grid for extremely wide look */
.home-view .theme-links.list-type-icon {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    padding: 0;
}

/* Description Modal (Global) */
.desc-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.desc-modal-overlay.show {
    display: flex;
}

.desc-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.desc-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .home-header {
        flex-direction: row;
        justify-content: space-between;
        padding: 15px 20px;
    }

    .home-header-left-action {
        display: flex;
        align-items: center;
        width: 42px;
    }



    .home-nav-right {
        display: none;
        /* Hidden by default, toggled via JS or controlled via dropdown */
    }

    /* Mobile Header Dropdown and Menu */
    .mobile-nav-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 42px;
        justify-content: flex-end;
    }

    /* Dropdown for links */
    .mobile-dropdown-menu {
        display: none;
        position: absolute;
        top: 60px;
        right: 20px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        z-index: 100;
        min-width: 150px;
        flex-direction: column;
    }

    .mobile-dropdown-menu.show {
        display: flex;
    }

    .mobile-dropdown-menu a,
    .mobile-dropdown-menu button {
        padding: 10px 20px;
        color: #475569;
        text-decoration: none;
        font-size: 0.95rem;
        background: transparent;
        border: none;
        text-align: left;
        width: 100%;
        cursor: pointer;
    }



    .home-view .theme-container {
        /* Retain margin and border radius */
        margin: 0 15px;
        width: calc(100% - 30px);
        box-sizing: border-box;
        padding: 15px;
        order: 2;
        /* keep visual order but explicit */
        border-radius: var(--theme-radius-lg);
    }

    .theme-description-wrapper {
        margin: 20px 15px;
        width: auto;
    }

    .home-view .theme-links.list-type-icon {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .home-view .theme-links.list-type-icon {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* Desktop Hidden Elements */
@media (min-width: 769px) {

    .mobile-nav-actions,
    .mobile-dropdown-menu {
        display: none !important;
    }
}

/* Search UI Refinements */
.theme-title-wrapper {
    position: relative;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.theme-title {
    margin-bottom: 0;
    flex: 1;
    transition: opacity 0.3s;
}

.text-truncate-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-search-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.theme-search-icon {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #475569;
    cursor: pointer;
    padding: 5px;
    display: flex;
    transition: opacity 0.2s;
}

.theme-search-input-wrapper {
    display: none;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 0 15px;
    width: 300px;
    height: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-search-input-wrapper.active {
    display: flex;
}

.theme-search-input-wrapper input {
    border: none;
    outline: none;
    padding: 0 10px;
    width: 100%;
    font-size: 1rem;
    background: transparent;
}

.search-input-icon {
    color: #94a3b8;
    font-size: 1rem;
}

.theme-search-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
}

.theme-search-close:hover {
    color: #64748b;
}

@media (max-width: 768px) {
    .theme-search-input-wrapper.active {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: 0;
        width: 100%;
        z-index: 10;
    }
}