/* MoodSpace custom styles — small overrides layered on top of SB Admin 2 */

body {
    background-color: #f0f2f5;
}

/* Mood picker buttons on the create-post card */
.mood-choice {
    cursor: pointer;
    border-radius: 1.5rem !important;
    margin-right: .35rem;
    font-size: .9rem;
}

.mood-choice input:checked + * ,
.mood-choice input:checked {
    /* no-op fallback; real highlighting handled via JS class below */
}

.mood-choice.active-mood {
    background-color: #4e73df;
    color: #fff;
    border-color: #4e73df;
}

/* Give post cards a little breathing room and softer shadow */
.card.shadow {
    box-shadow: 0 .15rem 1rem 0 rgba(58, 59, 69, .1) !important;
}

/* Avatar fallback circle (initials) */
.rounded-circle.text-white {
    flex-shrink: 0;
}

/* Smooth, modern feel across the app */
* {
    scroll-behavior: smooth;
}
.card,
.btn,
.dropdown-menu,
.reaction-btn,
.notification-item {
    transition: box-shadow .15s ease, transform .15s ease, background-color .15s ease, color .15s ease;
}
.card.shadow:hover {
    box-shadow: 0 .3rem 1.5rem 0 rgba(58, 59, 69, .14) !important;
}
.btn:active {
    transform: scale(0.97);
}

/* Verified "blue tick" badge */

/* Notification bell badge (top-right dot with count) */
.badge-counter {
    position: absolute;
    transform: scale(0.8);
    top: 0.25rem;
    right: 0.25rem;
}
#notif-dropdown-wrapper .nav-link {
    position: relative;
}
.dropdown-list {
    padding: 0;
    border: none;
    box-shadow: 0 .5rem 2rem rgba(58, 59, 69, .2);
    min-width: 22rem;
}
.dropdown-list .dropdown-header {
    background-color: #4e73df;
    color: #fff;
    padding: .85rem 1.25rem;
    font-weight: 700;
    border-radius: .35rem .35rem 0 0;
}
.notification-item {
    white-space: normal;
    padding: .75rem 1.1rem;
    border-bottom: 1px solid #eaecf4;
}
.notification-item.unread {
    background-color: #f0f6ff;
}
.notification-item:hover {
    background-color: #f4f6fb;
}
.notif-type-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    box-shadow: 0 0 0 2px #fff;
}
.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4e73df;
    flex-shrink: 0;
    display: inline-block;
}

/* Followers / Following clickable counts */
.follow-count-btn {
    color: inherit;
    text-decoration: none !important;
}
.follow-count-btn:hover strong {
    text-decoration: underline;
}
.follow-list-row {
    border-bottom: 1px solid #f0f2f5;
}
.follow-list-row:last-child {
    border-bottom: none;
}

