/* X Timeline Plugin Styles */

.xtl-timeline-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 600px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ─── 個別ポスト ─── */
.xtl-post-wrapper {
    padding: 10px 30px;
    border: 1px solid #e1e8ed;
    border-bottom: none;
}

.xtl-post-wrapper:first-child {
    border-radius: 12px 12px 0 0;
}

.xtl-post-wrapper:last-child {
    border-bottom: 1px solid #e1e8ed;
    border-radius: 0 0 12px 12px;
}

.xtl-post-wrapper:only-child {
    border-radius: 12px;
    border-bottom: 1px solid #e1e8ed;
}

.xtl-post-wrapper:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* ─── RTラベル ─── */
.xtl-retweet-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #536471;
    margin-bottom: 8px;
    padding-left: 36px;
}

/* ─── ヘッダー（アバター + 名前） ─── */
.xtl-header {
    margin-bottom: 20px;
}

.xtl-profile-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.xtl-profile-link:hover,
.xtl-profile-link:active,
.xtl-profile-link:focus,
.xtl-profile-link:visited {
    color: #000;
}

.xtl-profile-link:hover .xtl-display-name {
    color: #000;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.xtl-profile-icon {
    border-radius: 50%;
    margin-right: 10px !important;
    width: 48px !important;
    height: 48px !important;
}

.xtl-author-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.xtl-display-name {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4em;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xtl-username {
    font-size: 14px;
    color: #536471;
}

/* ─── 本文 ─── */
.xtl-post-text {
    line-height: 1.6;
    color: #000;
    word-break: break-word;
}

/* ─── メディア ─── */
.xtl-media-wrapper {
    margin-top: 12px;
    display: grid;
    gap: 2px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #cfd9de;
}

.xtl-media-count-1 { grid-template-columns: 1fr; }
.xtl-media-count-2 { grid-template-columns: 1fr 1fr; }
.xtl-media-count-3 { grid-template-columns: 1fr 1fr; }
.xtl-media-count-4 { grid-template-columns: 1fr 1fr; }

.xtl-media-count-3 .xtl-media-item:first-child {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    padding-bottom: 113.5%;
}

.xtl-media-count-4 .xtl-media-item {
    padding-bottom: 100%;
}

.xtl-media-item {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.xtl-media-item a {
    display: block;
    line-height: 0;
}

.xtl-media-item img,
.xtl-media-item video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    object-fit: cover;
}

/* ─── 引用ポスト ─── */
.xtl-quoted-post {
    margin-top: 12px;
    border: 1px solid #cfd9de;
    border-radius: 12px;
    padding: 12px;
}

.xtl-quoted-link,
.xtl-quoted-link:hover,
.xtl-quoted-link:visited,
.xtl-quoted-link:active,
.xtl-quoted-link:focus {
    text-decoration: none;
    color: #000;
}

.xtl-quoted-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.xtl-quoted-icon {
    border-radius: 50%;
    margin-right: 5px;
}

.xtl-quoted-display-name {
    font-size: 15px;
    font-weight: bold;
    color: #000;
}

.xtl-quoted-username,
.xtl-quoted-date {
    font-size: 14px;
    color: #536471;
    margin-left: 5px;
}

.xtl-quoted-text {
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
}

.xtl-quoted-media-wrapper {
    margin-top: 8px;
    display: grid;
    gap: 2px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #cfd9de;
}

.xtl-quoted-media-count-1 { grid-template-columns: 1fr; }
.xtl-quoted-media-count-2 { grid-template-columns: 1fr 1fr; }
.xtl-quoted-media-count-3 { grid-template-columns: 1fr 1fr; }
.xtl-quoted-media-count-4 { grid-template-columns: 1fr 1fr; }

.xtl-quoted-media-item {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.xtl-quoted-media-count-3 .xtl-quoted-media-item:first-child {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    padding-bottom: 113.5%;
}

.xtl-quoted-media-count-4 .xtl-quoted-media-item {
    padding-bottom: 100%;
}

.xtl-quoted-media-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    object-fit: cover;
}

/* ─── 日時 ─── */
.xtl-post-meta {
    margin-top: 20px;
    font-size: 14px;
    text-align: right;
}

.xtl-post-meta a {
    color: #666;
    text-decoration: none;
}

.xtl-post-meta a:hover {
    text-decoration: underline;
}

/* ─── エラー通知（管理者のみ表示） ─── */
.xtl-error-notice {
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
}

/* ─── レスポンシブ ─── */
@media (max-width: 480px) {
    .xtl-post-wrapper {
        padding: 10px 16px;
    }

    .xtl-profile-icon {
        width: 40px !important;
        height: 40px !important;
    }
}
