:root {
    --app-bg: #f6f8fc;
    --app-text: #172033;
    --app-muted: #6c7890;
    --app-border: #e6eaf1;
    --app-panel: #ffffff;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    min-height: 100vh;
}

.app-container {
    max-width: 1640px;
    padding-left: clamp(1rem, 2.2vw, 2.5rem);
    padding-right: clamp(1rem, 2.2vw, 2.5rem);
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d6efd, #6f42c1);
}

.hero-section {
    background:
        radial-gradient(circle at 80% 20%, rgba(111,66,193,.12), transparent 30%),
        radial-gradient(circle at 15% 20%, rgba(13,110,253,.10), transparent 28%),
        #fff;
}

.post-card {
    border: 1px solid var(--app-border);
    border-radius: 22px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 30px rgba(26, 40, 68, .06);
}

.post-card:hover {
    box-shadow: 0 14px 38px rgba(26, 40, 68, .10);
}

.post-header {
    border-bottom: 1px solid var(--app-border);
}

.post-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, .8fr);
    min-height: 590px;
}

.post-visual-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: 0 0 auto;
    text-transform: uppercase;
}

.post-image-wrap {
    flex: 1 1 auto;
    min-height: 400px;
    background-color: #fff;
    background-image:
        linear-gradient(rgba(17,24,39,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17,24,39,.025) 1px, transparent 1px);
    background-size: 24px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.post-image {
    width: 100%;
    max-height: 650px;
    object-fit: contain;
    display: block;
    background: transparent;
}

.post-actions {
    border-top: 1px solid var(--app-border);
    background: #fff;
}

.reaction-button {
    border-radius: 999px;
    min-width: 94px;
}

.reaction-button.active-like {
    color: #0d6efd;
    background: rgba(13,110,253,.10);
    border-color: rgba(13,110,253,.25);
}

.reaction-button.active-dislike {
    color: #dc3545;
    background: rgba(220,53,69,.10);
    border-color: rgba(220,53,69,.25);
}

.topic-badge {
    border: 0;
    font-size: .78rem;
    font-weight: 600;
    background: rgba(13,110,253,.09);
    color: #0a58ca;
    padding: .45rem .7rem;
}


.post-header > .d-flex {
    flex-wrap: wrap;
}

.follow-button {
    flex: 0 0 auto;
    min-width: 94px;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease;
}

.follow-button:hover {
    transform: translateY(-1px);
}

.follow-button.is-following {
    box-shadow: 0 4px 12px rgba(13, 110, 253, .18);
}

.author-meta {
    line-height: 1.5;
}

.author-followers {
    white-space: nowrap;
}

.author-followers::before {
    content: "·";
    margin: 0 .25rem;
}

.feed-mode-switch .btn {
    min-width: 108px;
}

.shared-post-bar {
    border: 1px solid rgba(111, 66, 193, .2);
    background: rgba(111, 66, 193, .06);
    border-radius: 14px;
    padding: .8rem 1rem;
}

.inline-comments-panel {
    min-width: 0;
    border-left: 1px solid var(--app-border);
    background: #fbfcff;
    display: flex;
    flex-direction: column;
    max-height: 720px;
}

.comments-panel-header {
    flex: 0 0 auto;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
}

.comment-scroll {
    flex: 1 1 auto;
    min-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: .85rem;
}

.comment-scroll::-webkit-scrollbar {
    width: 8px;
}

.comment-scroll::-webkit-scrollbar-thumb {
    background: #cbd3e0;
    border-radius: 999px;
}

.comment-item {
    padding: .8rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(26, 40, 68, .035);
}

.comment-item + .comment-item {
    margin-top: .7rem;
}

.comment-drawing {
    max-height: 260px;
    width: 100%;
    object-fit: contain;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: #fff;
}

.comment-composer {
    flex: 0 0 auto;
    border-top: 1px solid var(--app-border);
    background: #fff;
    padding: .8rem;
}

.comment-composer textarea {
    resize: vertical;
    min-height: 72px;
    max-height: 150px;
}

.comment-drawing-pane {
    padding-top: .65rem;
}

.comment-drawing-pane .canvas-toolbar {
    padding: .5rem;
    gap: .4rem;
}

.comment-drawing-pane .toolbar-control {
    padding: .25rem .4rem;
    font-size: .75rem;
}

.comment-drawing-pane .toolbar-control input[type="range"] {
    width: 78px;
}

.comments-loader,
.comments-more-loader {
    color: var(--app-muted);
    text-align: center;
    font-size: .82rem;
    padding: .8rem;
}

.active-topic-bar {
    border: 1px solid rgba(13,110,253,.18);
    background: rgba(13,110,253,.055);
    border-radius: 14px;
    padding: .7rem 1rem;
}

.topic-sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
}

