/* ============================================================
   FORUM LISTING (index.php + f/index.php)
   ============================================================ */

.forum-list .forum-name {
    font-weight: 600;
}

.forum-list .last-activity {
    white-space: nowrap;
    text-align: right;
}

.forum-threads .thread-title {
    font-weight: 600;
}

.forum-threads .forum-category-strip {
    background: linear-gradient(180deg, #fffdf4 0%, #fff8d9 100%);
    border: 1px solid #e6d89a;
    border-top: 4px solid #e0b100;
    padding: .9rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.forum-threads .forum-category-strip__label {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7b6500;
    margin-bottom: .2rem;
}

.forum-threads .forum-category-strip__title {
    margin: 0;
    font-size: 1.3rem;
    color: #1f2d3d;
}

.forum-threads .forum-category-strip__meta {
    margin-top: .2rem;
    color: #4b5563;
    font-size: .9rem;
}

.forum-threads .thread-meta {
    color: #6c757d;
    font-size: .9rem;
}

/* ============================================================
   THREAD VIEW — Twitter-style cards
   ============================================================ */

/* Container */
.thread-view--twitter {
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 80px; /* space for mobile bar */
}

/* Post card */
.tw-post {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: .75rem;
    transition: box-shadow .15s ease;
}
.tw-post:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* OP post highlight */
.tw-post--op {
    border-left: 4px solid #1d9bf0;
    border-color: #cfd9e0;
    border-left-color: #1d9bf0;
}

/* Header: avatar + name + time on one line */
.tw-post__header {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .45rem;
}

.tw-post__avatar-img,
.tw-composer__avatar-img {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.tw-post__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #1d9bf0;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-transform: uppercase;
}

.tw-post__author {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}

.tw-post__name {
    font-size: .95rem;
    color: #0f1419;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tw-post__time {
    margin-left: auto;
    font-size: .82rem;
    color: #536471;
    white-space: nowrap;
}

/* Badges inside author line */
.tw-badge {
    font-size: .7rem;
    padding: .12em .45em;
}

/* Body: title + content */
.tw-post__body {
    margin-bottom: .55rem;
}

.tw-post__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f1419;
    margin: 0 0 .35rem 0;
}

.tw-post__content {
    font-size: .94rem;
    line-height: 1.5;
    color: #0f1419;
    word-break: break-word;
}

/* Reply-to indicator */
.tw-post__reply-to {
    font-size: .82rem;
    color: #536471;
    margin-bottom: .3rem;
    padding-left: 42px; /* align with avatar */
}
.tw-post__reply-to a {
    color: #1d9bf0;
    text-decoration: none;
}
.tw-post__reply-to a:hover {
    text-decoration: underline;
}

/* Actions row */
.tw-post__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
    padding-top: .4rem;
    border-top: 1px solid #eff3f4;
}

.tw-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background .15s;
    color: #536471;
    text-decoration: none;
}
.tw-action-btn:hover {
    background: rgba(29,155,240,.1);
    color: #1d9bf0;
}
.tw-action-btn--danger:hover {
    background: rgba(244,33,46,.1);
    color: #f4212e;
}

/* Reactions */
.tw-reactions {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    margin-left: .15rem;
}

.tw-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .15rem .4rem;
    border: 1px solid #e1e8ed;
    border-radius: 999px;
    background: #f7f9f9;
    font-size: .82rem;
    cursor: pointer;
    transition: all .12s;
    color: #536471;
}
.tw-reaction-btn:hover {
    background: #e8f5fd;
    border-color: #1d9bf0;
}
.tw-reaction--active {
    background: #e8f5fd;
    border-color: #1d9bf0;
    color: #1d9bf0;
}

.tw-reaction-count {
    font-size: .75rem;
    font-weight: 600;
    color: #536471;
}

.tw-reactions-empty {
    font-size: .78rem;
    color: #b0b8c1;
    padding: .15rem .3rem;
}

.tw-reaction-picker {
    display: inline-flex;
    align-items: center;
    gap: .1rem;
    margin-left: .25rem;
    opacity: 0;
    transition: opacity .15s;
}
.tw-post:hover .tw-reaction-picker,
.tw-post:focus-within .tw-reaction-picker {
    opacity: 1;
}

.tw-reaction-pick {
    font-size: .8rem;
    padding: .1rem .25rem;
    border-color: transparent;
    background: transparent;
}
.tw-reaction-pick:hover {
    background: #e8f5fd;
}

/* Composer (quick reply) */
.tw-composer {
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
}

