/* ==========================
   posts.css
   ========================== */
/* Feed container */
section.feed {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 20px;
}

/* Post card */
.post {
    padding: 0px 25px 0px 25px;
    max-width: 100%;
    width: 100%;
    display: flex;
    border-bottom: 1px solid var(--border-default);
}

/* Post header */
.post__header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.post__header img {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    margin-right: 8px;
    object-fit: cover;
    border: 1px solid var(--sidebar-border);
}

.post__menu {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    margin-left: auto;
    transition: transform 0.1s ease;
    height: max-content;
}

.post__menu i {
    font-size: 17px;
}

/* Author & timestamp */
.post__author {
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 8px;
}

.post__timestamp {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Post body text */
.post__body {
    color: var(--text-tertiary);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Media wrapper */
.post__media {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    width: 100%;
    overflow-x: visible;
    gap: 8px;
    flex-wrap: nowrap;
    scrollbar-width: thin;
    padding-bottom: 4px;
}

.post__media img, .post__media video {
    max-height: calc(100vh - 60px);
    object-fit: contain;
    background: #000000;
    border-radius: 8px;
}

/* Footer: counts + controls */
.post__footer {
    width: 100%;
}

.post__counts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    margin: 8px 0px;
}

.post__count {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    font-size: 15px;
    color: var(--text-primary);
}

.post__count--like i, .post__count--comment i {
    border-radius: 50%;
    color: white;
    padding: 9px;
    margin-right: 8px;
}

.post__count--like i {
    background: green;
}

.post__count--comment i {
    background: maroon;
}

.post__divider {
    border: 0;
    border-top: 1px solid var(--border-default);
    margin: 0 0 8px;
}

.post__controls {
    display: flex;
    justify-content: space-evenly;
    padding-bottom: 8px;
}

.post__control-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
}

.post__control-btn i {
    font-size: 18px;
    margin-right: 8px;
}

button.post__control-btn:hover {
    color: var(--text-primary);
}

button.post__menu:hover {
    color: var(--text-primary);
}

.post__meta {
    font-size: 15px;
    margin-top: -2px;
    padding-right: 12px;
    color: var(--text-primary);
}

.post__info {
    font-size: 13px;
}

.post__meta > div > a {
    text-decoration: none;
    color: inherit;
    font-weight: 700;
}

.post__meta > div > a:hover {
    text-decoration: underline;
}

.post__header img:hover {
    border: 1px solid var(--text-tertiary);
}

/* Neutralize any box-shadow on the video element itself */
video {
    box-shadow: none !important;
    filter: none !important;
}


video::-webkit-media-controls, video::-webkit-media-controls-enclosure, video::-webkit-media-controls-panel, video::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-start-playback-button {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

video::-webkit-media-controls-panel {
    border: none !important;
}

/* POPUP MENU & BACKDROP */
.post-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 66%);
    z-index: 1010;
    opacity: 0;
    transition: opacity 200ms ease;
}

.post-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background: var(--bg-surface);
    border-radius: 18px;
    overflow: hidden;
    z-index: 1011;
    font-size: 16px;
    box-shadow: 0 0 20px -9px #000;
}

.post-menu__item {
    padding: 16px 16px;
    border-bottom: 1px solid var(--border-default);
    cursor: pointer;
    color: var(--text-primary);
    text-align: center;
    user-select: none;
    transition: background 0.2s;
}

.post-menu__item:last-child {
    border-bottom: none;
}

.post-menu__item:hover {
    background: var(--bg-search);
}

.post-menu__item.red {
    color: var(--logo-color);
    /* or your alert color */
    font-weight: 500;
}

.post-menu-backdrop.open {
    opacity: 1;
}

.post-menu {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    transition: opacity 200ms ease, transform 200ms ease;
}

.post-menu.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ----------------------------------------------------------------------------
   comment-modal.css  
   ---------------------------------------------------------------------------- */
/* backdrop */
.comment-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 200ms ease;
    z-index: 1000;
}

.comment-backdrop.open {
    opacity: 1;
}