#topicColumn {
    min-width: 0;
}

@media (min-width: 1200px) {
    #feedColumn {
        width: 75%;
    }

    #topicColumn {
        width: 25%;
    }

    .topic-sidebar {
        max-height: calc(100vh - 108px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: .2rem;
        scrollbar-width: thin;
    }

    .topic-sidebar::-webkit-scrollbar {
        width: 7px;
    }

    .topic-sidebar::-webkit-scrollbar-thumb {
        background: #cbd3e0;
        border-radius: 999px;
    }
}

.topic-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(26, 40, 68, .055);
}

.topic-card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--app-border);
    background: linear-gradient(180deg, #fff, #fbfcff);
}

.topic-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .65rem;
    font-size: 1.1rem;
}

.topic-icon.trending {
    color: #dc3545;
    background: rgba(220,53,69,.10);
}

.topic-icon.popular {
    color: #6f42c1;
    background: rgba(111,66,193,.10);
}

.topic-list {
    padding: .45rem;
}

.topic-menu-item {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 13px;
    padding: .7rem .75rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    text-align: left;
    color: var(--app-text);
}

.topic-menu-item:hover,
.topic-menu-item.active {
    background: rgba(13,110,253,.075);
    color: #0a58ca;
}

.topic-rank {
    width: 27px;
    height: 27px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f4f9;
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.topic-menu-item.active .topic-rank,
.topic-menu-item:hover .topic-rank {
    color: #0a58ca;
    background: rgba(13,110,253,.12);
}

.topic-name {
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-score {
    flex: 0 0 auto;
    font-size: .72rem;
    color: var(--app-muted);
    background: #f4f6fa;
    border-radius: 999px;
    padding: .25rem .5rem;
}

.canvas-shell {
    background-color: #fff;
    background-image:
        linear-gradient(rgba(17,24,39,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17,24,39,.035) 1px, transparent 1px);
    background-size: 24px 24px;
    border: 1px solid #cfd7e6;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.75);
}

.canvas-shell canvas {
    width: 100%;
    height: auto;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .8rem;
    background: #f8f9fb;
    border: 1px solid var(--app-border);
    border-radius: 16px;
}

.toolbar-control {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .65rem;
    border: 1px solid #d7ddea;
    border-radius: 10px;
    background: #fff;
    font-size: .875rem;
}

.toolbar-control input[type="color"] {
    width: 32px;
    height: 28px;
    border: 0;
    background: transparent;
    padding: 0;
}

.toolbar-control input[type="range"] {
    width: 110px;
}

.empty-state {
    border: 1px dashed #cbd3e0;
    border-radius: 20px;
    background: rgba(255,255,255,.65);
}

/* Modal editor: form menjadi wadah fleksibel agar footer tidak keluar layar. */
#createPostModal .modal-dialog-scrollable .modal-content {
    overflow: hidden;
}

#createPostModal #createPostForm {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#createPostModal .modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#createPostModal .create-post-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    background: #fff;
    border-top: 1px solid var(--app-border);
    box-shadow: 0 -10px 24px rgba(23, 32, 51, .08);
}

@media (max-width: 1199.98px) {
    .topic-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .topic-sidebar .topic-card {
        margin-bottom: 0 !important;
    }
}

@media (max-width: 1199.98px) {
    .post-main-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    }
}