.tw-composer__inner {
    display: flex;
    gap: .6rem;
}

.tw-composer__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #536471;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-transform: uppercase;
}

.tw-composer__input-wrap {
    flex: 1;
    min-width: 0;
}

.tw-composer__textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: vertical;
    font-size: .94rem;
    line-height: 1.45;
    padding: .35rem 0;
    color: #0f1419;
    background: transparent;
    min-height: 44px;
}
.tw-composer__textarea::placeholder {
    color: #536471;
}

.tw-composer__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: .35rem;
    border-top: 1px solid #eff3f4;
}

.tw-composer__submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: .6rem;
}

/* Rich editor inside composer — blend seamlessly */
.tw-composer .forum-rich-editor {
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tw-composer .forum-rich-editor:focus-within {
    border-color: transparent;
    box-shadow: none;
}

.tw-composer .forum-rich-editor__textarea {
    min-height: 3.5rem;
    padding: .5rem 0;
    font-size: .94rem;
}

.tw-composer .forum-rich-editor__toolbar {
    border-top: none;
    border-radius: 0;
    padding: .5rem .6rem;
    background: #f8fafc;
}

.tw-composer .forum-rich-editor__footer {
    border-top-color: #eff3f4;
    background: transparent;
    padding: .5rem .6rem;
}

.tw-composer .forum-rich-editor__hint {
    display: none;
}

.tw-composer__counter {
    color: #536471;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.tw-reply-to-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .45rem;
    padding: .4rem .6rem;
    background: #f7f9f9;
    border-radius: 8px;
    font-size: .82rem;
    color: #536471;
}

/* Feed */
.tw-feed {
    min-height: 100px;
}

/* Load more */
#loadMoreContainer {
    padding: 1rem 0;
}

/* New messages toast */
.tw-new-toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    text-align: center;
}
.tw-new-toast .btn {
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Mobile bottom bar */
.tw-mobile-bar {
    display: none;
    position: fixed;
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    height: 48px;
    background: #fff;
    border-top: 1px solid #e1e8ed;
    justify-content: space-around;
    align-items: center;
    z-index: 1050;
}

.tw-mobile-bar__btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    padding: .4rem 1rem;
    cursor: pointer;
    color: #536471;
}
.tw-mobile-bar__btn:hover {
    color: #1d9bf0;
}

/* ============================================================
   LEGACY POST STYLES (kept for backward compat in edit panels)
   ============================================================ */

.thread-view .post {
    background: linear-gradient(180deg, rgba(255, 255, 255, .98) 0%, rgba(248, 250, 252, .96) 100%);
    border: 1px solid #d8e0ea;
    border-radius: 1rem;
    padding: 1.1rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: 0 .6rem 1.4rem rgba(15, 23, 42, .08);
}

.thread-view .post .meta {
    color: #5f6b7a;
    font-size: .92rem;
    margin-bottom: .65rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.thread-view .post .content {
    white-space: pre-wrap;
}

.thread-view .post .meta .btn {
    box-shadow: none;
}

.thread-view .post .meta .btn-outline-secondary,
.thread-view .post .meta .btn-outline-primary {
    --bs-btn-bg: rgba(255, 255, 255, .88);
}

.thread-view .post .meta .btn-outline-danger {
    border-radius: 999px;
    padding-left: .8rem;
    padding-right: .8rem;
}

.thread-view .forum-edit-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #dbe4ef;
    border-radius: .95rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, .94) 0%, rgba(245, 248, 252, .94) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 .4rem 1rem rgba(15, 23, 42, .05);
}

.thread-view .forum-edit-panel__header {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding-bottom: .1rem;
}

.thread-view .forum-edit-panel__header strong {
    font-size: 1.05rem;
    color: #14213d;
}

.thread-view .forum-edit-panel__header small,
.thread-view .forum-edit-panel__header .text-body-secondary {
    color: #000000 !important;
}

.thread-view .forum-edit-panel__label {
    font-weight: 600;
    color: #000000;
}

.thread-view .forum-edit-panel__input {
    border-radius: .8rem;
    border-color: #cfd8e3;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
    color: #000000;
}

.thread-view .forum-edit-panel textarea.form-control,
.thread-view .forum-edit-panel input.form-control,
.thread-view .forum-edit-panel input.form-control-lg {
    color: #000000;
}

.thread-view .forum-edit-panel textarea.form-control::placeholder,
.thread-view .forum-edit-panel input.form-control::placeholder,
.thread-view .forum-edit-panel input.form-control-lg::placeholder {
    color: #000000;
    opacity: .65;
}