/* Community reaction bar */
.reaction-btn {
    background-color: #f0f2f5;
    border: 1px solid transparent;
    border-radius: 1.5rem;
    color: #495057;
    font-size: .85rem;
    padding: .25rem .65rem;
}
.reaction-btn:hover {
    background-color: #e4e6eb;
}
.reaction-btn.active {
    background-color: #e7f0ff;
    border-color: #4e73df;
    color: #4e73df;
    font-weight: 700;
}
.reaction-emoji {
    margin-right: .25rem;
}
.community-post {
    animation: community-fade-in .35s ease;
}
@keyframes community-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.community-timestamp {
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------
 * Stories (Instagram-style)
 * --------------------------------------------------------- */
.story-tray {
    overflow-x: auto;
    overflow-y: hidden;
    gap: .9rem;
    padding: .25rem .1rem .9rem;
}
.story-avatar {
    flex: 0 0 auto;
    width: 74px;
    text-align: center;
}
.story-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    margin: 0 auto;
    border-radius: 50%;
    padding: 3px;
    text-decoration: none;
}
.story-ring img,
.story-ring > div {
    width: 100% !important;
    height: 100% !important;
}
.story-ring-unseen {
    background: linear-gradient(45deg, #f6c343, #e74a3b, #4e73df);
}
.story-ring-seen {
    background: #c2c7d0;
}
.story-ring-mine {
    background: #4e73df;
}
.story-ring-add {
    background: #f0f2f5;
    border: 2px dashed #c2c7d0;
    color: #858796;
    font-size: 1.1rem;
}
.story-label {
    font-size: .72rem;
    margin-top: .35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Full-screen story viewer overlay */
#storyViewerOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 1080;
}
#storyViewerOverlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
.story-viewer-stage {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100vh;
    background: #000;
    overflow: hidden;
}
.story-progress-row {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 3;
}
.story-progress-track {
    flex: 1 1 0;
    height: 3px;
    background: rgba(255, 255, 255, .35);
    border-radius: 2px;
    overflow: hidden;
}
.story-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
}
.story-viewer-header {
    position: absolute;
    top: 20px;
    left: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    color: #fff;
}
.story-viewer-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}
.story-viewer-media img,
.story-viewer-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.story-tap-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    z-index: 2;
    cursor: pointer;
}
.story-caption {
    position: absolute;
    bottom: 64px;
    left: 12px;
    right: 12px;
    z-index: 3;
    color: #fff;
    font-size: .95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.story-viewers-bar {
    position: absolute;
    bottom: 16px;
    left: 12px;
    right: 12px;
    z-index: 3;
    color: #fff;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.story-viewers-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 60%;
    background: #fff;
    border-radius: 1rem 1rem 0 0;
    z-index: 4;
    overflow-y: auto;
    padding: 1rem;
    display: none;
}
.story-viewers-panel.active {
    display: block;
}

/* Larger gradient ring around a profile page's main avatar when that
   user has an active story — tap it to open the full-screen viewer. */
.story-ring-profile {
    width: 96px;
    height: 96px;
    padding: 3px;
}

/* Reply box + heart at the bottom of the full-screen story viewer
   (shown to viewers, replaces the "views" bar the owner sees). */
.story-reply-bar {
    position: absolute;
    bottom: 16px;
    left: 12px;
    right: 12px;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 10px;
}
.story-reply-bar.active {
    display: flex;
}
.story-reply-input {
    flex: 1 1 auto;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 999px;
    color: #fff;
    padding: .5rem 1rem;
    font-size: .85rem;
}
.story-reply-input::placeholder {
    color: rgba(255, 255, 255, .75);
}
.story-reply-input:focus {
    outline: none;
    background: rgba(255, 255, 255, .18);
    color: #fff;
}
.story-like-btn,
.story-reply-send {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    flex: 0 0 auto;
    padding: 0 .25rem;
}
.story-like-btn.liked {
    color: #ed4956;
}

/* Heart that pops up briefly where the user double-tapped to like. */
.story-double-tap-heart {
    position: absolute;
    z-index: 5;
    color: #fff;
    font-size: 3.5rem;
    transform: translate(-50%, -50%) scale(0.4);
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
    animation: story-heart-pop .75s ease forwards;
}
@keyframes story-heart-pop {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    45% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---------------------------------------------------------
 * Instagram-style feed post photos
 * --------------------------------------------------------- */
.feed-post-card {
    overflow: hidden;
}
.feed-post-photo {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    display: block;
}

/* ---------------------------------------------------------
 * Direct Messages (Instagram-style chat)
 * --------------------------------------------------------- */
#dm-app {
    overflow: hidden;
}

.dm-list-pane {
    border-right: 1px solid #eaecf4;
    max-height: 70vh;
    overflow-y: auto;
}

.dm-list-header {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #eaecf4;
    font-size: 1.05rem;
}

.conversation-row {
    display: flex;
    align-items: center;
    padding: .65rem 1rem;
    text-decoration: none !important;
    color: inherit;
    border-bottom: 1px solid #f7f8fb;
}

.conversation-row:hover {
    background-color: #f7f9fc;
}

.conversation-row.active {
    background-color: #eef3ff;
}

.conversation-row-body {
    flex-grow: 1;
    min-width: 0;
    margin-left: .75rem;
}

.conversation-row-name {
    font-weight: 600;
    color: #3a3b45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-row-preview {
    font-size: .82rem;
    color: #858796;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-row.has-unread .conversation-row-preview,
.conversation-row.has-unread .conversation-row-name {
    color: #212529;
    font-weight: 700;
}

.conversation-row-meta {
    text-align: right;
    flex-shrink: 0;
    margin-left: .5rem;
}

.conversation-row-time {
    font-size: .7rem;
    color: #b0b3c1;
    white-space: nowrap;
}

.conversation-unread-dot {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    line-height: 18px;
    font-size: .68rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background-color: #4e73df;
    border-radius: 999px;
    margin-top: 2px;
}

.dm-chat-pane {
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.dm-chat-header {
    display: flex;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid #eaecf4;
    flex-shrink: 0;
}

.dm-back-btn {
    padding: 0 .5rem 0 0;
    color: #4e73df;
}

.dm-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #fbfbfd;
}

.dm-empty-state {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #858796;
    padding: 2rem;
}

.chat-msg-row {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-bottom: .5rem;
}

.chat-msg-row.msg-mine {
    justify-content: flex-end;
}

.chat-msg-row.msg-theirs {
    justify-content: flex-start;
}

/* Reply icon shown to the outside of the bubble on each row — a
   plain tap target (works the same on touch as it does with a mouse,
   no swipe gesture required). Dim by default, full opacity on tap/hover. */
.chat-msg-reply-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #858796;
    font-size: .75rem;
    opacity: .45;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-msg-reply-btn:hover,
.chat-msg-reply-btn:focus,
.chat-msg-reply-btn:active {
    opacity: 1;
    background: #eaecf4;
    outline: none;
}
.chat-msg-row.msg-mine .chat-msg-reply-btn {
    order: -1;
}

.chat-msg-bubble-wrap {
    max-width: 72%;
    display: flex;
    flex-direction: column;
}
.chat-msg-row.msg-mine .chat-msg-bubble-wrap {
    align-items: flex-end;
}
.chat-msg-row.msg-theirs .chat-msg-bubble-wrap {
    align-items: flex-start;
}

/* Quoted "replying to" snippet, sits directly above the bubble it
   belongs to and jumps back to the original message when tapped. */
.chat-msg-quote {
    max-width: 100%;
    font-size: .74rem;
    color: #6e7080;
    background: #f0f2f5;
    border-left: 3px solid #4e73df;
    border-radius: .5rem;
    padding: .3rem .55rem;
    margin-bottom: .2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.msg-mine .chat-msg-quote {
    border-left: none;
    border-right: 3px solid rgba(255, 255, 255, .6);
    background: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .9);
}

/* Brief highlight flash when jumping back to a quoted original message. */
.chat-msg-flash .chat-msg-bubble {
    box-shadow: 0 0 0 3px #f6c343;
}

.chat-msg-bubble {
    max-width: 100%;
    padding: .5rem .75rem;
    border-radius: 1.1rem;
    position: relative;
    animation: community-fade-in .2s ease;
}

.msg-mine .chat-msg-bubble {
    background-color: #4e73df;
    color: #fff;
    border-bottom-right-radius: .25rem;
}

.msg-theirs .chat-msg-bubble {
    background-color: #eaecf4;
    color: #3a3b45;
    border-bottom-left-radius: .25rem;
}

.chat-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .9rem;
}

.chat-msg-image {
    max-width: 100%;
    border-radius: .75rem;
    margin-bottom: .25rem;
    display: block;
}

.chat-msg-time {
    font-size: .65rem;
    opacity: .75;
    margin-top: .15rem;
    text-align: right;
}

.dm-image-preview {
    position: relative;
    padding: .5rem 1rem 0;
    flex-shrink: 0;
}

.dm-image-preview img {
    max-height: 90px;
    border-radius: .5rem;
}

.dm-image-preview-remove {
    position: absolute;
    top: .25rem;
    left: calc(1rem + 70px);
    background: #3a3b45;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    line-height: 20px;
    font-size: .9rem;
    padding: 0;
}

.dm-reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .9rem;
    background: #f0f2f5;
    border-top: 1px solid #eaecf4;
    flex-shrink: 0;
}
.dm-reply-preview-body {
    display: flex;
    align-items: center;
    color: #4e73df;
    font-size: .82rem;
    min-width: 0;
}
.dm-reply-preview-text {
    color: #6e7080;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-reply-preview-close {
    background: none;
    border: none;
    color: #858796;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    padding: 0 .25rem;
}

