/* Tweet Detail Modal - 推文详情模态框组件样式 */

/* 模态框基础样式 */
.tweet-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.2s ease;
    perspective: 1500px;
}

.tweet-detail-modal {
    color: var(--text-primary);
}

html.light-mode .tweet-detail-modal {
    background: rgba(248, 250, 252, 0.9);
}

.tweet-detail-modal.show {
    display: flex;
}

/* 主容器 - 垂直布局 */
.tweet-detail-main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    align-items: center;
    gap: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 主卡片 */
.tweet-detail-content {
    background: transparent;
    border: none;
    border-radius: 0;
    width: 100vw;
    max-width: 100%;
    height: 100vh;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: row; /* Horizontal layout */
    box-shadow: none;
    margin: 0;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

html.light-mode .tweet-detail-content {
    background: transparent;
    box-shadow: none;
    border-color: transparent;
}

/* Left Column: Images */
.tweet-detail-left-col {
    flex: 3; /* Increase ratio to ~75% */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 3rem; /* Add breathing room around the image */
}

html.light-mode .tweet-detail-left-col {
    background: #f1f5f9;
}

/* Right Column: Info */
.tweet-detail-right-col {
    width: 400px; /* Fixed width */
    min-width: 320px;
    flex: none; /* Disable flex growth */
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    background: #141414; /* Darker background */
    position: relative; /* For absolute positioning of close button if needed */
}

html.light-mode .tweet-detail-right-col {
    background: #ffffff;
    border-left-color: var(--border-color);
}

/* Header Adjustments */
.tweet-detail-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: none; /* Minimalist look */
    background: transparent;
    backdrop-filter: none;
}

/* Close Button Style */
.tweet-detail-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-muted);
    z-index: 10;
}

.tweet-detail-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

html.light-mode .tweet-detail-close {
    background: rgba(0, 0, 0, 0.05);
}

html.light-mode .tweet-detail-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Text Section Adjustments */
.tweet-detail-text-section {
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.tweet-detail-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e5e5e5;
}

html.light-mode .tweet-detail-text {
    color: #333;
}

/* User Info Adjustments */
.tweet-detail-user {
    gap: 0.75rem;
}

.tweet-detail-avatar {
    width: 42px;
    height: 42px;
    border: none;
}

.tweet-detail-name {
    font-size: 0.95rem;
}

.tweet-detail-username {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Footer Adjustments */
.tweet-detail-footer {
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    margin-top: auto; /* Push to bottom */
}

html.light-mode .tweet-detail-footer {
    border-top-color: rgba(0, 0, 0, 0.05);
}

/* 主卡片未选中状态 */
.tweet-detail-content.unselected {
    filter: grayscale(1);
    opacity: 0.6;
}

/* 底部缩略图条 */
.thumbnail-strip {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(17, 17, 17, 1);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    height: 130px;
    width: 100%;
    flex-shrink: 0;
}

html.light-mode .thumbnail-strip {
    background: var(--bg-secondary);
}

.thumbnail-strip::-webkit-scrollbar {
    height: 8px;
}

.thumbnail-strip::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 4px;
}