.thread-view .forum-edit-panel__input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
    color: #000000;
}

.thread-view .forum-edit-panel__actions {
    padding-top: .2rem;
}

.thread-view .forum-edit-panel__actions .btn {
    border-radius: 999px;
    font-weight: 600;
}

.thread-view .forum-edit-panel__actions .btn-primary {
    color: #ffffff;
    background-color: #0d6efd;
    border-color: #0d6efd;
    --bs-btn-color: #ffffff;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-color: #ffffff;
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-bg: #0d6efd;
    --bs-btn-border-color: #0d6efd;
    --bs-btn-hover-bg: #0b5ed7;
    --bs-btn-hover-border-color: #0a58ca;
    --bs-btn-active-bg: #0a58ca;
    --bs-btn-active-border-color: #0a53be;
}

.thread-view .forum-edit-panel__actions .btn-primary:hover,
.thread-view .forum-edit-panel__actions .btn-primary:focus,
.thread-view .forum-edit-panel__actions .btn-primary:active {
    color: #ffffff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* ============================================================
   RICH CONTENT inside posts
   ============================================================ */

.thread-view .post .content {
    white-space: normal;
    line-height: 1.55;
}

.thread-view .post .content .forum-rich-image,
.thread-view .post .content .forum-rich-video,
.thread-view .post .content .forum-rich-embed,
.tw-post__content .forum-rich-image,
.tw-post__content .forum-rich-video,
.tw-post__content .forum-rich-embed {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: .75rem 0;
    border-radius: .6rem;
    background: #000;
}

.thread-view .post .content .forum-rich-image,
.tw-post__content .forum-rich-image {
    width: auto;
    height: auto;
    max-height: 40rem;
    object-fit: contain;
    background: transparent;
}

.thread-view .post .content .forum-rich-video,
.thread-view .post .content .forum-rich-embed,
.tw-post__content .forum-rich-video,
.tw-post__content .forum-rich-embed {
    aspect-ratio: 16 / 9;
}

.thread-view .post .content .forum-rich-embed,
.tw-post__content .forum-rich-embed {
    border: 0;
}

.thread-view .post .content .forum-rich-quote,
.tw-post__content .forum-rich-quote {
    margin: .75rem 0;
    padding: .6rem .9rem;
    border-left: .25rem solid #7c8aa5;
    background: rgba(148, 163, 184, .12);
    border-radius: .65rem;
    color: #334155;
}

.thread-view .post .content a,
.tw-post__content a {
    word-break: break-word;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .thread-view--twitter {
        max-width: 100%;
        padding: .5rem .6rem 90px;
    }

    .tw-post {
        padding: .75rem .85rem;
        border-radius: 10px;
    }

    .tw-composer {
        padding: .65rem .75rem;
    }
    .tw-composer .forum-rich-editor__toolbar {
        padding: .35rem .4rem;
        gap: .25rem;
    }
    .tw-composer .forum-rich-editor__toolbar .btn {
        min-width: 2rem;
        padding: .15rem .35rem;
        font-size: .75rem;
    }
    .tw-composer .forum-rich-editor__color {
        padding: .2rem .35rem;
        font-size: .75rem;
    }
    .tw-composer .forum-rich-editor__color input {
        width: 1.6rem;
        height: 1.6rem;
    }

    .tw-post__avatar,
    .tw-composer__avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: .8rem;
    }
    .tw-post__avatar-img,
    .tw-composer__avatar-img {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .tw-post__name {
        font-size: .88rem;
    }

    .tw-post__content {
        font-size: .9rem;
    }

    .tw-mobile-bar {
        display: flex;
    }

    .thread-view .forum-edit-panel {
        padding: .85rem;
    }

    .thread-view .post .meta {
        gap: .35rem;
    }
}

@media (max-width: 575.98px) {
    .tw-mobile-bar {
        bottom: 0;
        left: var(--sidebar-w);
    }

    .tw-post__reply-to {
        padding-left: 32px;
    }
}

@media (min-width: 769px) {
    .tw-mobile-bar {
        display: none !important;
    }
}

/* ============================================================
   FORUM INDEX
   ============================================================ */

#forum-index {
    color: #202122;
}

#forum-index .forum-hero {
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-top: 4px solid #e0b100;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

#forum-index .forum-hero__main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

#forum-index .forum-hero__title {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.1;
    color: #1f2d3d;
}

#forum-index .forum-hero__subtitle {
    margin: .25rem 0 0;
    color: #2e7d32;
    font-size: .96rem;
}

