/* ========================================= */
/* --- GLOBAL OVERFLOW & TRUNCATION PROTECTIONS --- */
/* ========================================= */

/* THE FIX: Absolute global text-wrapping for unbreakable strings */
p, span, div, h1, h2, h3, h4, h5, h6, a, strong, b, i, em {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

html, body {
    overflow-x: clip !important; /* THE FIX: 'clip' hides horizontal overflow but FORBIDS the browser from destroying position: sticky! */
    max-width: 100vw !important;
}

* {
    /* THE FIX: Eradicate the ugly blue tap highlight on all mobile browsers! */
    -webkit-tap-highlight-color: transparent !important;
    box-sizing: border-box !important;
}

/* Force missing min-width: 0 on flex children to prevent text from pushing buttons off screen */
div[style*="flex: 1"], .user-info-text-col {
    min-width: 0 !important;
}

/* Force media buttons to stack nicely instead of spilling off screen */
.post-content div[style*="display: flex"], 
.post-content div[style*="gap: 10px"] {
    flex-wrap: wrap !important;
}

/* Force inline engagement badges to wrap text if compressed on top.html */
span[style*="white-space: nowrap"] {
    white-space: normal !important;
    word-wrap: break-word !important;
}

/* Aggressively truncate ALL usernames across ALL pages to ~10 characters max */
/* The Smart Flexbox Truncation Engine */
.user-info strong,
.user-info a,
.username-truncate {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important; /* Takes up all available space, but no more */
    display: block !important; 
}


/* --- 1. The Reset & Base Setup --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- 2. The Gradient Background --- */
body {
    background: linear-gradient(135deg, #1a0b2e 0%, #000000 100%);
    background-attachment: fixed; 
    color: #ffffff;
    min-height: 100dvh;
    padding-top: 70px;
    padding-bottom: 80px;
}

body.in-chat {
    overflow: hidden !important;
    height: 100dvh !important;
    padding-bottom: 0 !important; 
}

body.in-chat .bottom-nav {
    display: none !important; 
}

/* --- THE NEW GLOBAL TRUNCATION ENGINE --- */
.truncate-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.user-info-text-col {
    display: flex;
    flex-direction: column;
    min-width: 0; 
    flex: 1;
    margin-right: 10px;
}

/* --- 3. The Neon Green Welcome Message --- */
.welcome-message {
    background-color: rgba(0, 230, 118, 0.1); 
    color: #00e676; 
    border-bottom: 1px solid #00e676; 
    text-align: center;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    box-shadow: 0px 4px 15px rgba(0, 230, 118, 0.2); 
}

.welcome-message button {
    background-color: #00e676;
    color: #000000; 
    border: none;
    padding: 8px 20px;
    border-radius: 20px; 
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s ease;
    flex-shrink: 0; 
}

.welcome-message button:hover {
    box-shadow: 0px 0px 15px #00e676; 
}

/* --- 4. The Main Layout Container --- */
.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- 5. The Glassmorphism Sidebar --- */
.logo {
    font-size: 28px;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.logo span {
    color: #00e676; 
}

/* --- THE NAVIGATION OVERHAUL --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: #0b0f1a; 
    border-bottom: 2px solid #00e676; 
    display: flex; 
    align-items: center; 
    padding: 0 20px;
    z-index: 2000;
}

.top-bar .logo {
    position: absolute; 
    left: 50%;
    top: 50%; 
    transform: translate(-50%, -50%); 
    font-size: 24px;
    font-weight: bold;
    white-space: nowrap; 
    margin-bottom: 0; 
    z-index: 10; 
    padding: 5px 15px;
}

.menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #00e676;
    cursor: pointer;
    font-weight: bold;
    z-index: 2100; 
}

.menu-trigger .material-icons {
    padding: 8px;
    margin-right: 5px;
    border-radius: 8px;
}


/* --- THE OVERLAY MENU --- */
.overlay-menu {
    position: fixed;
    top: 0;
    left: -100%; 
    width: 100%;
    height: 100vh;
    background: rgba(11, 15, 26, 0.98);
    z-index: 5000; 
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 40px;
    padding-bottom: 80px; 
    box-sizing: border-box;
    overflow-y: auto; 
}

.overlay-menu.open {
    left: 0; 
}

.menu-header { 
    display: flex; 
    justify-content: flex-end; 
    margin-bottom: 30px;
    padding-top: 10px; 
}

.close-btn { 
    color: #ff3366; 
    cursor: pointer; 
    font-size: 35px; 
    flex-shrink: 0; 
}

.overlay-links { list-style: none; padding: 0; }
.overlay-links li { margin: 25px 0; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 10px; }
.overlay-links a { color: white; text-decoration: none; font-size: 22px; font-weight: bold; transition: 0.2s; }
.overlay-links a:hover { color: #00e676; padding-left: 10px; }

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    height: 70px;
    background: #0b0f1a;
    border-top: 2px solid #00e676;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
}

.bottom-nav a {
    color: #a09eb5;
    text-decoration: none;
    position: relative;
}

.bottom-nav a:hover {
    color: #00e676; 
    text-shadow: 0 0 15px rgba(0, 230, 118, 0.8); 
    transform: scale(1.1); 
    transition: all 0.3s ease; 
}

.bottom-nav .material-icons {
    font-size: 32px;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3366;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
    border: 2px solid #0f172a;
}

/* ========================================= */
/* --- NEW: THE GLOBAL STICKY COMPONENTS --- */
/* ========================================= */

.feed-header {
    position: sticky;
    top: 65px; 
    background: #1a0b2e; 
    z-index: 100;
    min-height: 60px;
    display: flex;
    justify-content: center; 
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
    margin-top: 0;
}

.feed-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.sticky-header {
    position: sticky;
    top: 65px; 
    background: #1a0b2e;
    z-index: 100;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.create-post-trigger {
    position: absolute;
    right: 20px;
    background: #00e676;
    color: #000;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
    transition: 0.3s ease;
    flex-shrink: 0;
}

.create-post-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.6);
}

.feed {
    flex: 1;
    max-width: 700px; 
    margin: 0 auto; 
    padding: 0 20px;
    padding-bottom: 250px !important; /* THE FIX: Ghost padding for Kebab Menu overflow */
}

.post {
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    border-radius: 20px; 
    padding: 25px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
}

.post:hover {
    background: rgba(255, 255, 255, 0.05); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); 
    transform: translateY(-2px); 
}

.user-info {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start; 
    flex-wrap: nowrap !important; 
    width: 100%;             
    max-width: 100%;
}

.user-info strong {
    cursor: pointer;
    font-size: 18px;
    color: #ffffff;
    transition: 0.2s;
}

.user-info strong:hover {
    color: #00e676; 
}

.time-stamp {
    color: #6a6680;
    font-size: 14px;
}

.post-content {
    font-size: 16px;
    line-height: 1.6;
    color: #d1d0dd; 
    margin-bottom: 20px;
}

.comment-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-input-wrapper {
    position: sticky;      /* Nails it to the screen */
    bottom: 0;             /* Nails it to the bottom */
    background: #0b0f1a;   /* Solid background so posts slide under it */
    padding: 15px 10px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-input {
    flex: 1;               /* Tells the text box to stretch */
    min-width: 0;          /* Crucial: Prevents the text box from pushing buttons away */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 20px;
    color: white;
    outline: none; 
}

.post-comment-btn {
    background: #00e676;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;        /* THE SHIELD: Prevents the button from shrinking or being pushed off screen! */
}

.comment-input:focus {
    border-color: #00e676; 
}

.post-comment-btn {
    background: #00e676;
    border: none;
    padding: 0 15px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0; 
}

.individual-comment {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.individual-comment strong {
    color: #00e676;
    margin-right: 5px;
}

.comment-thread {
    transition: background 0.3s ease;
}

.comment-thread:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* ========================================= */
/* --- CREATE POST MODAL COMPONENTS ---      */
/* ========================================= */

.create-post-box {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 0;
    overflow-y: auto; /* THE FIX: Enable inner scrolling for large media blocks */
    overflow-x: hidden;
    flex: 1; /* THE FIX: Command the box to fill all remaining vertical space */
    padding-right: 5px; /* Prevent the scrollbar from overlapping the close button */
}

.create-post-top {
    display: flex;
    gap: 15px;
}

.mini-profile-pic, .large-profile-pic, .inbox-item img, #chatHeaderAvatar, #chatInfoAvatar {
    object-fit: cover !important;
    object-position: center !important;
    background-color: #1e293b; 
}

.mini-profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%; 
    flex-shrink: 0; 
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    resize: none; 
    outline: none;
    padding-top: 10px;
    min-height: 80px;
}

.media-preview-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap; 
    gap: 10px;
}

