/* 用戶列表模態框樣式 - Instagram 風格 */

/* 全螢幕模態框樣式 */
.user-list-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white, #ffffff);
    z-index: 9999;
    display: none;
    overflow-y: auto;
}

.user-list-modal-overlay.show {
    display: block;
}

.user-list-modal-content {
    width: 100%;
    height: 100%;
    background: var(--white, #ffffff);
}

.user-list-modal-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--white, #ffffff);
    min-height: 100vh;
}

/* 模態框頭部 */
.modal-header {
    border-bottom: 1px solid var(--border-light, #e9ecef);
    padding: 0;
    background: var(--white, #ffffff);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.modal-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
}


.title-section {
    flex: 1;
    text-align: center;
}

.title-section h1 {
    font-weight: 600;
    color: var(--text-primary, #212529);
    font-size: 1.1rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--primary, #007bff);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.close-btn:hover {
    background: var(--bg-light, #f8f9fa);
    transform: translateY(-1px);
}

/* 頂部導航 Tabs */
.modal-tabs {
    display: flex;
    background: var(--white, #ffffff);
    border-bottom: 1px solid var(--border-light, #e9ecef);
    position: sticky;
    top: 0;
    z-index: 999;
}

.modal-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary, #6c757d);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.modal-tab:hover {
    color: var(--text-primary, #212529);
    background: var(--light, #f8f9fa);
}

.modal-tab.active {
    color: var(--text-primary, #212529);
    font-weight: 600;
}

.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--primary, #007bff);
    border-radius: 1px;
}

.tab-count {
    font-size: 0.8rem;
    color: var(--text-muted, #6c757d);
    font-weight: 400;
}

.modal-tab.active .tab-count {
    color: var(--text-secondary, #6c757d);
}

/* 模態框內容 */
.modal-body {
    padding: 0;
    background: var(--white, #ffffff);
}

/* 搜尋區域 */
.search-section {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light, #e9ecef);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted, #6c757d);
    font-size: 1rem;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.75rem;
    border: 2px solid var(--border-light, #e9ecef);
    border-radius: 12px;
    font-size: 0.95rem;
    background: var(--white, #ffffff);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary, #007bff);
    background: var(--white, #ffffff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: var(--text-muted, #6c757d);
    font-weight: 400;
}

.search-clear {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted, #6c757d);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    color: var(--danger, #dc3545);
    transform: scale(1.1);
}

/* 分類區域 */
.categories-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light, #e9ecef);
    background: var(--white, #ffffff);
}

.section-title {
    font-weight: 600;
    color: var(--text-primary, #212529);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-item:hover {
    background: var(--light, #f8f9fa);
}

.category-avatar-container {
    position: relative;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

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

.category-icon {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--primary, #007bff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6rem;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-title {
    font-weight: 500;
    color: var(--text-primary, #212529);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.category-description {
    font-size: 0.8rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.3;
}

/* 排序區域 */
.sorting-section {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light, #e9ecef);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.sorting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sorting-button {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid var(--border-light, #e9ecef);
    color: var(--text-secondary, #6c757d);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 40px;
}

.sorting-button:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: var(--text-primary, #212529);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sorting-button i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.sorting-button.active i {
    transform: rotate(180deg);
}

/* 排序下拉選單 */
.sorting-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white, #ffffff);
    border: 1px solid var(--border-light, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1001;
    min-width: 220px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.sorting-options {
    display: flex;
    flex-direction: column;
}

.sorting-option {
    background: none;
    border: none;
    padding: 1rem 1.25rem;
    text-align: left;
    color: var(--text-primary, #212529);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid var(--border-light, #e9ecef);
}

.sorting-option:last-child {
    border-bottom: none;
}

.sorting-option:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--primary, #007bff);
    transform: translateX(4px);
}

.sorting-option i {
    color: var(--text-muted, #6c757d);
    width: 20px;
    transition: color 0.3s ease;
}

.sorting-option:hover i {
    color: var(--primary, #007bff);
}

/* 載入狀態 */
#loadingState {
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin: 1rem;
}

#loadingState .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary, #007bff);
    border-width: 0.25rem;
}

#loadingState p {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--text-secondary, #6c757d);
    font-weight: 500;
}

/* 用戶列表容器 */
.user-list {
    min-height: 200px;
}

/* 用戶項目樣式 */
.user-item {
    display: flex;
    align-items: center;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light, #e9ecef);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: var(--white, #ffffff);
}

.user-item:last-child {
    border-bottom: none;
}

.user-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary, #007bff) 0%, var(--primary-light, #4da6ff) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-item:hover::before {
    opacity: 1;
}

/* 用戶頭像容器 */
.user-avatar-container {
    position: relative;
    margin-right: 1rem;
    flex-shrink: 0;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.user-avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--success, #28a745);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6rem;
    border: 2px solid var(--white, #ffffff);
}

/* 用戶資訊 */
.user-info {
    flex: 1;
    min-width: 0;
    margin-right: 1rem;
}

.user-name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.user-name {
    font-weight: 700;
    color: var(--text-primary, #212529);
    font-size: 1rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.user-verified-badge {
    color: var(--primary, #007bff);
    font-size: 0.8rem;
}

.user-secondary-name {
    font-size: 0.85rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
    opacity: 0.8;
}

/* 用戶操作按鈕 */
.user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.action-btn {
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 36px;
}



.follow-btn {
    background: linear-gradient(135deg, var(--primary, #007bff) 0%, var(--primary-light, #4da6ff) 100%);
    color: white;
    border: 1px solid var(--primary, #007bff);
}

.follow-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark, #0056b3) 0%, var(--primary, #007bff) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.remove-btn {
    background: none;
    color: var(--text-muted, #6c757d);
    padding: 0.6rem;
    border-radius: 50%;
    min-width: 36px;
    height: 36px;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.remove-btn:hover {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    color: var(--danger, #dc3545);
    border-color: var(--danger-light, #feb2b2);
    transform: scale(1.05);
}

/* 分頁樣式 */
#paginationContainer {
    margin-top: 1rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-light, #e9ecef);
    background: var(--white, #ffffff);
}

.pagination {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pagination .page-link {
    border: none;
    color: var(--text-secondary, #6c757d);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    min-width: 44px;
    text-align: center;
    background: var(--light, #f8f9fa);
    border: 1px solid transparent;
}

.pagination .page-link:hover {
    background: linear-gradient(135deg, var(--primary, #007bff) 0%, var(--primary-light, #4da6ff) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    border-color: var(--primary, #007bff);
}

.pagination .page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.pagination .page-link.active {
    background: linear-gradient(135deg, var(--primary, #007bff) 0%, var(--primary-light, #4da6ff) 100%);
    color: white;
    border-color: var(--primary, #007bff);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.pagination .page-item.disabled .page-link {
    background: var(--light, #f8f9fa);
    color: var(--text-muted, #6c757d);
    cursor: not-allowed;
}

.pagination .page-item.disabled .page-link:hover {
    background: var(--light, #f8f9fa);
    color: var(--text-muted, #6c757d);
    transform: none;
}

.page-info {
    background: var(--light, #f8f9fa) !important;
    color: var(--text-secondary, #6c757d) !important;
    font-weight: 500;
    cursor: default;
}

.page-info:hover {
    background: var(--light, #f8f9fa) !important;
    color: var(--text-secondary, #6c757d) !important;
    transform: none !important;
}

/* 空狀態樣式 */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin: 1rem;
}

.empty-state i {
    color: var(--text-muted, #6c757d);
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.empty-state h6 {
    color: var(--text-secondary, #6c757d);
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.empty-state p {
    color: var(--text-muted, #6c757d);
    font-size: 0.95rem;
    margin: 0;
    opacity: 0.8;
}

/* 錯誤狀態樣式 */
.error-state {
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-radius: 12px;
    margin: 1rem;
    border: 1px solid var(--danger-light, #feb2b2);
}

.error-state i {
    color: var(--danger, #dc3545);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.error-state h6 {
    color: var(--danger, #dc3545);
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.error-state p {
    color: var(--text-muted, #6c757d);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.retry-btn {
    border-color: var(--danger, #dc3545);
    color: var(--danger, #dc3545);
    background: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.retry-btn:hover {
    background: linear-gradient(135deg, var(--danger, #dc3545) 0%, var(--danger-dark, #c82333) 100%);
    border-color: var(--danger, #dc3545);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* 動畫效果 */
.user-item {
    animation: fadeInUp 0.3s ease-out;
}

.category-item {
    animation: fadeInLeft 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 載入動畫 */
.spinner-border {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滾動條樣式 */
.user-list-modal-overlay::-webkit-scrollbar {
    width: 4px;
}

.user-list-modal-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.user-list-modal-overlay::-webkit-scrollbar-thumb {
    background: var(--border-light, #e9ecef);
    border-radius: 2px;
}

.user-list-modal-overlay::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #6c757d);
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .user-list-modal-overlay {
        background: var(--dark, #212529);
        color: var(--light, #f8f9fa);
    }
    
    .user-list-modal-container {
        background: var(--dark, #212529);
    }
    
    .modal-header {
        background: var(--dark, #212529);
        border-bottom-color: var(--border-dark, #495057);
    }
    
    .search-input {
        background: var(--dark-light, #343a40);
        border-color: var(--border-dark, #495057);
        color: var(--light, #f8f9fa);
    }
    
    .search-input:focus {
        background: var(--dark, #212529);
        border-color: var(--primary, #007bff);
    }
    
    .category-item:hover,
    .user-item:hover {
        background: var(--dark-light, #343a40);
    }
    
    .sorting-dropdown {
        background: var(--dark, #212529);
        border-color: var(--border-dark, #495057);
    }
    
    .sorting-option:hover {
        background: var(--dark-light, #343a40);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .user-list-modal-container {
        max-width: 100%;
        margin: 0;
    }
    
    .modal-header-content {
        padding: 0.75rem;
    }
    
    .title-section h1 {
        font-size: 1rem;
    }
    
    .search-section {
        padding: 1rem 0.75rem;
    }
    
    .modal-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}