#forum-index .forum-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .8rem;
}

#forum-index .forum-hero__stat {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .55rem;
    background: #f6f6f6;
    border: 1px solid #dedede;
    border-radius: 999px;
    color: #4b5563;
    font-size: .84rem;
}

#forum-index .forum-hero__stat b {
    color: #1f2937;
}

#forum-index .forum-hero__button {
    font-weight: 700;
    border-color: #d8a100;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}

#forum-index .forum-create-card,
#forum-index .forum-table-wrap {
    border: 1px solid #d9d9d9;
    background: #ffffff;
}

#forum-index .forum-create-title,
#forum-index .forum-table-title {
    font-weight: 700;
    color: #1f2d3d;
}

#forum-index .forum-table-header {
    padding: .7rem 1rem;
    border-bottom: 1px solid #dddddd;
    background: linear-gradient(180deg, #fdfdfd 0%, #f3f3f3 100%);
}

#forum-index .forum-table-meta,
#forum-index .forum-created,
#forum-index .forum-last-absolute,
#forum-index .form-text {
    color: #6b7280;
    font-size: .84rem;
}

#forum-index .forum-list {
    margin-bottom: 0;
}

#forum-index .forum-list thead th {
    background: #f3f3f3;
    color: #5b6673;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #dcdcdc;
    padding-top: .7rem;
    padding-bottom: .7rem;
}

#forum-index .forum-list td {
    vertical-align: top;
    border-color: #ececec;
    padding-top: .8rem;
    padding-bottom: .8rem;
    background: #fff;
}

#forum-index .forum-list tbody tr:hover td {
    background: #fffdf3;
}

#forum-index .forum-title-link,
#forum-index .forum-latest-list a {
    text-decoration: none;
    color: #2458b8;
    font-weight: 700;
}

#forum-index .forum-title-link:hover,
#forum-index .forum-latest-list a:hover {
    text-decoration: underline;
}

#forum-index .forum-id-badge {
    color: #5f6b7a;
    font-weight: 600;
    background: #f5f5f5 !important;
    border-color: #dddddd !important;
}

#forum-index .forum-access .badge {
    font-weight: 600;
    margin-right: .35rem;
    border: 1px solid transparent;
}

#forum-index .forum-access-read {
    background: #eef5ff;
    color: #2355b0;
    border-color: #d7e4fb;
}

#forum-index .forum-access-write {
    background: #edf8ed;
    color: #2b7a2b;
    border-color: #d7ead7;
}

#forum-index .forum-threads-count {
    min-width: 90px;
    text-align: right;
}

#forum-index .forum-threads-count .badge {
    min-width: 2.4rem;
    font-size: .82rem;
}

#forum-index .forum-last-relative {
    font-weight: 700;
    color: #1f2937;
}

#forum-index .forum-latest-list li {
    margin-bottom: .24rem;
    line-height: 1.25;
}

#forum-index .forum-latest-list li:last-child {
    margin-bottom: 0;
}

#forum-index .text-muted {
    color: #7a7f87 !important;
}

#forum-index .form-label {
    color: #334155;
    font-weight: 600;
}

#forum-index .form-control,
#forum-index .form-select {
    border-color: #cfd4dc;
}

@media (max-width: 991px) {
    #forum-index .forum-list .last-activity,
    #forum-index .forum-threads-count {
        white-space: normal;
        text-align: left;
    }
}

@media (max-width: 768px) {
    #forum-index .forum-hero {
        padding: .9rem;
    }

    #forum-index .forum-table-header {
        padding: .65rem .8rem;
    }

    #forum-index .forum-list thead th {
        font-size: .71rem;
    }
}

/* ============================================================
   FORUM SEARCH MODE TOGGLE
   ============================================================ */

.forum-search-mode {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.forum-search-mode__label {
    font-weight: 600;
    color: #334155;
    font-size: .85rem;
}

.forum-search-mode__option {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .85rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    padding: .15rem .4rem;
    border-radius: 4px;
}

/* ============================================================
   ATTACHMENTS IN POSTS
   ============================================================ */

.forum-attach-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    margin: .25rem 0;
    background: #f7f9f9;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    color: #1d9bf0;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    transition: background .15s, border-color .15s;
}
.forum-attach-link:hover {
    background: #e8f5fd;
    border-color: #1d9bf0;
    color: #0d6efd;
}

.forum-attach-missing {
    color: #dc3545;
    font-size: .85rem;
    font-style: italic;
}
