/* Collections Page CSS (moved from collections.php inline style) */

/* =========================================================
            Collections Page - Inherits from common.css
            Variables & Structure Reference: index.php
            ========================================================= */

            /* Modal Styles (from index.php) */
            .modal {
                position: fixed;
                top: 0; left: 0;
                width: 100%; height: 100%;
                background: rgba(0,0,0,0.6);
                display: flex;
                justify-content: center;
                align-items: center;
                z-index: 9999;
            }
            .modal_content {
                background: #000;
                padding: 16px;
                border-radius: 12px;
                max-width: 70vw;
                width: 92%;
                position: relative;
                color: #fff;
                border: 1px solid rgba(255,255,255,0.08);
                display: flex;
                flex-direction: column;
            }
            #modalDescription {
                max-height: 160px;
                overflow-y: auto;
                word-break: break-word;
                scrollbar-width: thin;
                scrollbar-color: #888 #222;
            }

            /* Chrome, Edge, Safari */
            #modalDescription::-webkit-scrollbar {
                width: 8px;
            }
            #modalDescription::-webkit-scrollbar-thumb {
                background: #888;
                border-radius: 4px;
            }
            #modalDescription::-webkit-scrollbar-track {
                background: #222;
                border-radius: 4px;
            }
            #historyModalDescription{
                margin: 12px 0;
                max-height: 160px;
                overflow-y: auto;
                word-break: break-word;
                scrollbar-width: auto;
                scrollbar-color: #888 #222;
            }
            /* Chrome, Edge, Safari */
            #historyModalDescription::-webkit-scrollbar {
                width: 10px;
            }
            #historyModalDescription::-webkit-scrollbar-thumb {
                background: #888;
                border-radius: 4px;
            }
            #historyModalDescription::-webkit-scrollbar-track {
                background: #222;
                border-radius: 4px;
            }
            .modal_close {
                position: absolute;
                top: 14px;
                right: 16px;
                background: none;
                border: none;
                color: #fff;
                font-size: 20px;
                cursor: pointer;
            }
            .modal_viewer {
                width: 100%;
                height: 60vh;
                background: #050505;
                border-radius: 10px;
                overflow: hidden;
                border: 1px solid rgba(255,255,255,0.08);
                position: relative;
            }
            .three-viewer { position:absolute; inset:0; background:#050505; }
            .viewer-overlay {
                position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
                color:#fff; background:rgba(0,0,0,0.45); font-size:13px; letter-spacing:0.2px;
                pointer-events: none;
            }
            .three-gui{
                position: absolute;
                right: 16px;
                top: 58px;
                z-index: 2000;
                pointer-events: auto;
            }
            .three-gui .dg{
                z-index: 2000 !important;
                pointer-events: auto !important;
            }
            :root {
                --black: #000000;
                --dark-bg: #0b0b12;
                --card-bg: #2B2938;
                --border-color: #262634;
                --purple: #6d63ff;
                --text-primary: #ffffff;
                --text-secondary: #aaaaaa;
                --text-muted: #888888;
                --text-muted2: #666666;
            }
            .modal_info {
                margin-top: 12px;
                display: flex;
                flex-direction: column;
                gap: 0;
                color: #fff;
                font-size: 13px;
                border-top: 1px solid rgba(255,255,255,0.06);
                padding: 0;
            }
            .modal_info_header {
                display: flex;
                gap: 10px;
                align-items: center;
                flex-wrap: wrap;
            }
            .modal_text {
                width: 100%;
                min-width: 0;
                margin-bottom: 0;
            }
            .prompt_box {
                max-height: 180px;
                overflow-y: auto;
                padding: 10px 12px;
                border-radius: 8px;
                background: rgba(255,255,255,0.05);
                border: 1px solid rgba(255,255,255,0.08);
                margin-top: 8px;
                font-size: 13px;
                line-height: 1.4;
                white-space: pre-wrap;
                word-break: break-word;
            }
            .modal_copy_btn_wrap {
                width: 100%;
                display: flex;
                justify-content: flex-start;
                margin-top: 8px;
            }
            #copyPromptBtn {
                align-self: flex-start;
                padding: 8px 16px;
                font-size: 13px;
                border-radius: 6px;
                border: 1px solid rgba(255,255,255,0.15);
                background: rgba(0,0,0,0.6);
                color: #fff;
                cursor: pointer;
                margin: 0;
            }
            /* Disable iOS long-press context menu */
            body{ -webkit-touch-callout: none; }

            html, body {
                background-color: var(--black);
                margin: 0;
                padding: 0;
            }

            /* Page Layout */
            .main_content {
                background-color: var(--black);
                width: 100%;
                max-width: 1600px;
                padding: 20px 60px;
                padding-top: 20px;
                margin: 0 auto;
                box-sizing: border-box;
                display: flex;
                flex-direction: column;
            }

            .section-large-title {
                color: var(--text-primary);
                padding: 16px 0;
                margin: 0 auto;
                max-width: 1200px;
                width: 100%;
                box-sizing: border-box;
                font-size: 36px;
                font-weight: 900;
            }

            .section-mini-title {
                color: var(--text-primary);
                padding: 12px 0;
                margin: 0 auto;
                max-width: 1200px;
                width: 100%;
                box-sizing: border-box;
                font-size: 16px;
                font-weight: 900;
            }

            .section-subtitle {
                color: var(--text-secondary);
                padding: 0 0 20px;
                margin: 0 auto;
                max-width: 1200px;
                width: 100%;
                box-sizing: border-box;
                font-size: 14px;
                line-height: 1.5;
            }

            /* ===== Featured Concepts Section ===== */
            /* 창문 역할: 보이는 영역만 표시 */
            .featured-grid {
                width: 100%;
                max-width: 1200px;
                position: relative;
                display: block;
                margin: 0 auto;
            }

            /* 그리드 레이아웃 */
            .featured-container {
                width: 100%;
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 10px;
                margin-bottom: 20px;
            }

            .featured-item {
                position: relative;
                border-radius: 10px;
                overflow: hidden;
                box-shadow: 0 0 5px rgba(255,255,255,0.2);
                cursor: pointer;
                background: #111;
                transition: transform 0.15s ease;
            }

            .featured-item:hover {
                transform: translateY(-4px);
            }

            .featured-item img {
                width: 100%;
                height: 220px;
                display: block;
                object-fit: cover;
                border-radius: 10px;
                transition: transform 0.15s ease;
            }

            .featured-item h3 {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 50px;
                padding: 0 12px;
                margin: 0;
                color: #fff;
                font-size: 13px;
                font-weight: 700;
                text-shadow: 0 1px 3px rgba(0,0,0,0.5);
                z-index: 2;
            }


            .featured-item p {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                padding: 70px 12px 8px 12px;
                margin: 0;
                background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.75));
                color: #fff;
                font-size: 11px;
                line-height: 1.3;
                opacity: 0.85;
                z-index: 1;
                max-height: 40px;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
            }

            .featured-item .view-more-btn,
            .community-item-info .view-more-btn {
                position: absolute;
                right: 12px;
                bottom: 8px;
                padding: 0;
                color: #fff;
                opacity: 1;
                z-index: 3;
                background: transparent;
                border: none;
                font-size: 11px;
                font-weight: 900;
                display: flex;
                align-items: center;
                gap: 4px;
                cursor: pointer;
                transition: none;
            }

            /* Arrow Navigation Buttons */
            .arrow-btn {
                display: none;
            }

            /* ===== Community Showcase Section ===== */
            .community-section {
                width: 100%;
                max-width: 1200px;
                padding: 16px 0;
                margin: 8px auto;
                box-sizing: border-box;
            }

            .community-header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 24px;
                gap: 16px;
            }

            .community-title {
                color: var(--text-primary);
                font-size: 16px;
                font-weight: 900;
                margin: 0;
                display: flex;
                align-items: center;
                gap: 8px;
                flex-shrink: 0;
            }

            .community-controls {
                display: flex;
                align-items: center;
                gap: 12px;
                margin-left: auto;
            }

            /* Search Input */

            .search-box {
                background: rgba(0, 0, 0, 0.65);
                border: 1px solid rgba(255,255,255,0.15);
                border-radius: 8px;
                padding: 10px 12px;
                color: var(--text-muted);
                font-size: 12px;
                outline: none;
                width: 200px;
                transition: border-color 0.2s, color 0.2s, background 0.2s;
            }


            .search-box:focus {
                border: 1px solid rgba(255,255,255,0.15);
                color: #fff;
                background: rgba(0, 0, 0, 0.65);
                outline: none;
            }

            .search-box::placeholder {
                color: var(--text-muted2);
            }

            /* Filter Buttons */
            .filter-tabs {
                display: flex;
                gap: 8px;
            }


            .filter-btn {
                background: rgba(0, 0, 0, 0.65);
                border: 1px solid rgba(255,255,255,0.15);
                color: var(--text-muted);
                padding: 8px 14px;
                border-radius: 6px;
                cursor: pointer;
                font-size: 12px;
                font-weight: 900;
                transition: all 0.2s;
            }


            .filter-btn:hover {
                color: var(--text-primary);
                background: rgba(109, 99, 255, 0.18);
            }


            .filter-btn.active {
                background: rgba(0, 0, 0, 0.65);
                border: 1px solid rgba(255,255,255,0.15);
                color: #fff;
                font-weight: 900;
                outline: none;
                box-shadow: none;
                text-shadow: none;
            }

            /* Community Grid */
            .community-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 10px;
                width: 100%;
                margin-bottom: 20px;
            }

            .mobile-scroll-remote {
                display: none;
            }

            .community-item {
                position: relative;
                border-radius: 10px;
                overflow: hidden;
                box-shadow: 0 0 5px rgba(255,255,255,0.2);
                cursor: pointer;
                background: #111;
                transition: transform 0.15s ease;
            }

            .community-item:hover {
                transform: translateY(-4px);
            }

            .community-item-badge {
                position: absolute;
                left: 10px;
                top: 10px;
                background: rgba(0,0,0,0.65);
                border: 1px solid rgba(255,255,255,0.15);
                padding: 6px 10px;
                border-radius: 999px;
                color: #fff;
                font-size: 12px;
                display: flex;
                gap: 8px;
                align-items: center;
            }

            .community-item img {
                width: 100%;
                height: 220px;
                display: block;
                object-fit: cover;
                border-radius: 10px;
                transition: transform 0.15s ease;
            }

            .community-item-info {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                padding: 10px 12px;
                background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.75));
                color: #fff;
                font-size: 13px;
            }

            .community-item-author {
                display: flex;
                align-items: center;
                gap: 8px;
                margin-bottom: 10px;
            }

            .author-avatar {
                width: 28px;
                height: 28px;
                border-radius: 50%;
                background: linear-gradient(135deg, #6d63ff, #8b7dff);
                flex-shrink: 0;
            }

            .author-name {
                color: #fff;
                font-size: 12px;
                margin: 0;
                font-weight: 600;
            }

            .community-item-desc {
                color: #fff;
                font-size: 13px;
                margin: 0 0 8px 0;
                line-height: 1.4;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                max-width: 70%;
                text-align: left;
            }

            /* View More Button */


            .view-more-btn:hover {
                color: #fff;
            }

            /* ✅ 무한 스크롤 sentinel 로딩 인디케이터 */
            #communityLoadingIndicator {
                display: none;
                text-align: center;
                padding: 24px 0;
                color: rgba(255,255,255,0.45);
                font-size: 13px;
                grid-column: 1 / -1;
            }
            #communityLoadingIndicator.show { display: block; }

            /* ===== Responsive Design ===== */
            @media screen and (max-width: 1400px) {
                .featured-container {
                    grid-template-columns: repeat(3, 1fr);
                }
                
                .community-grid {
                    grid-template-columns: repeat(3, 1fr);
                }
            }

            @media screen and (max-width: 1024px) {
                .featured-container {
                    grid-template-columns: repeat(2, 1fr);
                }

                .community-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .search-box {
                    width: 160px;
                }
            }

            @media screen and (max-width: 767px) {
                .modal_viewer {
                    height: clamp(220px, 36vh, 320px);
                }

                #historyModalDescription.prompt_box {
                    box-sizing: border-box;
                    line-height: 1.4;
                    height: calc(1.4em * 3 + 20px);
                    max-height: calc(1.4em * 3 + 20px);
                    overflow-y: auto;
                }

                .main_content {
                    width: 100%;
                    padding: 16px 24px;
                    box-sizing: border-box;
                }

                .featured-container {
                    grid-template-columns: 1fr;
                }

                .community-section {
                    margin: 0 0 16px 0;
                    padding: 16px 0;
                }

                .community-header {
                    flex-direction: column;
                    align-items: stretch;
                    margin-bottom: 16px;
                }

                .community-controls {
                    width: 100%;
                    margin-left: 0;
                    flex-direction: column;
                }

                .search-box {
                    width: 100%;
                }

                .filter-tabs {
                    width: 100%;
                }

                .filter-btn {
                    flex: 1;
                }

                .community-grid {
                    grid-template-columns: 1fr;
                }

                .mobile-scroll-remote {
                    position: fixed;
                    left: 10px;
                    bottom: 14px;
                    z-index: 1200;
                    display: flex;
                    flex-direction: column;
                    gap: 6px;
                }

                .mobile-scroll-remote-btn {
                    width: 28px;
                    height: 28px;
                    min-width: 28px;
                    min-height: 28px;
                    border: 1px solid rgba(255,255,255,0.22);
                    border-radius: 999px;
                    background: rgba(20, 20, 28, 0.72);
                    color: #f0f0f5;
                    font-size: 12px;
                    font-weight: 700;
                    line-height: 1;
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;
                    padding: 0;
                }

                .mobile-scroll-remote-btn:active {
                    transform: scale(0.96);
                    background: rgba(55, 55, 72, 0.86);
                }
            }