.preview-item {
    position: relative;
    max-width: 100%;
}

.preview-item img, .preview-item video {
    border-radius: 15px;
    max-height: 300px;
    max-width: 100% !important;
    object-fit: contain !important;
    background-color: #0b0f1a;
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.create-post-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.upload-options {
    display: flex;
    gap: 20px;
}

.icon-btn {
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    padding: 8px;
    border-radius: 50%;
    flex-shrink: 0; 
}

.icon-btn:hover {
    background: rgba(0, 230, 118, 0.1);
    transform: scale(1.1); 
}

.main-post-btn {
    background: #00e676;
    color: black;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    flex-shrink: 0; 
}

.main-post-btn:hover {
    box-shadow: 0 0 15px #00e676;
}

.remove-media-btn {
    position: absolute; 
    top: -10px;         
    right: -10px;       
    background: #ff3366; 
    color: white;
    border: none;
    border-radius: 50%; 
    width: 35px;
    height: 35px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(255, 51, 102, 0.4); 
    transition: 0.2s ease;
    flex-shrink: 0; 
}

.remove-media-btn:hover {
    transform: scale(1.15); 
    background: #ff0040; 
}

/* ========================================= */
/* --- PROFILE PAGE SPECIFIC STYLES --- */
/* ========================================= */

.profile-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    margin-bottom: 25px;
    overflow: hidden; 
}