.dm-input-row {
    display: flex;
    align-items: center;
    padding: .75rem 1rem;
    border-top: 1px solid #eaecf4;
    flex-shrink: 0;
}

.dm-attach-btn {
    cursor: pointer;
    color: #4e73df;
    font-size: 1.15rem;
    margin: 0 .6rem 0 0;
}

.dm-text-input {
    border-radius: 1.5rem;
    margin-right: .6rem;
}

.dm-send-btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
}

@media (max-width: 767.98px) {
    .dm-hide-on-mobile {
        display: none !important;
    }
    .dm-list-pane,
    .dm-chat-pane {
        max-height: 75vh;
    }
}

/* Compact, Instagram-style profile header: avatar left, everything
   else (name/handle/badges/stats) packed into tight single lines to
   the right instead of stacking with big vertical gaps. */
.profile-header-compact {
    padding-bottom: 1.1rem;
}
.profile-header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.profile-header-avatar {
    flex-shrink: 0;
}
.profile-header-info {
    min-width: 0;
    flex: 1 1 auto;
}
.profile-identity-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}
.profile-username-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.profile-inline-badge {
    font-size: .6rem;
    vertical-align: middle;
}
.profile-handle-line {
    font-size: .82rem;
    line-height: 1.3;
    margin-top: .1rem;
}
.profile-stats-line {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-top: .45rem;
    font-size: .85rem;
    white-space: nowrap;
}
.profile-stats-line .btn-link {
    font-size: .85rem;
    color: inherit;
}
@media (max-width: 420px) {
    .profile-header-avatar img,
    .profile-header-avatar .rounded-circle {
        width: 64px !important;
        height: 64px !important;
    }
    .profile-stats-line {
        gap: .75rem;
    }
}

