/* =========================
   Threads-Style Feed for Community
   Version: 6.7.3
   ========================= */

/* Feed Container */
.threads-feed-page {
    min-height: 100vh;
    background: var(--bg-white);
    padding-bottom: 60px; /* 하단 메뉴바 공간 */
}

/* Feed Header - 제거 */
/* .threads-feed-header { display: none; } */

/* Tabs */
.threads-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
    position: sticky;
    top: 0; /* 상단에 고정 */
    z-index: 99;
}

.threads-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.threads-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.threads-tab:hover {
    background: var(--bg-main);
}

/* Feed List */
.threads-feed-list {
    max-width: 100%; /* 모바일 전체 너비 */
    margin: 0;
    padding: 0;
}

@media (min-width: 768px) {
    .threads-feed-list {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Post Card */
.threads-post-card {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 16px;
    transition: background 0.2s;
    cursor: pointer;
}

.threads-post-card:hover {
    background: var(--bg-main);
}

/* Post Header (1줄) */
.threads-post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.threads-post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.threads-post-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.threads-post-time {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Follow Button in Header */
.threads-follow-btn {
    margin-left: auto; /* 오른쪽 정렬 */
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.threads-follow-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.threads-follow-btn.following {
    background: var(--border-light);
    color: var(--text-secondary);
}

.threads-follow-btn.following:hover {
    background: #e74c3c;
    color: white;
}

/* 이전 author-info 스타일 제거 */
.threads-post-author-info {
    display: none;
}

/* Post Content */
.threads-post-content {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.threads-post-content a {
    color: var(--primary);
    text-decoration: underline;
}

/* Post Media (Thumbnail in Feed - 16:9 Ratio) */
.threads-post-media {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 320px; /* 썸네일 최대 너비 */
    position: relative;
    cursor: pointer;
}

/* 16:9 비율 유지 */
.threads-post-media::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 9/16 = 0.5625 = 56.25% */
}

/* 돋보기 아이콘 */
.threads-post-media::after {
    content: '🔍';
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 2;
}

.threads-post-media:hover::after {
    opacity: 1;
}

.threads-post-media img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: opacity 0.2s;
}

.threads-post-media img:hover {
    opacity: 0.9;
}

.threads-post-media iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: none;
}

/* Post Actions Bar */
.threads-post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    padding-top: 8px;
}

.threads-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.threads-action-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.threads-action-btn .icon {
    font-size: 18px;
}

.threads-action-btn .count {
    font-weight: 500;
}

.threads-action-btn.has-count {
    color: var(--text-primary);
}

/* Emotion Reactions Display */
.threads-reactions-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.threads-reaction-emoji {
    font-size: 16px;
    line-height: 1;
}

/* Empty State */
.threads-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.threads-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.threads-empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.threads-empty-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Loading */
.threads-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Fixed Input at Bottom */
.threads-input-fixed {
    position: fixed;
    bottom: 56px; /* 하단 메뉴바 높이만큼 띄움 (56px) */
    left: 0;
    right: 0;
    background: var(--bg-white);
    padding: 8px 16px;
    z-index: 90;
    max-width: 100%;
}

@media (min-width: 768px) {
    .threads-input-fixed {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Input Wrapper - Bottom Sheet 스타일 */
.threads-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 6px 8px 6px 16px;
    transition: all 0.2s;
    height: 44px;
}

.threads-input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(74, 143, 181, 0.15);
}

/* 프로필 아바타 제거 */
.threads-input-avatar {
    display: none;
}

.threads-input-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.2;
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-primary);
    outline: none;
    padding: 0;
    height: 32px;
}

.threads-input-field:focus {
    outline: none;
}

.threads-input-field::placeholder {
    color: var(--text-secondary);
}

.threads-send-btn {
    min-width: 60px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(74, 143, 181, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.threads-send-btn:disabled {
    background: var(--bg-main);
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.threads-send-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 143, 181, 0.3);
}

.threads-send-btn:not(:disabled):active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .threads-feed-list {
        max-width: 100%;
    }
    
    .threads-post-card {
        padding: 12px;
    }
    
    .threads-post-content {
        font-size: 14px;
    }
}

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

.threads-post-card {
    animation: fadeInUp 0.3s ease;
}