.profile-banner {
    height: 150px;
    background: linear-gradient(90deg, #3b82f6 0%, #00e676 100%); 
}

.profile-info-section {
    padding: 0 25px 25px 25px;
    position: relative;
}

.profile-pic-wrapper {
    position: relative;
    display: inline-block;
    margin-top: -50px; 
    border: 5px solid #0f172a; 
    border-radius: 50%;
}

.large-profile-pic {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
}

.edit-pic-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    flex-shrink: 0; 
}

.edit-pic-btn:hover {
    background: #00e676;
}

.profile-details {
    margin-top: 15px;
}

.profile-display-name {
    font-size: 24px;
    font-weight: 700;
}

.profile-username {
    color: #6a6680;
    font-size: 16px;
    margin-bottom: 15px;
}

.bio-section {
    margin-bottom: 20px;
}

.bio-text {
    font-size: 16px;
    line-height: 1.5;
    color: #d1d0dd;
    margin-bottom: 10px;
}

.edit-bio-btn {
    background: transparent;
    border: 1px solid #00e676;
    color: #00e676;
    padding: 5px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    flex-shrink: 0; 
}

.edit-bio-btn:hover {
    background: rgba(0, 230, 118, 0.1);
}

.profile-stats-bar {
    display: flex;
    gap: 30px;
    padding-top: 15px;
    margin-bottom: 25px; 
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box {
    display: flex;
    flex-direction: column; 
}

.stat-number {
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
}

.stat-label {
    font-size: 14px;
    color: #6a6680;
}

.profile-tabs {
    display: flex;
    gap: 20px;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; 
    flex-wrap: nowrap; 
    white-space: nowrap; 
}

.profile-tabs::-webkit-scrollbar {
    display: none; 
}

.tab-btn {
    background: none;
    border: none;
    color: #6a6680;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 0;
    cursor: pointer;
    transition: 0.3s;
    flex-shrink: 0; 
    white-space: nowrap;
}

.active-tab {
    color: #00e676;
    border-bottom: 3px solid #00e676; 
}

.bio-edit-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #00e676; 
    color: #ffffff;
    font-size: 16px;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    min-height: 80px;
    resize: none; 
    outline: none;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.1); 
}

