/* ============================================
   LIFTOWN 投稿一覧テンプレート用スタイル
   liftown.css
   ============================================ */

:root {
    --bg-color: #ffffff;
    --text-color: #0f1419;
    --sub-text-color: #536471;
    --border-color: #eff3f4;
    --hover-color: rgba(0, 0, 0, 0.03);
    --accent-color: #ff0090;
    --card-bg: #ffffff;
    --trend-bg: #f7f8fa;
}

body.dark-mode {
    --bg-color: #0b0b0e;
    --text-color: #f0f0f5;
    --sub-text-color: #a0a0b0;
    --border-color: #1f1f2e;
    --hover-color: rgba(255, 0, 144, 0.08);
    --card-bg: #12121c;
    --accent-color: #ff0090;
    --trend-bg: #14141e;
}

.liftown-page * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.liftown-page {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

body.liftown-page {
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.layout-container {
    display: flex;
    width: 100%;
    max-width: 1265px;
    margin: 0 auto;
}

/* ============================================
   左側メニュー（header-liftown.php）
   ============================================ */
.sidebar {
    width: 275px;
    flex-shrink: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo {
    font-size: 24px;
    font-weight: 900;
    color: var(--accent-color);
    padding: 10px 15px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

body.dark-mode .logo {
    text-shadow: 0 0 10px rgba(255, 0, 144, 0.6), 0 0 20px rgba(255, 0, 144, 0.4);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 9999px;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
    border: none;
    background: none;
}

.menu-item:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

.menu-item.active {
    color: var(--accent-color);
}

body.dark-mode .menu-item:hover {
    box-shadow: 0 0 8px rgba(255, 0, 144, 0.2);
}

/* ============================================
   中央タイムライン（archive-liftown.php）
   ============================================ */
.timeline {
    width: 600px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
}

.timeline-header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    font-size: 20px;
    font-weight: 800;
    z-index: 10;
}

body.dark-mode .timeline-header {
    background-color: rgba(11, 11, 14, 0.85);
}

.post-card {
    display: flex;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
    transition: background-color 0.2s;
    color: inherit;
}

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

/* 投稿者名／アイコン → LIFTOWNプロフィールページへのリンク */
.post-avatar-link {
    display: block;
    flex-shrink: 0;
    text-decoration: none;
}

.user-name-link {
    text-decoration: none;
    color: inherit;
}

.post-avatar-link:hover .avatar,
.user-name-link:hover .user-name {
    text-decoration: underline;
}

/* 本文・画像 → 投稿詳細ページへのリンク */
.post-body-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--hover-color);
    font-size: 18px;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-header {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.user-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-color);
}

.user-id, .post-time {
    color: var(--sub-text-color);
    font-size: 14px;
}

.post-text {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-color);
    white-space: pre-line;
}

.post-image-container {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.post-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 350px;
    object-fit: cover;
}

/* 投稿画像グリッド（liftown_postimg1〜4／最大4枚・X風レイアウト） */
.post-image-grid {
    display: grid;
    gap: 2px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 10px;
    background-color: var(--border-color);
}

.post-image-grid .post-image-cell {
    overflow: hidden;
    background-color: var(--card-bg);
}

.post-image-grid .post-image {
    width: 100%;
    height: 100%;
    max-height: none;
    display: block;
    object-fit: cover;
}

/* 画像1枚：横幅いっぱいの1カラム */
.post-image-grid.count-1 {
    grid-template-columns: 1fr;
    aspect-ratio: 16 / 9;
    max-height: 350px;
}

/* 画像2枚：左右2分割 */
.post-image-grid.count-2 {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 16 / 9;
    max-height: 300px;
}

/* 画像3枚：左に大きく1枚、右に2枚縦積み */
.post-image-grid.count-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
    max-height: 300px;
}

.post-image-grid.count-3 .post-image-cell:first-child {
    grid-row: 1 / span 2;
}

/* 画像4枚：2×2グリッド */
.post-image-grid.count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
    max-height: 300px;
}

.liftown-empty {
    padding: 40px 20px;
    color: var(--sub-text-color);
    text-align: center;
}

.liftown-pagination {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.liftown-pagination a,
.liftown-pagination span {
    padding: 8px 14px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
}

.liftown-pagination a:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* ============================================
   投稿詳細ページ（single-liftown.php）
   ============================================ */
.timeline-header--single {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-color);
    font-size: 18px;
    transition: background-color 0.2s, color 0.2s;
}

.back-button:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

.post-detail {
    padding: 12px 20px 0;
}

.post-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.post-detail-userinfo {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.post-detail-userinfo .user-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-color);
}

.post-detail-userinfo .user-id {
    font-size: 14px;
    color: var(--sub-text-color);
}

.post-detail-text {
    font-size: 22px;
    line-height: 1.45;
    margin-bottom: 12px;
    color: var(--text-color);
    word-break: break-word;
}

.post-detail-text p {
    margin-bottom: 14px;
}

.post-detail-text p:last-child {
    margin-bottom: 0;
}

.post-detail .post-image-grid,
.post-detail .post-image-container {
    margin-top: 4px;
    margin-bottom: 16px;
}

.post-detail-meta {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--sub-text-color);
    font-size: 15px;
}

.post-detail-stats {
    display: flex;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--sub-text-color);
}

.post-detail-stats strong {
    color: var(--text-color);
}

.post-detail-actions {
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.action-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sub-text-color);
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 9999px;
    transition: background-color 0.2s, color 0.2s;
}

.action-item:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* ============================================
   画像モーダル（ライトボックス）（single-liftown.php）
   ============================================ */
