/* =========================
   REELS PAGE
========================= */

.reels-page {
    position: fixed;
    top: 0;
    left: 256px;
    width: calc(100% - 256px);
    height: 100dvh;
    z-index: 150;
    background: #000;
    color: #fff;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: block;
}

.reels-page[hidden] {
    display: none !important;
}

/* HEADER */

.reels-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
}

.reels-header button {
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.reels-header h2 {
    font-size: 19px;
    font-weight: 700;
}

/* REELS FEED */

.reels-feed {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    margin: 0;
    padding: 0;
}

.reels-feed::-webkit-scrollbar {
    display: none;
}

/* INDIVIDUAL REEL */

.reel-item {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    overflow: hidden;
}

/* VIDEO */

.reel-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* OVERLAY */

.reel-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(0,0,0,.75),
        transparent 40%,
        transparent 75%,
        rgba(0,0,0,.2)
    );
}

/* REEL DETAILS */

.reel-author,
.reel-caption,
.reel-actions {
    position: absolute;
    z-index: 2;
    pointer-events: auto;
}

.reel-author {
    bottom: 110px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reel-author img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.reel-caption {
    bottom: 55px;
    left: 16px;
    right: 85px;
    font-size: 14px;
    line-height: 1.5;
}

/* ACTION BUTTONS */

.reel-actions {
    right: 15px;
    bottom: 85px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.reel-actions button {
    border: none;
    background: transparent;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
}

.reel-actions i {
    width: 27px;
    height: 27px;
}

/* DESKTOP */

@media (min-width: 769px) {
    .reel-item {
        max-width: 480px;
        margin: 0 auto;
    }
}

/* MOBILE */

@media (max-width: 768px) {
    .reels-page {
        left: 0;
        width: 100%;
    }

    .reel-item {
        width: 100%;
        max-width: none;
    }
}

/* REELS COMMENTS OVERLAY */
.reel-comments-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.65);
}

.reel-comments-overlay[hidden] {
    display: none;
}

.reel-comments-panel {
    width: 100%;
    max-width: 600px;
    height: 65%;
    background: #fff;
    color: #222;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reel-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid #ddd;
}

.reel-comments-header h3 {
    margin: 0;
}

.reel-comments-header button {
    border: none;
    background: none;
    font-size: 28px;
    cursor: pointer;
}

.reel-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.reel-comments-list .post-comment-item {
    margin-bottom: 15px;
}

.reel-comments-list .post-comment-item p {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

#reelCommentForm {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid #ddd;
}

#reelCommentInput {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 22px;
    font-size: 16px;
}

#submitReelComment {
    padding: 10px 18px;
    border: none;
    border-radius: 22px;
    background: #6c4cff;
    color: #fff;
    cursor: pointer;
}

#submitReelComment:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* REEL COMMENT USER DETAILS */
.reel-comment-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.reel-comment-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}

.reel-comment-details {
    flex: 1;
    min-width: 0;
}

.reel-comment-author {
    padding: 0;
    border: none;
    background: none;
    color: #222;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.reel-comment-text {
    margin: 5px 0 0;
    color: #444;
    font-size: 14px;
    overflow-wrap: anywhere;
}