/**
 * Page-specific Styles
 * 页面特定样式
 */

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: var(--z-sticky);
    border-bottom: 1px solid var(--border-secondary);
}

.page-header-center {
    justify-content: center;
}

.page-title {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.back-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.header-actions a,
.header-actions button {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ===== Profile Page ===== */
.profile-container {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 20px);
}

.profile-header {
    padding: 24px 20px;
    text-align: center;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 0 auto 16px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--douyin-pink), var(--douyin-cyan));
    padding: 3px;
}

.profile-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-username {
    font-size: var(--font-xxl);
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.profile-id {
    color: var(--text-tertiary);
    font-size: var(--font-base);
    margin-bottom: 12px;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: var(--font-base);
    margin-bottom: 16px;
    line-height: 1.5;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--font-sm);
    color: var(--text-tertiary);
}

.edit-profile-btn {
    display: inline-block;
    padding: 10px 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-base);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.edit-profile-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-secondary);
    position: sticky;
    top: 56px;
    background: var(--bg-primary);
    z-index: 10;
}

.profile-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    font-size: var(--font-md);
    color: var(--text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.profile-tab.active {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.profile-tab svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 0;
}

.tab-content.active {
    display: block;
}

/* Settings List */
.settings-list {
    padding: 20px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-secondary);
}

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

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 2px;
}

.video-grid-item {
    aspect-ratio: 9/12;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.video-grid-item img,
.video-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Profile "Liked" tab: show full thumbnail (no crop) */
.tab-content#likes .video-grid-item {
    aspect-ratio: 9/16;
    background: #111;
}

.tab-content#likes .video-grid-item img,
.tab-content#likes .video-grid-item video {
    object-fit: contain;
    background: #111;
}

.video-grid-item .play-count {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-sm);
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.video-grid-item .play-count svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ===== Search Page ===== */
.search-container {
    min-height: 100vh;
    background: var(--bg-primary);
}

.search-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    z-index: var(--z-sticky);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-secondary);
}

.search-box {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--font-md);
}

.search-input::placeholder {
    color: var(--text-disabled);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.15);
}

.search-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}

.search-submit svg {
    width: 20px;
    height: 20px;
    fill: var(--text-tertiary);
}

.cancel-btn {
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-md);
    white-space: nowrap;
}

.search-content {
    padding: 68px 16px 20px;
}

/* Search Sections */
.search-section {
    margin-bottom: 24px;
}

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

.section-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.section-action {
    color: var(--text-tertiary);
    font-size: var(--font-sm);
    cursor: pointer;
}

/* Hot Search List */
.hot-search-list {
    list-style: none;
}

.hot-search-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    cursor: pointer;
}

.hot-rank {
    width: 24px;
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-tertiary);
}