.liftown-lightbox-trigger {
    cursor: zoom-in;
}

body.liftown-lightbox-open {
    overflow: hidden;
}

.liftown-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.9);
}

.liftown-lightbox.is-open {
    display: flex;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.lightbox-close,
.lightbox-arrow {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lightbox-close:hover,
.lightbox-arrow:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 26px;
    line-height: 1;
}

.lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 30px;
    line-height: 1;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-arrow.is-hidden {
    display: none;
}

@media (max-width: 600px) {
    .lightbox-arrow {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .lightbox-prev {
        left: 8px;
    }
    .lightbox-next {
        right: 8px;
    }
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* ============================================
   プロフィールページ（archive-liftown.php ?character_id=◯◯）
   ============================================ */
.profile-cover {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--trend-bg);
}

.profile-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

/* カバー写真がある場合は、アイコンをXのようにカバー写真の下端に少し重ねる */
.profile-header.has-cover {
    align-items: flex-start;
}

.profile-header.has-cover .avatar-xl {
    margin-top: -76px;
    border: 4px solid var(--bg-color);
    background-color: var(--bg-color);
}

.avatar-xl {
    width: 120px;
    height: 120px;
    font-size: 48px;
    flex-shrink: 0;
}

.profile-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.3;
}

.profile-header-info .user-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
}

.profile-header-info .user-id {
    font-size: 14px;
    color: var(--sub-text-color);
}

.profile-bio {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-color);
    margin: 6px 0 4px;
    word-break: break-word;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 4px;
    font-size: 14px;
}

.profile-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--sub-text-color);
    text-decoration: none;
    word-break: break-all;
}

a.profile-meta-item:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.profile-post-count {
    font-size: 13px;
    color: var(--sub-text-color);
    margin-top: 4px;
}

/* ============================================
   話題を検索（archive-liftown.php ?view=search）
   ============================================ */
.liftown-search-form {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.liftown-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--trend-bg);
    border: 1px solid transparent;
    border-radius: 9999px;
    padding: 10px 16px;
    transition: border-color 0.2s, background-color 0.2s;
}

.liftown-search-box:focus-within {
    background-color: var(--bg-color);
    border-color: var(--accent-color);
}

.liftown-search-icon {
    font-size: 15px;
    color: var(--sub-text-color);
    flex-shrink: 0;
}

.liftown-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    outline: none;
    font-size: 15px;
    color: var(--text-color);
    font-family: inherit;
}

.liftown-search-input::placeholder {
    color: var(--sub-text-color);
}

.liftown-search-count {
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   ユーザー一覧（archive-liftown.php ?view=users）
   ============================================ */
.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.user-list-item:hover {
    background-color: var(--hover-color);
}

.user-list-item:hover .user-name {
    text-decoration: underline;
}

.user-list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-list-info .user-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-color);
}

.user-list-info .user-id {
    font-size: 14px;
    color: var(--sub-text-color);
}

.user-list-count {
    font-size: 13px;
    color: var(--sub-text-color);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   リプライ（コメント）表示・投稿フォーム
   ============================================ */
.post-replies {
    border-top: 8px solid var(--border-color);
}

.post-card--reply {
    cursor: default;
}

.post-reply-form-title {
    font-size: 18px;
    font-weight: 800;
    padding: 16px 20px 8px;
}

#commentform {
    padding: 0 20px 24px;
}

#commentform p {
    margin-bottom: 10px;
}

.liftown-comment-field {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
}

.liftown-comment-field:focus {
    outline: none;
    border-color: var(--accent-color);
}

#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"] {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    font-family: inherit;
}

#commentform input[type="text"]:focus,
#commentform input[type="email"]:focus,
#commentform input[type="url"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

.liftown-submit {
    margin-top: 4px;
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.liftown-submit:hover {
    opacity: 0.85;
}

/* ============================================
   右側カラム／トレンド風表示（sidebar-liftown.php）
   ============================================ */
.trend-sidebar {
    width: 290px;
    flex-shrink: 0;
    padding: 20px 20px 20px 24px;
}

.trend-box {
    background-color: var(--trend-bg);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 8px;
}

.trend-title {
    font-size: 20px;
    font-weight: 800;
    padding: 14px 16px;
}

.trend-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
    border-top: 1px solid var(--border-color);
}

.trend-item:first-of-type {
    border-top: none;
}

.trend-item:hover {
    background-color: var(--hover-color);
}

.trend-rank {
    font-size: 12px;
    color: var(--sub-text-color);
    margin-bottom: 2px;
}

.trend-rank .trend-num {
    color: var(--accent-color);
    font-weight: 700;
}

.trend-name {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-color);
    margin-bottom: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trend-meta {
    font-size: 13px;
    color: var(--sub-text-color);
}

.trend-empty {
    padding: 16px;
    font-size: 14px;
    color: var(--sub-text-color);
}

.trend-copyright {
    font-size: 12px;
    color: var(--sub-text-color);
    text-align: center;
    padding: 16px 8px;
}

/* ============================================
   レスポンシブ調整
   ============================================ */
@media (max-width: 1300px) {
    .trend-sidebar {
        display: none;
    }
    .timeline {
        flex: 1;
        width: auto;
    }
}

@media (max-width: 1000px) {
    .sidebar {
        width: 80px;
        align-items: center;
        padding: 20px 10px;
    }
    .sidebar .logo,
    .sidebar .menu-item span {
        display: none;
    }
    .timeline {
        width: calc(100% - 80px);
    }
}
