/* ========================================
   Profile Page Styles
   ======================================== */

.profile-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

/* ========== 個人資訊卡片 ========== */
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 28px;
    background: var(--bg-card, #fff);
    border-radius: 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary, #1f2937);
}

.profile-nickname-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
    margin: 0 0 8px;
    font-style: italic;
}

.profile-account {
    font-size: 1rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 12px;
}

.profile-school,
.profile-joined {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin: 6px 0;
}

.profile-school svg,
.profile-joined svg {
    opacity: 0.7;
}

/* 個人簡介 */
.profile-bio {
    font-size: 0.95rem;
    color: var(--text-primary, #374151);
    line-height: 1.6;
    margin: 12px 0;
    padding: 12px 16px;
    background: var(--bg-muted, #f3f4f6);
    border-radius: 8px;
    border-left: 3px solid var(--primary, #3b82f6);
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

/* 追蹤按鈕 */
.btn-follow {
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--primary, #3b82f6);
    background: var(--primary, #3b82f6);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-follow:hover {
    background: var(--primary-hover, #2563eb);
    transform: translateY(-1px);
}

.btn-follow.is-following {
    background: transparent;
    color: var(--primary, #3b82f6);
}

.btn-follow.is-following:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-follow.is-following:hover .follow-text::after {
    content: '取消追蹤';
}

.btn-follow.is-following:hover .follow-text {
    visibility: hidden;
    position: relative;
}

.btn-follow.is-following:hover .follow-text::after {
    visibility: visible;
    position: absolute;
    left: 0;
}

/* 分享名片按鈕 */
.btn-share-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-share-card:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--primary, #3b82f6);
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-hover, #2563eb);
    transform: translateY(-1px);
}

/* ========== 統計數據 ========== */
.profile-stats {
    display: flex;
    gap: 8px;
    padding: 20px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: 24px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.stat-item:hover {
    background: var(--bg-hover, #f3f4f6);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
}

/* ========== 頁籤導航 ========== */
.profile-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-item:hover {
    background: var(--bg-hover, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

.tab-item.active {
    background: var(--primary, #3b82f6);
    color: #fff;
}

.tab-item svg {
    opacity: 0.8;
}

/* ========== 內容區 ========== */
.profile-content {
    min-height: 300px;
}

/* 作品格線 */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.work-card {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e5e7eb);
    transition: all 0.2s ease;
}

.work-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.work-card-link {
    display: block;
    text-decoration: none;
}

.work-card-media {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--bg-input, #f3f4f6);
}

.work-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.work-card:hover .work-card-media img {
    transform: scale(1.05);
}

.work-card-body {
    padding: 14px;
}

.work-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 6px;
    line-height: 1.4;
}

.work-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.5;
}

.work-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-footer, #fafafa);
}

.work-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.work-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
}

.work-author-name {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
}

.work-stats {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
}

/* 作者格線 */
.authors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.author-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    text-decoration: none;
    transition: all 0.2s ease;
}

.author-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.author-account {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    margin: 0;
}

/* 粉絲列表 */
.followers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.follower-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card, #fff);
    border-radius: 10px;
    border: 1px solid var(--border-color, #e5e7eb);
}

.follower-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.follower-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.follower-name {
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.follower-date {
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted, #9ca3af);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary, #1f2937);
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0 0 20px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: transparent;
    color: var(--primary, #3b82f6);
    border: 1.5px solid var(--primary, #3b82f6);
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: var(--primary, #3b82f6);
    color: #fff;
}

/* 分頁導航 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding: 16px;
}

.page-link {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary, #3b82f6);
    text-decoration: none;
    border: 1px solid var(--border-color, #e5e7eb);
    transition: all 0.2s ease;
}

.page-link:hover {
    background: var(--primary, #3b82f6);
    color: #fff;
    border-color: var(--primary, #3b82f6);
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-muted, #6b7280);
}

/* ========== RWD ========== */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .profile-school,
    .profile-joined {
        justify-content: center;
    }
    
    .profile-bio {
        text-align: left;
    }
    
    .profile-actions {
        justify-content: center;
    }

    .profile-stats {
        flex-wrap: wrap;
    }

    .stat-item {
        flex: 0 0 calc(50% - 4px);
    }

    .profile-tabs {
        padding: 4px;
    }

    .tab-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .works-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 深色模式（使用 data-theme） ========== */
:root[data-theme="dark"] .profile-header,
:root[data-theme="dark"] .profile-stats,
:root[data-theme="dark"] .profile-tabs,
:root[data-theme="dark"] .work-card,
:root[data-theme="dark"] .author-card,
:root[data-theme="dark"] .follower-item {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(71, 85, 105, 0.5);
}

:root[data-theme="dark"] .profile-name,
:root[data-theme="dark"] .stat-value,
:root[data-theme="dark"] .work-card-title,
:root[data-theme="dark"] .author-name,
:root[data-theme="dark"] .follower-name,
:root[data-theme="dark"] .empty-state h3 {
    color: #f1f5f9;
}

:root[data-theme="dark"] .profile-account,
:root[data-theme="dark"] .profile-school,
:root[data-theme="dark"] .profile-joined,
:root[data-theme="dark"] .stat-label,
:root[data-theme="dark"] .work-card-desc,
:root[data-theme="dark"] .work-author-name,
:root[data-theme="dark"] .work-stats,
:root[data-theme="dark"] .author-account,
:root[data-theme="dark"] .follower-date,
:root[data-theme="dark"] .page-info,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .empty-state p {
    color: #94a3b8;
}

:root[data-theme="dark"] .profile-bio {
    background: rgba(51, 65, 85, 0.5);
    color: #e2e8f0;
}

:root[data-theme="dark"] .tab-item {
    color: #94a3b8;
}

:root[data-theme="dark"] .tab-item:hover {
    background: rgba(51, 65, 85, 0.6);
    color: #e2e8f0;
}

:root[data-theme="dark"] .tab-item.active {
    background: #3b82f6;
    color: #fff;
}

:root[data-theme="dark"] .stat-item:hover {
    background: rgba(51, 65, 85, 0.5);
}

:root[data-theme="dark"] .work-card-footer {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(71, 85, 105, 0.4);
}

:root[data-theme="dark"] .work-card-media {
    background: rgba(51, 65, 85, 0.5);
}

:root[data-theme="dark"] .work-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

:root[data-theme="dark"] .author-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

:root[data-theme="dark"] .btn-follow {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

:root[data-theme="dark"] .btn-follow.is-following {
    background: transparent;
    color: #60a5fa;
    border-color: #60a5fa;
}

:root[data-theme="dark"] .btn-follow.is-following:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #f87171;
    color: #f87171;
}

:root[data-theme="dark"] .btn-outline {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: #60a5fa;
}

:root[data-theme="dark"] .btn-outline:hover {
    background: #3b82f6;
    color: #fff;
}

:root[data-theme="dark"] .btn-share-card {
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

:root[data-theme="dark"] .btn-share-card:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
}

:root[data-theme="dark"] .page-link {
    background: rgba(30, 41, 59, 0.8);
    color: #60a5fa;
    border-color: rgba(71, 85, 105, 0.5);
}

:root[data-theme="dark"] .page-link:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
