/**
 * XTheme Components - Post Cards
 * 
 * 文章卡片样式
 */

/* ========================================
   发推区域
   ======================================== */
.xt-compose {
    display: flex;
    gap: var(--xt-space-3);
    padding: var(--xt-space-4);
    border-bottom: 1px solid var(--xt-border);
}

.xt-compose-avatar img {
    width: 40px;
    height: 40px;
    border-radius: var(--xt-radius-full);
}

.xt-compose-content {
    flex: 1;
}

.xt-compose-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--xt-text-primary);
    font-size: 1.125rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 80px;
}

.xt-compose-textarea::placeholder {
    color: var(--xt-text-secondary);
}

.xt-compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--xt-space-3);
    border-top: 1px solid var(--xt-border);
}

.xt-compose-tools {
    display: flex;
    align-items: center;
    gap: var(--xt-space-1);
}

.xt-compose-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--xt-radius-full);
    background: transparent;
    border: none;
    color: var(--xt-primary);
    cursor: pointer;
    transition: background-color var(--xt-transition-fast);
}

.xt-compose-tool:hover {
    background: var(--xt-primary-light);
}

.xt-compose-tool svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   文章卡片
   ======================================== */
.xt-posts {
    display: flex;
    flex-direction: column;
}

.xt-post {
    padding: var(--xt-space-4);
    border-bottom: 1px solid var(--xt-border);
    transition: background-color var(--xt-transition-fast);
    cursor: pointer;
}

.xt-post:hover {
    background-color: var(--xt-bg-hover);
}

.xt-post-header {
    display: flex;
    align-items: center;
    gap: var(--xt-space-3);
    margin-bottom: var(--xt-space-2);
}

.xt-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--xt-radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

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

.xt-post-author-info {
    display: flex;
    align-items: center;
    gap: var(--xt-space-2);
    flex-wrap: wrap;
}

.xt-post-author-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--xt-text-primary);
    text-decoration: none;
}

.xt-post-author-name:hover {
    text-decoration: underline;
}

.xt-post-meta {
    display: flex;
    align-items: center;
    gap: var(--xt-space-1);
    font-size: 0.875rem;
    color: var(--xt-text-secondary);
}

.xt-post-meta .dot {
    width: 2px;
    height: 2px;
    background-color: var(--xt-text-secondary);
    border-radius: var(--xt-radius-full);
}

.xt-post-content {
    margin-left: calc(40px + var(--xt-space-3));
}

.xt-post-text {
    font-size: 1rem;
    color: var(--xt-text-primary);
    line-height: 1.5;
    word-wrap: break-word;
}

.xt-post-text a {
    color: var(--xt-text-link);
}

.xt-post-text a:hover {
    text-decoration: underline;
}

.xt-post-image {
    margin-top: var(--xt-space-3);
    border-radius: var(--xt-radius-lg);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.xt-post-image img {
    width: 100%;
    height: auto;
    transition: transform var(--xt-transition);
}

.xt-post:hover .xt-post-image img {
    transform: scale(1.02);
}

/* 文章操作按钮 */
.xt-post-actions {
    display: flex;
    justify-content: space-between;
    max-width: 425px;
    margin-top: var(--xt-space-3);
    margin-left: calc(40px + var(--xt-space-3));
}

.xt-post-action {
    display: flex;
    align-items: center;
    gap: var(--xt-space-2);
    color: var(--xt-text-secondary);
    font-size: 0.875rem;
    padding: var(--xt-space-1) var(--xt-space-3);
    border-radius: var(--xt-radius-full);
    transition: all var(--xt-transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.xt-post-action svg {
    width: 18px;
    height: 18px;
}

.xt-post-action:hover {
    background-color: var(--xt-primary-light);
}

.xt-post-action.reply:hover,
.xt-post-action.comment:hover {
    color: var(--xt-primary);
}

.xt-post-action.repost:hover {
    color: #00BA7C;
    background-color: rgba(0, 186, 124, 0.1);
}

.xt-post-action.like:hover {
    color: #F91880;
    background-color: rgba(249, 24, 128, 0.1);
}

.xt-post-action.like.liked {
    color: #F91880;
}

.xt-post-action.like.liked svg {
    fill: currentColor;
}

.xt-post-action.share:hover {
    color: var(--xt-primary);
}

/* ========================================
   Toast 提示
   ======================================== */
.xt-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--xt-bg-secondary);
    border: 1px solid var(--xt-border);
    border-radius: var(--xt-radius-md);
    color: var(--xt-text-primary);
    font-size: 0.875rem;
    z-index: 9999;
    box-shadow: var(--xt-shadow-lg);
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.xt-toast-success {
    border-color: var(--xt-success);
}

.xt-toast-error {
    border-color: var(--xt-error);
}

.xt-toast-info {
    border-color: var(--xt-primary);
}

.xt-toast-warning {
    border-color: var(--xt-warning);
}

/* ========================================
   加载状态
   ======================================== */
.xt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--xt-space-8);
}

.xt-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--xt-border);
    border-top-color: var(--xt-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.xt-skeleton {
    background: linear-gradient(
        90deg,
        var(--xt-bg-secondary) 0%,
        var(--xt-bg-tertiary) 50%,
        var(--xt-bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease infinite;
    border-radius: var(--xt-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.xt-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.xt-skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.xt-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--xt-radius-full);
}

/* ========================================
   空状态
   ======================================== */
.xt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--xt-space-12) var(--xt-space-4);
    text-align: center;
    color: var(--xt-text-secondary);
}

.xt-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--xt-space-4);
    opacity: 0.5;
}

.xt-empty-icon svg {
    width: 100%;
    height: 100%;
}

.xt-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--xt-text-primary);
    margin-bottom: var(--xt-space-2);
}

.xt-empty-text {
    font-size: 0.9375rem;
    max-width: 300px;
}

/* ========================================
   搜索建议
   ======================================== */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--xt-bg-secondary);
    border: 1px solid var(--xt-border);
    border-radius: var(--xt-radius-md);
    box-shadow: var(--xt-shadow-lg);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    display: block;
    padding: var(--xt-space-3) var(--xt-space-4);
    color: var(--xt-text-primary);
    text-decoration: none;
    transition: background-color var(--xt-transition-fast);
}

.suggestion-item:hover {
    background: var(--xt-bg-hover);
}

.suggestion-item-title {
    font-weight: 500;
}

.suggestion-item-meta {
    font-size: 0.75rem;
    color: var(--xt-text-secondary);
    margin-top: 2px;
}

/* ========================================
   返回顶部
   ======================================== */
.xt-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--xt-bg-secondary);
    border: 1px solid var(--xt-border);
    border-radius: var(--xt-radius-full);
    color: var(--xt-text-primary);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--xt-transition);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xt-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.xt-back-to-top:hover {
    background: var(--xt-primary);
    border-color: var(--xt-primary);
    color: white;
}

.xt-back-to-top svg {
    width: 24px;
    height: 24px;
}