/* modal container */
.comment-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: max-content;
    /* adjust as needed */
    max-width: calc(100vw - 140px);
    max-height: 970px;
    border-radius: 5px;
    transform: translate(-50%,-50%) scale(0.9);
    opacity: 0;
    display: flex;
    overflow: hidden;
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: 1001;
    box-shadow: 0 0 20px -9px #000;
    height: max-content;
}

.comment-modal.open {
    opacity: 1;
    transform: translate(-50%,-50%) scale(1);
}

.comment-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
}

.comment-modal__close:hover {
    color: #333;
}

/* left side: media */
.comment-media {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    height: calc(100vh - 80px);
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

.comment-media img, .comment-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* right side: comments panel */
.comment-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 400px;
    height: calc(100vh - 80px);
    max-width: 500px;
    border-left: 1px solid var(--border-default);
}

/* scrollable list */
.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: none;
}

/* each comment */
.comment-item {
    display: flex;
    margin-bottom: 16px;
}

.comment-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.comment-item .comment-body {
    flex: 1;
}

.comment-item .comment-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.comment-item .comment-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-item .comment-ts {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* input at bottom */
.comment-input {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border-default);
    padding: 11px 22px;
}

.comment-input input {
    flex: 1;
    border: none;
    font-size: 14px;
    outline: none;
}

.comment-input button {
    background: none;
    border: 1px solid var(--btn-border);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 9px 16px 8px 16px;
    border-radius: 8px;
    transition: transform 0.1s ease;
}

.comment-input button:disabled {
    opacity: 0.4;
    cursor: default;
}

.comment-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-default);
}

.comment-modal-header__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.comment-modal-header__username {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.comment-modal-header__close {
    background: none;
    border: none;
    cursor: pointer;
    margin: 0px 0px 0px 20px;
    display: grid;
    place-items: center;
}

.comment-modal-header__close:hover {
    color: var(--text-primary);
}

/* hide the old standalone close button */
.comment-modal__close {
    display: none;
}

/* make sure each comment-item can position its delete button */
.comment-item {
    position: relative;
    
    /* room for the trash icon */
}

/* style the trash button */
.comment-delete {
    position: relative;
    top: 0px;
    left: 4px;
    background: none;
    border: none;
    color: #ff0000;
    /* a nice red */
    font-size: 12px;
    cursor: pointer;
    opacity: 0.6;
}

.comment-delete i {
    pointer-events: none;
}

.comment-delete:hover {
    opacity: 1;
}

/* ======================================
   report modal & toast
   ====================================== */
.report-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgb(0 0 0 / 66%);
    opacity: 0;
    transition: opacity .2s;
    z-index: 1000;
}

.report-backdrop.open {
    opacity: 1;
}

.report-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) scale(0.9);
    width: 90%;
    max-width: 410px;
    background: var(--bg-surface);
    border-radius: 7px;
    overflow: hidden;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    z-index: 1001;
    font-size: 12px;
}

.report-modal.open {
    opacity: 1;
    transform: translate(-50%,-50%) scale(1);
}

.report-modal__header {
    padding: 11px;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid var(--border-default);
}

.report-modal__list {
    display: flex;
    flex-direction: column;
    padding-bottom: 2px;
}

.report-modal__item {
    padding: 8px 16px;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-default);
}

.report-modal__item:last-child {
    border-bottom: none;
}

.report-modal__item:hover {
    background: var(--bg-search);
}

.report-modal__cancel {
    color: var(--text-secondary);
}

a.comment-modal-header__avatar-link {
    display: flex;
    width: max-content;
    height: max-content;
}

a.comment-item__user-link {
    color: var(--text-primary);
    text-decoration: none;
}

img.post__avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

a.post__avatar-link {
    width: 40px;
    height: 40px;
    display: block;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 2px 0 #d1d1d1;
}

.post-right-content {
    display: flex;
    flex-direction: column;
    padding: 0px 0px 0px 12px;
    width: 100%;
}

.post__media img {
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.1s ease;
    height: -webkit-fill-available;
}

.feed-loading {
    text-align: center;
    padding: 1rem 0;
}

.feed-loading i {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.page-loader img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: top 0.6s ease, left 0.6s ease, transform 0.6s ease, width 0.6s ease;
}