/* ========================================= */
/* --- MODAL POP-UP STYLES --- */
/* ========================================= */

.modal-overlay {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw; 
    height: 100vh; 
    background: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(10px); 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; 
}

.modal-card {
    background: rgba(26, 11, 46, 0.9);
    border: 1px solid rgba(255, 51, 102, 0.3);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out forwards;
    max-height: 85vh; /* THE FIX: Cap the absolute height to the device screen */
    display: flex; /* THE FIX: Convert into a dynamic vertical column */
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.modal-card h3 {
    font-size: 24px;
    color: #ffffff;
    margin-bottom: 10px;
}

.modal-card p {
    color: #a09eb5;
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-cancel-btn {
    background: transparent;
    border: 1px solid #6a6680;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    flex: 1; 
    flex-shrink: 0; 
}

.modal-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-confirm-btn {
    background: #ff3366; 
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    flex: 1;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
    flex-shrink: 0; 
}

.modal-confirm-btn:hover {
    background: #ff0040;
    transform: scale(1.05);
}

/* ========================================= */
/* --- SEARCH PAGE STYLES --- */
/* ========================================= */

.search-container {
    padding: 20px;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px; 
    padding: 5px 5px 5px 20px;
    transition: 0.3s;
}

.search-box:focus-within {
    border-color: #00e676;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
}

.search-icon {
    font-size: 18px;
    margin-right: 10px;
    color: #a09eb5;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    outline: none; 
    min-width: 0; 
}

.search-btn {
    background: #00e676;
    color: #000000;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    flex-shrink: 0; 
}

.search-btn:hover {
    box-shadow: 0 0 15px #00e676;
    transform: scale(1.05);
}

.search-results-area {
    padding: 20px;
}

.search-placeholder-text {
    text-align: center;
    color: #a09eb5;
    font-size: 16px;
    margin-top: 40px;
}

/* ========================================= */
/* --- COMMENT SECTION INTERACTIVITY --- */
/* ========================================= */

.comment-input-area:hover,
.comment-input:focus {
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
    border-color: #00e676;
    transition: 0.3s ease-in-out;
}

.post-comment-btn:hover,
.comment-action-btn:hover {
    box-shadow: 0 0 15px #00e676;
    transform: scale(1.05); 
    transition: 0.3s ease-in-out;
}

.media-control-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #00e676;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid rgba(0, 230, 118, 0.3);
    cursor: pointer;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease; 
    flex: 1 1 auto; 
    white-space: normal !important;
    text-align: center;
}

.media-control-btn:hover {
    background: rgba(0, 230, 118, 0.1);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.4); 
    transform: translateY(-2px); 
}

/* ========================================= */
/* --- ENGAGEMENT BUTTONS --- */
/* ========================================= */

.like-btn, .comment-btn, .repost-btn, .quote-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0; 
}