@media (max-width: 991.98px) {
    .post-main-grid {
        grid-template-columns: 1fr;
    }

    .inline-comments-panel {
        border-left: 0;
        border-top: 1px solid var(--app-border);
        max-height: none;
    }

    .comment-scroll {
        max-height: 430px;
    }

    .post-main-grid {
        min-height: 0;
    }

    .post-image-wrap {
        min-height: 300px;
    }
}

@media (max-width: 767.98px) {
    .topic-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .post-card,
    .topic-card {
        border-radius: 16px;
    }

    .reaction-button {
        min-width: auto;
        padding-left: .7rem;
        padding-right: .7rem;
    }

    .canvas-toolbar .btn {
        font-size: .82rem;
    }

    .comment-scroll {
        max-height: 390px;
    }
}

@media (max-height: 700px) {
    #createPostModal .modal-dialog {
        margin-top: .5rem;
        margin-bottom: .5rem;
        height: calc(100dvh - 1rem);
    }

    #createPostModal .modal-header {
        padding-top: .75rem;
        padding-bottom: .75rem;
    }

    #createPostModal .modal-footer {
        padding-top: .65rem;
        padding-bottom: .65rem;
    }
}

@media (max-width: 575.98px) {
    #createPostModal .modal-dialog {
        margin: .35rem;
        height: calc(100dvh - .7rem);
    }

    #createPostModal .modal-footer .btn {
        flex: 1 1 0;
    }
}


@media (max-width: 575.98px) {
    .post-header > .d-flex {
        align-items: flex-start !important;
    }

    .follow-button {
        min-width: auto;
    }

    .author-followers {
        display: block;
    }

    .author-followers::before {
        content: "";
        margin: 0;
    }

    .feed-mode-switch {
        width: 100%;
    }

    .feed-mode-switch .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .post-actions [data-share-post],
    .post-actions [data-focus-comments] {
        flex: 1 1 auto;
    }
}