.page-loader.move-to-corner img {
    top: 20px;
    left: 19px;
    transform: none;
    width: 43px;
}

.post__footer {
    padding: 7px 0px;
}

.post__actions {
    display: flex;
    align-items: center;
}

.post__action {
    background: var(--bg-surface);
    width: 42px;
    height: 33px;
    border: none;
    padding: 5px 5px 7px 5px;
    display: flex;
    align-items: center;
    cursor: pointer;
    box-shadow: inset 0 0 0 10px var(--bg-surface);
    border-radius: 50px;
    justify-content: center;
    transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.1s ease;
    margin: 0px 0px 0px 2px;
}

.post__action:last-child {
    margin-right: 15px;
    width: max-content;
}

.post__action--bookmark {
    position: absolute;
    right: 0px;
}

.post__action svg {
    width: 23px;
    height: 23px;
    padding-top: 3px;
    fill: var(--text-secondary);
}

.post__action-count {
    margin-left: 3px;
    font-size: 14px;
    color: var(--text-secondary);
    padding-top: 4px;
}

.post__action:hover {
    background: #b3b3b31a;
    box-shadow: inset 0 0 0 0px var(--bg-surface);
}

.post:first-child {
    padding-top: 16px;
}

button.post__action.post__action--like {
    margin-left: -5px;
}

.post__action--like.liked > span {
    color: #ff3939de;
}

.post__action--like.liked svg {
    fill: #ff3939de;
}

svg.saved-to-library {
    fill: var(--text-primary);
}

button.post__action.post__action--bookmark > svg {
    width: 25px;
    height: 25px;
}

.image-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.image-overlay__img {position: fixed;top: 0;left: 0;width: 100vw;height: 100vh;object-fit: contain;      /* fill & crop to maintain aspect ratio */object-position: center;z-index: 2;}

.image-overlay__close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #323232;
    border: none;
    color: #848484;
    font-size: 20px;
    z-index: 10001;
    cursor: pointer;
    border-radius: 99px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1px;
}

.image-overlay-wrapper {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010;
    width: 100vw;
    height: 100vh;
}

.post__media img:active {
    transform: scale(0.97);
}

.comment-preview-box {
  background: var(--bg-page);
  padding: 8px 11px;
  border-radius: 10px;
  margin: 0px 0 12px 0;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.comment-preview-box strong {
  font-size: 14px;
}

.comment-snippet {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.comment-snippet .comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 99px;
  object-fit: cover;
}

.comment-preview-box span:first-child {
    display: inline-flex;
    width: max-content;
    font-size: 13px;
    font-weight: 500;
}

.comment-preview-box span p {
    margin-left: 6px;
    color: var(--text-secondary);
}

.comment-preview-box:active {
    transform: scale(0.98);
}

button.post__action.post__action--comment svg {
    width: 22px;
    height: 22px;
}

.comment-snippet span {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: max-content;
    min-height: 28px;
}

.post__media > * {
  flex: 0 0;
  width: calc(65% - 4px);
}

.post__media > *:only-child {
  flex: 0 0 100%;
}

.comment-media-track {
  display: flex;
  transition: transform 0.3s ease;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
}

.comment-media-track img,
.comment-media-track video {
  flex: 0 0 100%;
  max-width: 100%;
  /* object-fit: cover; */         /* contain if you want letterboxing */
  max-height: 100%;
}

.comment-media-button {
    position: absolute;
    background: var(--bg-surface);
    border: none;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 99px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 4px 0 var(--shadow-default);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
    z-index: 10;
    opacity: 0.8;
}

.comment-media-button.left  { left: 10px; }
.comment-media-button.right { right: 10px; }

.comment-media-button.hidden {
  display: none;
}

.comment-media-button > i {
    padding-top: 1px;
}

/* place this in your stylesheet alongside the other .comment-media styles */

.comment-media-dots {
  position: absolute;
  bottom: 5px;            /* adjust as needed */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.comment-media-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.comment-media-dot.active {
  opacity: 1;
}

svg.close-comments-svg {
    fill: var(--text-secondary);
    width: 23px;
    height: 23px;
    padding: 1px 0px 0px 2px;
}

.post.is-unloaded .post__media { opacity: 0; }
.post.is-loaded   .post__media { opacity: 1; transition: opacity .2s ease; }

.video-triplet {
  display: grid;
  grid-template-columns: 1fr 1fr; /* left column, right column */
  gap: 5px;
  width: 100%;
}

/* 1) top-left square */
.video-triplet > .post:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
  aspect-ratio: 1 / 1;   /* force a square */
  min-height: 0;
}

/* 2) bottom-left square */
.video-triplet > .post:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
  aspect-ratio: 1 / 1;
  min-height: 0;
}