.like-btn:hover { background: rgba(255, 51, 102, 0.1); box-shadow: 0 0 12px rgba(255, 51, 102, 0.4); transform: translateY(-2px); }
.comment-btn:hover { background: rgba(0, 230, 118, 0.1); box-shadow: 0 0 12px rgba(0, 230, 118, 0.4); transform: translateY(-2px); }
.repost-btn:hover { background: rgba(0, 229, 255, 0.1); box-shadow: 0 0 12px rgba(0, 229, 255, 0.4); color: #00e5ff; transform: translateY(-2px); }
.quote-btn:hover { background: rgba(255, 235, 59, 0.1); box-shadow: 0 0 12px rgba(255, 235, 59, 0.4); color: #ffeb3b; transform: translateY(-2px); }

.nav-link-active { color: #00e676 !important; text-shadow: 0 0 10px rgba(0, 230, 118, 0.6); transform: scale(1.1); transition: 0.3s ease; }
.nav-link-active::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; background: #00e676; border-radius: 50%; box-shadow: 0 0 8px #00e676; }

.engagement-badge {
    margin-left: auto;       
    flex-shrink: 0;          
    white-space: normal;     
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* ========================================= */
/* --- THREADED COMMENT REFINEMENTS ---      */
/* ========================================= */
.comment-actions-wrapper {
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 13px;
    color: #a09eb5;
}

.comment-actions-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-actions-right {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-left: auto;
}

.thread-action-btn {
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: 20px; 
    transition: 0.2s ease;
}

.thread-action-btn:hover { background: rgba(255, 255, 255, 0.05); }
.like-btn.thread-action-btn:hover { background: rgba(255, 51, 102, 0.1); color: #ff3366; }
.repost-btn.thread-action-btn:hover { background: rgba(0, 168, 255, 0.1); color: #00a8ff; }
.quote-btn.thread-action-btn:hover { background: rgba(0, 230, 118, 0.1); color: #00e676; }

.reply-action-btn {
    cursor: pointer;
    color: #a09eb5;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 20px;
    transition: 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.reply-action-btn:hover {
    color: #00e676;
    background: rgba(0, 230, 118, 0.1);
}

.timestamp-mobile-right {
    font-size: 11px;
    color: gray;
}


/* ========================================= */
/* --- NEW: MEDIA GALLERY & ADMIN STYLES --- */
/* ========================================= */
.media-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 5px; 
    margin-top: 15px;
}

.media-grid-item { 
    width: 100%; 
    aspect-ratio: 1/1; 
    object-fit: cover; 
    border-radius: 8px; 
    cursor: pointer; 
    border: 2px solid transparent; 
    transition: 0.2s;
}

.media-grid-item.selected { 
    border-color: #00e676; 
    filter: brightness(0.6); 
    transform: scale(0.95);
}

.group-member-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    transition: 0.2s;
}

.group-member-item:hover {
    background: rgba(255,255,255,0.05);
}

.admin-badge { 
    background: rgba(0, 230, 118, 0.1); 
    color: #00e676; 
    padding: 2px 6px; 
    border-radius: 8px; 
    font-size: 10px; 
    font-weight: bold; 
    border: 1px solid rgba(0, 230, 118, 0.3); 
    margin-left: auto; 
    flex-shrink: 0;
}

/* --- TOP ACTION BUTTONS (CREATE GROUP & SEARCH) --- */
.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s ease;
}

.action-btn:hover {
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    border-color: rgba(0, 230, 118, 0.3);
    transform: translateY(-2px);
}

.action-sheet-btn {
    width: 100%; 
    text-align: left; 
    background: rgba(0,0,0,0.3); 
    color: white; 
    border: 1px solid #334155; 
    padding: 12px; 
    border-radius: 8px; 
    cursor: pointer; 
    margin-bottom: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}
.action-sheet-btn:hover { background: rgba(0, 230, 118, 0.2); border-color: #00e676; }

/* ========================================= */
/* --- THE NEW IN-CHAT SEARCH BAR ---        */
/* ========================================= */
.chat-search-bar {
    display: flex;
    align-items: center;
    background: #0b0f1a;
    padding: 10px 15px;
    border-bottom: 1px solid #334155;
    gap: 10px;
}
.chat-search-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}
.chat-search-bar input:focus {
    border-color: #00e676;
}
.chat-date-header {
    text-align: center;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    width: 100%;
}
.chat-date-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a09eb5;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@keyframes searchGlow {
    0% { box-shadow: 0 0 0px transparent; }
    50% { box-shadow: 0 0 20px #00e676; background-color: rgba(0, 230, 118, 0.4); }
    100% { box-shadow: 0 0 0px transparent; }
}
.search-glow {
    animation: searchGlow 2s ease-out;
}
.search-highlight {
    border: 2px solid #00e676 !important;
    background-color: rgba(0, 230, 118, 0.2) !important;
}

/* ========================================= */
/* --- THE DEEP-LINK SCROLL & GLOW ENGINE ---*/
/* ========================================= */
@keyframes deepLinkGlow {
    0% { background-color: rgba(255, 255, 255, 0.03); box-shadow: 0 0 0px transparent; }
    15% { background-color: rgba(0, 230, 118, 0.3); box-shadow: 0 0 25px rgba(0, 230, 118, 0.8); transform: scale(1.02); }
    100% { background-color: rgba(255, 255, 255, 0.03); box-shadow: 0 0 0px transparent; transform: scale(1); }
}

.deep-link-glow {
    animation: deepLinkGlow 2.5s ease-out forwards;
    border-left: 4px solid #00e676 !important;
    z-index: 999;
}
/* ========================================= */
/* --- CUSTOM BUTTON REPLACEMENTS ---        */
/* ========================================= */

/* Fixes the Oval Send Button */
.chat-send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50% !important; /* Forces a perfect circle */
    background: #00e676;
    color: #0b0f1a;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0 !important;     /* Forbids Flexbox from turning it into an oval */
    cursor: pointer;
    transition: 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.5);
}

/* Fixes the Greedy Follow Button in Modals */
.modal-follow-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: #00e676;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
    flex-shrink: 0 !important;     /* Prevents squishing */
    width: max-content !important; /* Only be exactly as wide as the text */
}

.modal-follow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
}

/* Fixes the Missing Search Button */
.chat-search-btn {
    background: transparent;
    color: #00e676;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: 0.2s ease;
}

.chat-search-btn:hover {
    transform: scale(1.2);
}

/* ========================================= */
/* --- STRICT MOBILE RESPONSIVENESS ---      */
/* ========================================= */
@media (max-width: 768px) {
    .container { flex-direction: column; width: 100%; max-width: 100vw; }
    .sidebar { width: 100%; height: 70px; position: fixed; bottom: 0; top: auto; left: 0; padding: 0; display: flex; align-items: center; background: rgba(26, 11, 46, 0.95); border-right: none; border-top: 1px solid rgba(255, 255, 255, 0.1); z-index: 100; }
    .top-bar .logo { display: block; font-size: 20px; }
    .nav-links { display: flex; width: 100%; justify-content: space-around; }
    .nav-links li { margin-bottom: 0; }
    .nav-links a { font-size: 14px; padding: 10px; }
    .nav-links a.logout { margin-top: 0; }
    
    /* THE FIX: Changed padding-top from 65px to 0 to prevent the massive Double Padding void on mobile! */
    .feed { height: auto !important; padding-top: 0 !important; padding-bottom: 250px !important; display: flex; flex-direction: column; box-sizing: border-box; width: 100%; max-width: 100vw; }
    
    body.in-chat .feed { height: 100dvh !important; overflow: hidden; }
    
    .chat-container { flex: 1; display: flex; flex-direction: column; margin-bottom: 0; border-radius: 0; border: none; height: calc(100dvh - 135px); }
    body.in-chat .chat-container { height: calc(100dvh - 65px); overflow: hidden; } 
    
    #chatView { height: 100%; flex-direction: column; justify-content: space-between; }
    .chat-history { flex: 1; overflow-y: auto; padding-bottom: 20px; }
    .chat-input-area { position: sticky; bottom: 0; background: #0b0f1a; z-index: 10; padding: 10px; width: 100%; box-sizing: border-box; display: flex; gap: 10px; }
    .chat-input-area input { min-width: 0; }
    
    /* THE FIX: Push the post.html comment box upwards so it clears the 70px mobile bottom navigation bar! */
    .comment-input-wrapper {
        bottom: 70px !important;
    }
    .create-post-top { flex-direction: column; align-items: flex-start; }
    .mini-profile-pic { margin-bottom: 10px; }
    .profile-stats-bar { gap: 15px; justify-content: space-between; }
    .profile-tabs { overflow-x: auto; white-space: nowrap; padding-bottom: 5px; }
    html, body { overflow-x: clip !important; max-width: 100vw !important; width: 100% !important; }
    
    .post {
        margin-left: 10px !important;
        margin-right: 10px !important;
        width: calc(100% - 20px) !important;
        padding: 15px !important;
    }
    
    .comment-actions-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px; 
    }
    .comment-actions-left {
        width: 100%;
        justify-content: flex-start;
        gap: 12px; 
    }
    .comment-actions-right { 
        width: 100%;
        margin-left: 0; 
        justify-content: space-between;
    }
    .timestamp-mobile-right {
        margin-left: auto !important; 
    }
}

/* ========================================= */
/* --- MESSAGES PAGE STYLES (MIGRATED) ---   */
/* ========================================= */

.messages-page-container {
    width: 100% !important; 
    max-width: 100vw !important; 
    height: 100% !important; 
    padding: 0 !important; 
    margin: 0 !important; 
}

.messages-feed {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important; 
    box-sizing: border-box;
    height: calc(100vh - 70px); 
    display: flex;
    flex-direction: column;
}

.messages-feed .feed-header { 
    display: none !important; 
}

.chat-container {
    display: flex; 
    flex-direction: column; 
    flex: 1; 
    min-height: 0; 
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 !important; 
    border: none !important; 
    margin-bottom: 0 !important; 
    height: 100%; 
}

#inboxView { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-height: 0; 
}

.messages-sticky-header {
    position: sticky;
    top: 65px; 
    z-index: 100;
    background: #0b0f1a;
}

.inbox-item {
    display: flex; align-items: center; gap: 15px; padding: 15px; border-radius: 12px; cursor: pointer;
    transition: 0.2s; border-bottom: 1px solid rgba(255,255,255,0.05); margin: 0 10px;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.inbox-item:hover { background: rgba(0, 230, 118, 0.05); }

#chatView { 
    display: none; 
    flex-direction: column; 
    height: 100%; 
    min-height: 0; 
    position: relative; 
}

.chat-header {
    display: flex; align-items: center; gap: 10px; padding: 15px; background: rgba(0, 0, 0, 0.9); 
    border-bottom: 1px solid #334155; flex-shrink: 0; z-index: 50;
}

.chat-history {
    flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; min-height: 0;
}

.chat-input-area {
    display: flex; flex-direction: column; gap: 5px; padding: 15px; background: #0b0f1a; border-top: 1px solid #334155;
    flex-shrink: 0; width: 100%; box-sizing: border-box;
}

.chat-input-area input[type="text"] {
    flex: 1; padding: 12px 20px; border-radius: 25px; border: 1px solid rgba(0, 230, 118, 0.3);
    background: rgba(0,0,0,0.3); color: white; font-size: 15px; min-width: 0;
}

.msg-bubble {
    max-width: 75%; padding: 10px 15px; border-radius: 20px; font-size: 15px; line-height: 1.4; word-wrap: break-word;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

.msg-bubble.selected { border: 2px solid #00e676; background-color: rgba(0, 230, 118, 0.2) !important; }
.msg-sent { background: #00e676; color: #000; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-received { background: #334155; color: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }

/* ========================================= */
/* --- NATIVE VIDEO PLAYER OVERRIDES ---     */
/* ========================================= */
/* THE FIX: Eradicate the native 3-dot menu so it can never be clipped by the screen edge! */
video::-webkit-media-controls-overflow-button {
    display: none !important;
}
video::-webkit-media-controls-fullscreen-button {
    display: none !important; /* Hidden because we will provide our own perfectly aligned custom button */
}

/* ========================================= */
/* --- CUSTOM COMMENT SORTING ENGINE ---     */
/* ========================================= */
.comment-sort-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 0;
    margin-top: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative; 
    z-index: 150; 
}

.comment-sort-label {
    color: #a09eb5;
    font-size: 13px;
    margin-right: 10px;
    font-weight: bold;
}

.custom-sort-wrapper {
    position: relative;
    user-select: none;
}

.custom-sort-btn {
    background-color: #0b0f1a;
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.3);
    padding: 6px 12px 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 230, 118, 0.1);
}

.custom-sort-btn:hover {
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
    border-color: #00e676;
}

.custom-sort-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    display: none;
}

.custom-sort-option {
    padding: 12px 15px;
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    background: transparent;
}

.custom-sort-option:hover {
    background: #0078d7; 
    color: #ffffff;
}

.custom-sort-option.active {
    color: #00e676;
}

.custom-sort-option.active:hover {
    color: #ffffff;
}