/* ═══════════════ Twitter Widget — Social Media Feed ═══════════════
   Styles for: tweet cards, modal, lightbox, infinite scroll,
   engagement stats, loading states
   ═════════════════════════════════════════════════════════════════ */

/* ─── Feed Container ─── */
.twitter-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── Loading ─── */
.twitter-loader,
.twitter-bottom-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.twitter-end-msg {
    text-align: center;
    padding: 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ─── Tweet Card ─── */
.tweet-card {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}
.tweet-card:hover {
    background: var(--bg-hover);
}

/* ─── Header ─── */
.tweet-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.tweet-avatar-wrap {
    flex-shrink: 0;
}
.tweet-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}
.tweet-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.tweet-avatar--lg {
    width: 40px;
    height: 40px;
    font-size: 15px;
}
.tweet-author {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.tweet-username {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tweet-handle {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tweet-time {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Text ─── */
.tweet-text {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.tweet-hashtag {
    color: var(--accent);
    font-weight: 500;
}
.tweet-mention {
    color: var(--accent);
}
.tweet-ticker {
    color: var(--green);
    font-weight: 600;
}

/* ─── Images Grid ─── */
.tweet-images {
    display: grid;
    gap: 3px;
    margin-top: 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.tweet-images.single {
    grid-template-columns: 1fr;
}
.tweet-images.double {
    grid-template-columns: 1fr 1fr;
}
.tweet-images.multi {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
}
.tweet-image {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    transition: opacity 0.15s;
}
.tweet-images.single .tweet-image {
    aspect-ratio: 16/9;
    max-height: 180px;
}
.tweet-image:hover {
    opacity: 0.85;
}

/* ─── Footer ─── */
.tweet-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}
.tweet-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}
.tweet-stat svg {
    opacity: 0.6;
}
.tweet-score-badge {
    margin-left: auto;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    background: var(--accent-muted);
    color: var(--accent);
}

/* ═══════════════ Tweet Modal ═══════════════ */
.tweet-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tweet-modal-overlay.visible {
    opacity: 1;
}
.tweet-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.tweet-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    line-height: 1;
}
.tweet-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal Header */
.tweet-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.tweet-modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.tweet-modal-author {
    display: flex;
    flex-direction: column;
}
.tweet-modal-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.tweet-modal-handle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Modal Text — tam metin, clamp yok */
.tweet-modal-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 12px;
    word-break: break-word;
}
.tweet-modal-text .tweet-hashtag { color: var(--accent); }
.tweet-modal-text .tweet-mention { color: var(--accent); }
.tweet-modal-text .tweet-ticker { color: var(--green); font-weight: 600; }

/* Modal Images */
.tweet-modal-images {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    border-radius: 8px;
    overflow: hidden;
}
.tweet-modal-images:has(> :nth-child(2)) {
    grid-template-columns: 1fr 1fr;
}
.tweet-modal-image {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    cursor: zoom-in;
    border-radius: 4px;
    transition: opacity 0.15s;
}
.tweet-modal-image:only-child {
    aspect-ratio: 16/9;
    max-height: 300px;
}
.tweet-modal-image:hover {
    opacity: 0.85;
}

/* Modal Meta */
.tweet-modal-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-bottom: 10px;
}
.tweet-modal-time {
    font-size: 12px;
    color: var(--text-muted);
}
.tweet-modal-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.tweet-modal-stat svg {
    opacity: 0.6;
}
.tweet-modal-link {
    display: inline-block;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.15s;
}
.tweet-modal-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ═══════════════ Lightbox ═══════════════ */
.tweet-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tweet-lightbox-overlay.visible {
    opacity: 1;
}
.tweet-lightbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px;
}
.tweet-lightbox-img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none; /* Pinch-to-zoom JS ile yönetiliyor */
    transform-origin: center center;
    transition: none; /* Transform animasyonu olmasın — parmak takibi anlık */
}
.tweet-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: background 0.15s;
    line-height: 1;
    z-index: 2;
}
.tweet-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}
.tweet-lightbox-prev,
.tweet-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 10px;
    transition: background 0.15s;
    z-index: 2;
    line-height: 1;
}
.tweet-lightbox-prev { left: 16px; }
.tweet-lightbox-next { right: 16px; }
.tweet-lightbox-prev:hover,
.tweet-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.18);
}
.tweet-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 12px;
}

/* ═══════════════ Sentiment badge (mevcut) ═══════════════ */
.tweet-sentiment {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tweet-sentiment.bullish {
    background: var(--green-bg);
    color: var(--green);
}
.tweet-sentiment.bearish {
    background: var(--red-bg);
    color: var(--red);
}
.tweet-sentiment.neutral {
    background: var(--bg-active);
    color: var(--text-muted);
}

/* ═══════════════ MOBILE ═══════════════ */
@media (max-width: 768px) {
    .tweet-card {
        padding: 12px 14px;
    }
    .tweet-username {
        font-size: 13px;
    }
    .tweet-handle,
    .tweet-time {
        font-size: 11px;
    }
    .tweet-text {
        font-size: 13px;
    }
    .tweet-avatar,
    .tweet-avatar-img {
        width: 32px;
        height: 32px;
    }
    .tweet-stat {
        font-size: 11px;
    }

    /* Modal mobile */
    .tweet-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }
    .tweet-modal {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        padding: 16px;
    }
    .tweet-modal-text {
        font-size: 14px;
    }

    /* Lightbox mobile */
    .tweet-lightbox {
        padding: 10px;
    }
    .tweet-lightbox-close {
        display: none; /* Mobilde X butonu gizli — dışına dokununca kapanıyor */
    }
    .tweet-lightbox-img {
        max-width: 100%;
        max-height: 80vh;
    }
    .tweet-lightbox-prev,
    .tweet-lightbox-next {
        padding: 6px 10px;
        font-size: 26px;
    }
    .tweet-lightbox-prev { left: 6px; }
    .tweet-lightbox-next { right: 6px; }
}