/* 3) right item spans both rows ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã‚Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ same height as 2 squares combined */
.video-triplet > .post:nth-child(3) {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
}

.post.post--video {
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
}

/* Media fills entire tile */
.post.post--video .post__media {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  z-index: 0; /* video at the bottom layer */
}
.post.post--video .post__media video,
.post.post--video .post__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* cover the whole tile */
  border-radius: 0;
  max-height: 100%;
  background: var(--bg-surface);
}

/* Only show the FIRST <video>; hide images and any extra videos */
.post.post--video .post__media > :not(video:first-of-type) {
  display: none !important;
}
.post.post--video .post__media > :not(video:first-of-type) {
  display: none !important;
}

/* Keep the menu button pushed to the right inside header */
.post.post--video .post__menu {
  margin-left: auto;
}

/* Container paddings around the grid */
.feed-videos {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

/* Black overlay (hidden by default) */
.post.post--video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;                    /* hidden initially */
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 1;                    /* above video, below header/body */
}

/* Header & Body positioned on top but hidden initially */
.post.post--video .post__header,
.post.post--video .post__body {
  position: absolute;
  left: 0;
  right: 0;
  padding: 8px;                  /* keep your spacing */
  z-index: 2;                    /* above overlay */
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  pointer-events: none;          /* not clickable until shown */
}

/* Pin header to top, body to bottom */
.post.post--video .post__header { top: 0; transform: translateY(-6px); }
.post.post--video .post__body   { bottom: 0; }

/* Hover reveals overlay + header + body */
.post.post--video:hover::after {
  opacity: .7;
}
.post.post--video:hover .post__header,
.post.post--video:hover .post__body {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s;
  pointer-events: auto;          /* clickable when visible */
}

.video-triplet .post .post__header .post__menu {
    color: var(--bg-surface);
    padding-top: 3px;
}

.video-triplet .post .post__header .post__meta {
    color: var(--bg-surface);
    font-size: 11px;
    margin-left: 5px;
}

.video-triplet .post .post__header .post__meta .post__info {
    font-size: 9px;
}

.video-triplet .post .post__header a.post__avatar-link {
    box-shadow: none;
    width: 30px;
    height: 30px;
    border: none;
}

.video-triplet .post .post__header .post__meta .post__title {
    max-width: 160px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.video-triplet .post .post__header .post__menu i {
    font-size: 15px;
    transform: rotate(90deg);
}

.post__body--video {
    color: var(--bg-surface);
    margin: 0px;
}

/* Alternate layout: even triplets get rectangle on the LEFT */
.feed-videos > .video-triplet:nth-of-type(even) > .post:nth-child(1) {
  grid-column: 2;
  grid-row: 1;
  aspect-ratio: 1 / 1;
}
.feed-videos > .video-triplet:nth-of-type(even) > .post:nth-child(2) {
  grid-column: 2;
  grid-row: 2;
  aspect-ratio: 1 / 1;
}
.feed-videos > .video-triplet:nth-of-type(even) > .post:nth-child(3) {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.comment-modal-header .post__header {
    width: 100%;
    margin: 0px;
    gap: 8px;
}

.comment-modal-header .post__header .post__meta {
    font-size: 14px;
}

.comment-modal-header .post__header .post__meta .post__info {
    font-size: 12px;
}

.comment-modal-actions {
    padding: 0px 16px;
}

.comment-modal-actions .post__footer .post__action:last-child {
    margin-right: 5px;
}