/* Profil pengguna dan notifikasi */
.avatar-circle {
    overflow: hidden;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-link-button,
.profile-name-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.profile-link-button {
    border-radius: 50%;
    flex: 0 0 auto;
}

.profile-name-button:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.public-profile-card,
.profile-loading {
    border: 1px solid var(--app-border);
    border-radius: 24px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 12px 34px rgba(26, 40, 68, .07);
}

.profile-cover {
    height: clamp(130px, 18vw, 220px);
    background:
        radial-gradient(circle at 75% 25%, rgba(255,255,255,.25), transparent 24%),
        linear-gradient(135deg, #0d6efd, #6f42c1 62%, #d63384);
}

.profile-card-body {
    position: relative;
    padding: 0 clamp(1rem, 3vw, 2.25rem) 2rem;
}

.profile-avatar-large {
    position: relative;
    width: 132px;
    height: 70px;
}

.profile-avatar-large .avatar-circle {
    position: absolute;
    left: 0;
    top: -62px;
    border: 5px solid #fff;
    box-shadow: 0 8px 22px rgba(23, 32, 51, .18);
}

.profile-actions-top {
    min-height: 58px;
    padding-top: .8rem;
}

.profile-main-info {
    max-width: 920px;
}

.profile-bio {
    white-space: pre-line;
    max-width: 760px;
}

.profile-meta a {
    color: #0d6efd;
    text-decoration: none;
}

.profile-meta a:hover {
    text-decoration: underline;
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.profile-stat {
    min-width: 112px;
    padding: .75rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fbfcff;
}

.profile-stat strong,
.profile-stat span {
    display: block;
}

.profile-stat strong {
    font-size: 1.15rem;
}

.profile-stat span {
    color: var(--app-muted);
    font-size: .78rem;
}

.profile-avatar-editor {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: #f9fbff;
}

.profile-avatar-preview {
    flex: 0 0 auto;
}

.notification-menu-wrap .dropdown-menu {
    margin-top: .65rem !important;
}

.notification-toggle {
    width: 44px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #dc3545;
    border: 2px solid #fff;
    font-size: .65rem;
    font-weight: 700;
}

.notification-dropdown {
    width: min(410px, calc(100vw - 1rem));
    overflow: hidden;
}

.notification-header {
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
}

.notification-list {
    max-height: 430px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notification-item {
    position: relative;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    text-align: left;
}

.notification-item:hover {
    background: #f7f9fd;
}

.notification-item.unread {
    background: rgba(13, 110, 253, .065);
}

.notification-content {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .86rem;
    line-height: 1.35;
}

.notification-time {
    display: block;
    margin-top: .3rem;
    color: var(--app-muted);
    font-size: .72rem;
}

.notification-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #0d6efd;
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .profile-card-body {
        padding-bottom: 1.25rem;
    }

    .profile-actions-top {
        justify-content: flex-start !important;
        padding-top: 4rem;
    }

    .profile-avatar-large {
        height: 0;
    }

    .profile-main-info {
        margin-top: 1rem;
    }

    .profile-stat {
        flex: 1 1 calc(50% - .75rem);
        min-width: 0;
    }

    .profile-avatar-editor {
        align-items: flex-start;
        flex-direction: column;
    }

    .notification-dropdown {
        position: fixed !important;
        left: .5rem !important;
        right: .5rem !important;
        top: 68px !important;
        width: auto;
        transform: none !important;
    }
}

/* Update 005: colek/mention pengguna di komentar */
.mention-picker {
    margin-top: .55rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(26, 40, 68, .12);
}

.mention-picker-head {
    padding: .6rem;
    border-bottom: 1px solid var(--app-border);
    background: #f8faff;
}

.mention-results {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mention-user-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
    padding: .65rem .75rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    text-align: left;
}

.mention-user-item:last-child {
    border-bottom: 0;
}

.mention-user-item:hover,
.mention-user-item:focus-visible {
    background: rgba(13, 110, 253, .065);
    outline: 0;
}

.mention-user-info {
    min-width: 0;
    flex: 1 1 auto;
}

.mention-user-info strong,
.mention-user-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mention-user-info strong {
    font-size: .84rem;
}

.mention-user-info small {
    color: var(--app-muted);
    font-size: .73rem;
}

.comment-mention {
    display: inline;
    border: 0;
    background: transparent;
    color: #0d6efd;
    padding: 0;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.comment-mention:hover,
.comment-mention:focus-visible {
    color: #0a58ca;
    text-decoration: underline;
    outline: 0;
}

.comment-text {
    white-space: pre-wrap;
}

@media (max-width: 575.98px) {
    .comment-composer .btn {
        white-space: nowrap;
    }

    .mention-results {
        max-height: 200px;
    }
}

.comment-quick-mention {
    font-size: .72rem;
    color: #0d6efd;
}

.comment-quick-mention:hover {
    color: #0a58ca;
}

/* Update 006: layout dua kolom modal Buat Coretan dan mention pada keterangan */
#createPostModal .modal-dialog {
    max-width: min(1280px, calc(100vw - 2rem));
}

#createPostModal .create-post-layout {
    min-height: 0;
}

#createPostModal .create-post-canvas-column,
#createPostModal .create-post-meta-column {
    min-width: 0;
}

#createPostModal .create-post-canvas-shell {
    width: 100%;
}

#createPostModal .create-post-meta-panel {
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: #fbfcff;
    padding: 1rem;
    box-shadow: 0 10px 28px rgba(26, 40, 68, .06);
}

#createPostModal .create-post-field + .create-post-field {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
}

#createPostModal .create-post-caption-field textarea {
    min-height: 250px;
    resize: vertical;
}

#createPostModal .post-caption-mention-picker {
    margin-top: .75rem;
}

#createPostModal .post-caption-mention-picker .mention-results {
    max-height: 220px;
}

.post-caption {
    white-space: pre-wrap;
}

@media (min-width: 992px) {
    #createPostModal .create-post-meta-panel {
        position: sticky;
        top: 0;
    }
}

@media (max-width: 991.98px) {
    #createPostModal .modal-dialog {
        max-width: calc(100vw - 1.25rem);
    }

    #createPostModal .create-post-caption-field textarea {
        min-height: 150px;
    }
}

@media (max-width: 575.98px) {
    #createPostModal .modal-dialog {
        max-width: none;
    }

    #createPostModal .create-post-meta-panel {
        padding: .85rem;
        border-radius: 14px;
    }
}