.thumbnail-strip::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* 单个缩略图 */
.thumbnail-item {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.thumbnail-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

/* 当前选中的缩略图 */
.thumbnail-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

/* 缩略图未选中状态 */
.thumbnail-item.unselected {
    /* filter: grayscale(1);  Removed per user request */
    opacity: 0.5;
}

.thumbnail-item.unselected:hover {
    opacity: 0.8;
}

/* 缩略图图片 */
.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 没有图片时的占位 */
.thumbnail-item-placeholder {
    width: 100%;
    height: 100%;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
    padding: 8px;
}

/* 缩略图上的序号 */
.thumbnail-item-number {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* 已选中标记 */
.thumbnail-item-selected {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent);
    color: var(--accent-foreground);
    padding: 2px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-item-selected svg {
    width: 12px;
    height: 12px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tweet-detail-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(17, 17, 17, 1);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

html.light-mode .tweet-detail-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.tweet-detail-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.tweet-detail-position {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-left: auto;
    margin-right: 0.5rem;
    display: none;
}

.tweet-detail-selected-indicator {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 2px solid var(--border);
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.35rem;
    transition: all var(--transition);
    cursor: pointer;
}

.tweet-detail-selected-indicator:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.tweet-detail-selected-indicator.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-foreground);
    box-shadow: var(--shadow-accent);
}

.tweet-detail-selected-indicator svg {
    width: 18px;
    height: 18px;
    opacity: 0;
    stroke: currentColor;
    stroke-width: 3;
    fill: none;
    transition: opacity var(--transition);
}

.tweet-detail-selected-indicator.selected svg {
    opacity: 1;
}

.tweet-detail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.tweet-detail-user-info {
    display: flex;
    flex-direction: column;
}

.tweet-detail-name {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.9rem;
}

.tweet-detail-username {
    color: var(--muted-foreground);
    font-size: 0.8rem;
    font-family: 'IBM Plex Mono', monospace;
}

.tweet-detail-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.tweet-detail-close:hover {
    background: var(--muted);
    color: var(--foreground);
}

.tweet-detail-body {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tweet-detail-images {
    width: 100%;
    height: 100%;
    display: flex;
    /* justify-content: center;  Handled by wrapper margin: auto */
    align-items: center;
    background: transparent;
    border-bottom: none;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

html.light-mode .tweet-detail-images {
    background: transparent;
    border-color: transparent;
}

/* Inner wrapper for alignment control */
.images-wrapper {
    display: flex;
    margin: auto; /* Centers if fits, Starts if overflows */
    height: 100%;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0; /* Prevent wrapper from shrinking below content size */
    padding: 0 2rem; /* Add some padding so it doesn't touch edges when scrolling */
}

/* Base image style for transition */
.tweet-detail-images img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

.tweet-detail-images.single img {
    max-height: 100%;
    object-fit: contain;
    background: transparent;
    border-radius: 18px;
}

html.light-mode .tweet-detail-images.single img {
    background: transparent;
}

/* Handle multiple images grid layout within the left column if needed */
.tweet-detail-images.double, 
.tweet-detail-images.multiple {
    /* justify-content handled by wrapper */
    overflow-x: auto;
    overflow-y: hidden;
}

.tweet-detail-images.double img,
.tweet-detail-images.multiple img {
    width: auto;
    height: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    flex-shrink: 1;
    border-radius: 18px;
}

html.light-mode .tweet-detail-images.double img,
html.light-mode .tweet-detail-images.multiple img {
    background: transparent;
}

.tweet-detail-text-section {
    padding: 1rem 1.25rem;
}

.tweet-detail-text {
    color: var(--foreground);
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.5rem;
}

.tweet-detail-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
}

.tweet-detail-stat svg {
    width: 14px;
    height: 14px;
}

.tweet-detail-stat.likes {
    color: var(--accent);
}

.tweet-detail-stat.replies {
    color: #1da1f2;
}

.tweet-detail-stat.retweets {
    color: #17bf63;
}

.tweet-detail-time {
    color: var(--muted-foreground);
    font-size: 0.8rem;
    font-family: 'IBM Plex Mono', monospace;
    margin-top: 0.75rem;
}

.tweet-detail-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    flex-shrink: 0;
}

html.light-mode .tweet-detail-footer {
    background: var(--bg-secondary);
}

.tweet-detail-footer-stats {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: fit-content;
}

.tweet-detail-footer-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.tweet-detail-action-btn {
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    white-space: nowrap;
}

.tweet-detail-action-btn:hover {
    background: var(--muted);
    border-color: var(--accent);
    color: var(--accent);
}

.tweet-detail-action-btn svg {
    width: 16px;
    height: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tweet-detail-content {
        flex-direction: column;
        height: calc(100vh - 120px);
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .tweet-detail-left-col {
        flex: none;
        height: 40vh;
        width: 100%;
        padding: 0; /* Remove padding on mobile for better visibility */
    }

    .tweet-detail-right-col {
        flex: 1;
        width: 100%;
        min-width: 0;
        max-width: none;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}