.hot-rank.top-1 { color: #FF3B5C; }
.hot-rank.top-2 { color: #FF6B2C; }
.hot-rank.top-3 { color: #FFB800; }

.hot-content {
    flex: 1;
}

.hot-keyword {
    font-size: var(--font-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hot-badge {
    padding: 2px 6px;
    background: var(--douyin-pink);
    color: var(--text-primary);
    font-size: 10px;
    border-radius: 2px;
}

.hot-count {
    font-size: var(--font-sm);
    color: var(--text-disabled);
    margin-top: 2px;
}

/* Search History */
.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-tag {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.history-tag:active {
    background: rgba(255, 255, 255, 0.12);
}

/* Search Results */
.search-results {
    padding-top: 16px;
}

.result-tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-secondary);
}

.result-tab {
    padding: 12px 0;
    font-size: var(--font-md);
    color: var(--text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.result-tab.active {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ===== Friends Page ===== */
.friends-container {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

.friends-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
    text-align: center;
}

.friends-empty svg {
    width: 80px;
    height: 80px;
    fill: rgba(255, 255, 255, 0.15);
    margin-bottom: 20px;
}

.friends-empty h2 {
    font-size: var(--font-xxl);
    color: var(--text-primary);
    margin-bottom: 12px;
}

.friends-empty p {
    color: var(--text-tertiary);
    font-size: var(--font-base);
    margin-bottom: 24px;
}

/* ===== Messages Page ===== */
.messages-container {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

.message-list {
    padding: 0;
}

.message-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.message-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.message-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-username {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-preview {
    font-size: var(--font-sm);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-meta {
    text-align: right;
    flex-shrink: 0;
}

.message-time {
    font-size: var(--font-sm);
    color: var(--text-disabled);
    margin-bottom: 4px;
}

.message-badge {
    width: 20px;
    height: 20px;
    background: var(--douyin-pink);
    border-radius: 50%;
    font-size: 11px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* ===== Upload Page ===== */
/* Allow scrolling on upload page (base.css hides overflow globally) */
html,
body.upload-page {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-primary);
}

.upload-container {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    margin: 20px;
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-area:hover {
    border-color: var(--douyin-pink);
    background: rgba(254, 44, 85, 0.05);
}

.upload-area svg {
    width: 64px;
    height: 64px;
    fill: var(--text-tertiary);
    margin-bottom: 16px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: var(--font-md);
    margin-bottom: 8px;
}

.upload-area span {
    color: var(--text-disabled);
    font-size: var(--font-sm);
}

/* Hashtag links */
.hashtag {
    color: var(--douyin-cyan);
    text-decoration: none;
    font-weight: 600;
}

.hashtag:hover {
    text-decoration: underline;
}

/* ===== Common Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    border-radius: var(--radius-sm);
    font-size: var(--font-md);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--douyin-pink);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: #ff4d73;
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--douyin-pink);
    border: 1px solid var(--douyin-pink);
}

.btn-outline:hover {
    background: rgba(254, 44, 85, 0.1);
}

/* ===== Desktop Search Page Overrides ===== */
@media (min-width: 1024px) {
    /* Search page uses its own header, not desktop nav */
    .search-container {
        background: var(--bg-secondary);
        min-height: 100vh;
    }

    .search-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-primary);
        padding: 16px 24px;
        z-index: 100;
    }

    .search-box {
        max-width: 600px;
    }

    .search-input {
        background: #f1f2f3;
        color: var(--text-primary);
        border: 1px solid transparent;
        border-radius: 8px;
    }

    .search-input:focus {
        background: #ffffff;
        border-color: var(--border-primary);
    }

    .search-input::placeholder {
        color: var(--text-tertiary);
    }

    .search-submit svg {
        fill: var(--text-secondary);
    }

    .search-content {
        padding: 80px 24px 40px;
        max-width: 1000px;
        margin: 0 auto;
    }

    .section-title,
    .hot-keyword,
    .hot-search-item {
        color: var(--text-primary);
    }

    .hot-rank {
        color: var(--text-tertiary);
    }

    .section-action {
        color: var(--text-tertiary);
    }

    .history-tag {
        background: rgba(22, 24, 35, 0.06);
        color: var(--text-secondary);
    }

    .history-tag:hover {
        background: rgba(22, 24, 35, 0.1);
    }

    .result-tabs {
        border-bottom-color: var(--border-primary);
    }

    .result-tab {
        color: var(--text-tertiary);
    }

    .result-tab.active {
        color: var(--text-primary);
        border-color: var(--text-primary);
    }

    .back-btn {
        color: var(--text-primary);
    }

    .back-btn:hover {
        background: rgba(22, 24, 35, 0.06);
    }

    /* Search results grid - 4 columns on desktop */
    .search-results-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px !important;
    }

    .search-results-grid .video-grid-item {
        border-radius: 8px;
        overflow: hidden;
        position: relative;
        aspect-ratio: 9/16;
        background: #161823; /* Dark placeholder background */
    }

    .empty-state {
        color: var(--text-tertiary);
    }

    .empty-state svg {
        fill: var(--text-disabled);
    }

    /* Hot search list desktop */
    .hot-search-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .hot-search-item {
        text-decoration: none;
    }

    .hot-search-item:hover {
        background: rgba(22, 24, 35, 0.03);
        border-radius: 8px;
    }

    /* Search section spacing */
    .search-section {
        margin-bottom: 32px;
    }

    /* Play count overlay for search results */
    .search-results-grid .play-count {
        color: #fff;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }

    .search-results-grid .play-count svg {
        fill: #fff;
    }
}
