/* ==================== 0. Premium UI (scrollbar & scroll-progress) ==================== */
/* 커스텀 스크롤바 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.2);
    border-radius: 5px;
    border: 2px solid var(--color-bg-dark);
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.5);
}

/* 스크롤 진행 바 */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 2000;
    pointer-events: none;
}

.scroll-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    box-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.5);
    transition: width 0.1s ease-out;
}

/* ==================== 6. 공통 컴포넌트 (계속) ==================== */
/* 뱃지 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid;
}

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    border: none;
}

/* 검색 컨트롤 */
.search-controls {
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 900;
    /* 네비바(1000)보다 낮게 설정하여 드롭다운이 겹치지 않게 함 */
    overflow: visible !important;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    position: relative;
    flex: 1;
    overflow: visible !important;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 3.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    border-radius: 2rem;
    color: var(--color-text-white);
    font-size: 1rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.clear-search-btn {
    display: none;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.clear-search-btn:hover {
    color: var(--color-text-white);
    background: rgba(255, 255, 255, 0.1);
}

.sort-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    border-radius: 2rem;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    min-width: 150px;
    z-index: 1000;
}

.sort-dropdown:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(var(--color-primary-rgb), 0.4);
    box-shadow: 0 0 20px rgba(var(--color-primary-rgb), 0.15);
    z-index: 1001;
}

.sort-dropdown.active {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 25px rgba(var(--color-primary-rgb), 0.2);
    z-index: 1002;
}

.sort-icon {
    color: var(--color-primary);
    font-size: 1.25rem;
}

.selected-label {
    flex: 1;
    color: var(--color-text-white);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 1.25rem;
    color: var(--color-text-gray);
    transition: transform 0.3s ease;
}

.sort-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--color-primary);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: 100%;
    background: var(--color-bg-card-hover);
    border: 1px solid rgba(var(--color-primary-rgb), 0.3);
    border-radius: 1.25rem;
    padding: 0.5rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    list-style: none;
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    z-index: 10000;
}

.sort-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-option {
    padding: 0.75rem 1rem;
    border-radius: 0.875rem;
    color: var(--color-text-gray);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-option:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
}

.dropdown-option.active {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary);
    font-weight: 700;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-bg-dark);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-text-white);
}