/* Profile action row: Follow + Message (or just Edit Profile), always a
   single full-width row underneath the header, Instagram-style. */
.profile-actions-row {
    display: flex;
    gap: .6rem;
    width: 100%;
    margin-top: 1rem;
}
.profile-actions-row .profile-action-form {
    flex: 1 1 0;
    display: flex;
    margin: 0;
}
.profile-actions-row .profile-action-btn {
    flex: 1 1 0;
    width: 100%;
}

/* dm.php — standalone, full-screen one-on-one chat (no sidebar/topbar).
   Uses the same .dm-* classes as the messages.php inbox, just stretched
   to fill the whole phone viewport instead of living inside a card. */
.dm-standalone {
    height: 100dvh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.dm-chat-pane-standalone {
    max-height: none !important;
    height: 100%;
    flex: 1 1 auto;
    display: flex;
}
.dm-standalone .dm-chat-header {
    padding-top: max(.75rem, env(safe-area-inset-top));
    flex-shrink: 0;
}
.dm-standalone .dm-back-btn {
    font-size: 1.1rem;
    padding: 0 .75rem 0 0;
}
.dm-standalone .dm-input-row {
    padding-bottom: max(.75rem, env(safe-area-inset-bottom));
    flex-shrink: 0;
}
.dm-standalone .dm-messages {
    -webkit-overflow-scrolling: touch;
}

/* Full-screen story viewer — mobile viewport height fix (100dvh avoids
   mobile browser URL-bar resize jumping the layout), plus safe-area
   padding so notches/home-indicators never cover controls. */
#storyViewerOverlay.active,
#storyViewerOverlay.story-view-standalone {
    height: 100dvh;
    height: 100vh;
}
.story-viewer-stage {
    height: 100dvh;
    height: 100vh;
}
.story-viewer-header {
    top: max(20px, env(safe-area-inset-top));
}
.story-progress-row {
    top: max(8px, env(safe-area-inset-top));
}
.story-reply-bar,
.story-viewers-bar {
    bottom: max(16px, env(safe-area-inset-bottom));
}
.story-caption {
    bottom: max(64px, calc(env(safe-area-inset-bottom) + 48px));
}

/* Bottom mobile navigation bar (Instagram-style), phone screens only. */
.bottom-nav {
    display: none;
}
@media (max-width: 767.98px) {
    body { padding-bottom: 58px; }
    body.no-bottom-nav-padding { padding-bottom: 0; }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        background: rgba(255, 255, 255, .92);
        -webkit-backdrop-filter: saturate(180%) blur(14px);
        backdrop-filter: saturate(180%) blur(14px);
        border-top: 1px solid #eaecf4;
        padding: .35rem .35rem max(.35rem, env(safe-area-inset-bottom));
        box-shadow: 0 -.15rem .6rem rgba(58, 59, 69, .08);
    }
    .bottom-nav-item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .15rem;
        text-decoration: none !important;
        color: #9092a3;
        font-size: 1.2rem;
        position: relative;
        padding: .3rem .2rem;
        margin: 0 .15rem;
        border-radius: .9rem;
        transition: background-color .15s ease, color .15s ease;
    }
    .bottom-nav-item:active {
        background-color: #f0f2f5;
    }
    .bottom-nav-item.active {
        color: #4e73df;
        background-color: #eef2ff;
    }
    .bottom-nav-item .bottom-nav-label {
        font-size: .6rem;
        font-weight: 700;
        letter-spacing: .01em;
    }
    .bottom-nav-item.active img.rounded-circle,
    .bottom-nav-item.active .rounded-circle {
        outline: 2px solid #4e73df;
        outline-offset: 1px;
    }
    .bottom-nav-badge {
        position: absolute;
        top: -1px;
        right: calc(50% - 20px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        line-height: 16px;
        font-size: .6rem;
        font-weight: 700;
        text-align: center;
        color: #fff;
        background: #e74a3b;
        border: 1.5px solid #fff;
        border-radius: 999px;
    }

    .topbar { z-index: 1030; }
}