.btn-blue {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-blue:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-orange {
    background: #f59e0b;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-orange:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* 카드 */
.card {
    background: var(--color-bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

/* 글로우 효과 (JS 연동) */
.software-card::before,
.btn-primary::before,
.cta-primary::before,
.cta-secondary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(400px circle at var(--mouse-x, 0) var(--mouse-y, 0),
            rgba(var(--color-primary-rgb), 0.08),
            transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 1;
}

.software-card:hover::before,
.btn-primary:hover::before,
.cta-primary:hover::before,
.cta-secondary:hover::before {
    opacity: 1;
}

.card:hover {
    background: var(--color-bg-card-hover);
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(var(--color-primary-rgb), 0.1);
}

/* ==================== 10. 색상 유틸리티 클래스 ==================== */
/* 텍스트 색상 */
.text-primary {
    color: var(--color-primary) !important;
}

.text-secondary {
    color: #8b5cf6 !important;
}

.text-success {
    color: #10b981 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.text-danger {
    color: #ef4444 !important;
}

/* 배경 색상 (투명도 포함) */
.bg-primary\/10 {
    background-color: rgba(54, 226, 123, 0.1) !important;
}

.bg-secondary\/10 {
    background-color: rgba(139, 92, 246, 0.1) !important;
}

.bg-success\/10 {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.bg-warning\/10 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.bg-danger\/10 {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* 테두리 색상 (투명도 포함) */
.border-primary\/20 {
    border-color: rgba(54, 226, 123, 0.2) !important;
}

.border-secondary\/20 {
    border-color: rgba(139, 92, 246, 0.2) !important;
}

.border-success\/20 {
    border-color: rgba(16, 185, 129, 0.2) !important;
}

.border-warning\/20 {
    border-color: rgba(245, 158, 11, 0.2) !important;
}

.border-danger\/20 {
    border-color: rgba(239, 68, 68, 0.2) !important;
}

/* ==================== 커뮤니티 위젯 스타일 ==================== */
.community-widget-section {
    margin-top: 4rem;
}

.community-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.community-widget-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.view-all-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.view-all-link:hover {
    gap: 0.5rem;
}

.community-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.widget-post-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.widget-post-card:hover {
    background: rgba(54, 226, 123, 0.05);
    border-color: rgba(54, 226, 123, 0.2);
    transform: translateY(-2px);
}

.widget-post-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.widget-author-emoji {
    font-size: 1.5rem;
}

.widget-author-name {
    font-weight: 600;
    color: var(--color-text-white);
}

.widget-post-content {
    color: var(--color-text-gray);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text-gray);
    font-size: 0.9rem;
}

.no-posts-widget {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--color-text-gray);
}

.text-gray {
    color: var(--color-text-gray);
    font-size: 0.9rem;
}

/* 글쓰기 버튼 */
.community-write-section {
    margin-top: 2rem;
}

.widget-write-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(54, 226, 123, 0.3);
    border-radius: 0.75rem;
    color: var(--color-text-gray);
    cursor: pointer;
    transition: all 0.3s;
}

.widget-write-btn:hover {
    background: rgba(54, 226, 123, 0.1);
    border-color: rgba(54, 226, 123, 0.5);
    color: #36e27b;
}

/* 커뮤니티 모달 */
.community-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.community-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.community-modal-content {
    position: relative;
    background: rgba(15, 30, 25, 0.95);
    border: 1px solid rgba(54, 226, 123, 0.2);
    border-radius: 1.5rem;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.community-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-gray);
    transition: all 0.2s;
}

.community-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.community-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.community-modal-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
}

.community-form-group {
    margin-bottom: 1.5rem;
}

.community-form-group label {
    display: block;
    color: #fff;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.community-form-group input,
.community-form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

.community-form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.community-form-group input:focus,
.community-form-group textarea:focus {
    outline: none;
    border-color: #36e27b;
    background: rgba(255, 255, 255, 0.08);
}

.char-counter {
    text-align: right;
    color: var(--color-text-gray);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.community-submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #36e27b 0%, #2bc766 100%);
    color: #0a1612;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s;
}

.community-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(54, 226, 123, 0.4);
}

.community-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 스피너 애니메이션 */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 폼 레이아웃 */
.form-group {
    margin-bottom: 1.5rem;
}

/* 글 유형 선택 */
.type-selector {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.type-option {
    flex: 1;
    cursor: pointer;
}

.type-option input[type="radio"] {
    display: none;
}

.type-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(26, 44, 34, 0.4);
    border: 1px solid rgba(54, 226, 123, 0.2);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    color: var(--color-text-gray);
}

.type-icon {
    font-size: 1.2rem;
}

.type-text {
    font-weight: 500;
}

.type-option:hover .type-label {
    border-color: rgba(54, 226, 123, 0.4);
    background: rgba(26, 44, 34, 0.6);
}

.type-option input[type="radio"]:checked+.type-label {
    background: rgba(54, 226, 123, 0.15);
    border-color: var(--color-primary);
    color: var(--color-text-white);
    box-shadow: 0 0 15px rgba(54, 226, 123, 0.2);
}

/* 반응형 */
@media (max-width: 768px) {
    .community-widget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .community-modal-content {
        padding: 2rem 1.5rem;
    }
}

/* 개인정보보호 링크 스타일 */
.privacy-link {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: all 0.2s;
}

.privacy-link:hover {
    color: var(--color-primary-light);
    text-shadow: 0 0 10px rgba(54, 226, 123, 0.4);
}

/* ==================== 10. 테마 선택 UI ==================== */
/* 테마 토글 버튼 */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--color-text-gray);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1001;
}

.theme-toggle-btn:hover,
.theme-toggle-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-primary);
}

.theme-toggle-btn .material-symbols-outlined {
    font-size: 1.5rem;
}

/* 테마 드롭다운 메뉴 */
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 1rem;
    background: var(--color-bg-card-hover);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1002;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.theme-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-white);
    font-weight: 600;
    font-size: 0.95rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: transparent;
    border: none;
    color: var(--color-text-gray);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-white);
}

.theme-option.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.theme-color-preview {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.theme-option.active .theme-color-preview {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

/* ==================== 11. Premium Toast Notification ==================== */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    position: relative;
    min-width: 320px;
    max-width: 450px;
    padding: 1.25rem 1.5rem;
    background: rgba(15, 30, 25, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateX(120%);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: var(--color-text-white);
}

.toast-message {
    font-size: 0.9rem;
    color: var(--color-text-gray);
    line-height: 1.5;
}

/* Toast Types */
.toast-success::before {
    background: var(--color-primary);
}

.toast-success .toast-icon {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
}

.toast-error::before {
    background: #ff4757;
}

.toast-error .toast-icon {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.toast-warning::before {
    background: #ffa502;
}

.toast-warning .toast-icon {
    background: rgba(255, 165, 2, 0.1);
    color: #ffa502;
}

.toast-info::before {
    background: #70a1ff;
}

.toast-info .toast-icon {
    background: rgba(112, 161, 255, 0.1);
    color: #70a1ff;
}

/* Progress Bar in Toast */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: currentColor;
    opacity: 0.5;
}