/* =========================================
   1. THEME SETUP & VARIABLES
========================================= */
:root {
    --bg-deep-space: #050a18;
    --bg-card-dark: #121a2b;
    --bg-glass: rgba(18, 26, 43, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a2b2c8;
    --neon-cyan: #00f2ff;
    --neon-purple: #bc13fe;
    --neon-pink: #ff0055;
    --star-gold: #e9081b;
    --cosmic-gradient: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    --glow-subtle: 0 0 15px rgba(0, 242, 255, 0.2);
    --glow-intense: 0 0 20px rgba(188, 19, 254, 0.5);
    --border-light: 1px solid rgba(255, 255, 255, 0.1);
}

/* =========================================
   2. GLOBAL RESET & BODY STYLE
========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: radial-gradient(circle at center, #0d1b38 0%, var(--bg-deep-space) 100%);
    color: var(--text-primary);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    background-image:
        radial-gradient(white, rgba(255,255,255,.2) 1px, transparent 2px),
        radial-gradient(white, rgba(255,255,255,.1) 1px, transparent 2px);
    background-size: 350px 350px, 200px 200px;
    opacity: 0.4;
    z-index: -1;
}

/* =========================================
   3. NAVBAR
========================================= */
.navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: var(--border-light);
    padding: 12px 20px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.nav-content { max-width: 935px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    background: var(--cosmic-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

#search-bar {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    padding: 8px 15px;
    border-radius: 20px;
    text-align: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

#search-bar::placeholder { color: var(--text-secondary); }

#search-bar:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-subtle);
}

.nav-icons i {
    font-size: 1.4rem;
    margin-left: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.nav-icons i:hover {
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

/* =========================================
   4. MAIN LAYOUT & STORIES
========================================= */
.container { max-width: 600px; margin: 30px auto; display: flex; flex-direction: column; gap: 25px; }

.stories-container {
    display: flex; gap: 15px; overflow-x: auto; padding: 20px;
    background: var(--bg-card-dark);
    border: var(--border-light);
    border-radius: 16px;
    scrollbar-width: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.story-circle {
    width: 70px; height: 70px;
    border-radius: 50%;
    padding: 3px;
    position: relative;
    background: var(--cosmic-gradient);
    cursor: pointer;
    transition: transform 0.2s;
}

.story-circle img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-card-dark);
    background: var(--bg-card-dark);
}

.story-circle:hover { transform: scale(1.05); }

.story-circle.seen {
    background: rgba(255, 255, 255, 0.2);
}

.story-item { display: flex; flex-direction: column; align-items: center; min-width: 75px; }
.story-username { font-size: 0.75rem; margin-top: 8px; color: var(--text-primary); }

/* =========================================
   5. FEED POSTS
========================================= */
.feed-list-view .post-card {
    background: var(--bg-card-dark);
    border: var(--border-light);
    border-radius: 16px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.post-header {
    padding: 15px; display: flex; align-items: center; gap: 12px;
    font-weight: 600; letter-spacing: 0.5px;
}
.post-avatar { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; border: 2px solid var(--neon-purple); }

.post-image-container { position: relative; cursor: pointer; }
.post-image { width: 100%; display: block; }
.overlay-heart {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: var(--star-gold);
    font-size: 6rem;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); opacity: 0; pointer-events: none;
    filter: drop-shadow(0 0 20px var(--star-gold)) drop-shadow(0 0 40px var(--star-gold));
    z-index: 5;
}
.overlay-heart.active { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }

.post-actions { padding: 12px 15px; font-size: 1.6rem; display: flex; gap: 18px; color: var(--text-primary); }
.post-actions i { cursor: pointer; transition: all 0.2s; }
.post-actions i:hover { color: var(--neon-cyan); filter: drop-shadow(0 0 5px var(--neon-cyan)); }

.fa-heart.liked {
    color: var(--neon-pink);
    filter: drop-shadow(0 0 10px var(--neon-pink));
    animation: pulse 0.4s ease-in-out;
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

.post-footer { padding: 0 15px 15px; }
.likes-count { font-weight: 700; margin-bottom: 8px; color: var(--text-primary); letter-spacing: 0.5px;}
.caption, .user-comment { margin-bottom: 6px; color: var(--text-secondary); }
.caption strong, .user-comment strong { color: var(--text-primary); font-weight: 600; margin-right: 5px;}
.comments-section { margin-top: 10px; color: var(--text-secondary); font-size: 0.9rem; }

.comment-input-box {
    display: flex;
    border-top: var(--border-light);
    padding: 15px;
    background: rgba(0,0,0,0.2);
}
.comment-input {
    flex: 1; border: none; outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.comment-input::placeholder { color: rgba(255,255,255,0.3); }
.post-comment-btn {
    color: var(--neon-cyan);
    font-weight: 700; cursor: pointer; border: none; background: none;
    font-size: 0.9rem; letter-spacing: 1px;
    transition: 0.2s;
}
.post-comment-btn:hover { filter: drop-shadow(0 0 5px var(--neon-cyan)); }

/* =========================================
   6. LOAD MORE BUTTON
========================================= */
#load-more {
    width: 100%; padding: 15px; border: none; border-radius: 30px;
    background: var(--cosmic-gradient);
    color: white; font-weight: bold; font-size: 1rem; letter-spacing: 1px;
    cursor: pointer;
    box-shadow: var(--glow-intense);
    transition: transform 0.2s;
}
#load-more:hover { transform: translateY(-3px); box-shadow: 0 0 30px rgba(188, 19, 254, 0.7); }

/* =========================================
   7. MODAL & OVERLAYS
========================================= */
.modal {
    background: rgba(5, 10, 24, 0.85);
    backdrop-filter: blur(15px);
}
.modal-content {
    background: var(--bg-card-dark);
    padding: 25px; border-radius: 20px; width: 400px;
    border: 1px solid var(--neon-purple);
    box-shadow: 0 0 40px rgba(188, 19, 254, 0.3);
    color: var(--text-primary);
}
.modal-content h2 { text-align: center; margin-bottom: 15px; font-weight: 300; letter-spacing: 1px; }

.modal-content input[type="file"],
.modal-content textarea {
    background: rgba(255,255,255,0.05);
    border: var(--border-light);
    padding: 10px; border-radius: 8px;
    color: var(--text-primary);
    width: 100%; outline: none;
}
.modal-content textarea { resize: none; height: 80px; }
.modal-content textarea:focus { border-color: var(--neon-cyan); }

#publish-btn {
    padding: 12px; border: none; border-radius: 8px;
    background: var(--neon-cyan); color: #000; font-weight: bold; cursor: pointer; transition: 0.2s;
}
#publish-btn:hover { background: white; box-shadow: 0 0 15px white; }
.close-modal { color: var(--text-secondary); transition: 0.2s; }
.close-modal:hover { color: var(--neon-pink); transform: rotate(90deg); }

/* =========================================
   8. UTILITIES & VIEW TOGGLES
========================================= */
.hidden { display: none !important; }

.feed-grid-view { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.feed-grid-view .post-card { border: none; margin: 0; border-radius: 0; box-shadow: none; }
.feed-grid-view .post-header, .feed-grid-view .post-footer, .feed-grid-view .post-actions, .feed-grid-view .comment-input-box { display: none; }
.feed-grid-view .post-image { height: 250px; object-fit: cover; filter: brightness(0.9); transition: 0.2s; }
.feed-grid-view .post-image:hover { filter: brightness(1.1); z-index: 2; transform: scale(1.02); box-shadow: 0 0 20px rgba(0,0,0,0.5); }

/* =========================================
   LOGIN OVERLAY
========================================= */
.login-overlay {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1a2a4a 0%, #050a18 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box-glass {
    background: rgba(18, 26, 43, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.15);
    width: 90%;
    max-width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.big-logo { 
    font-size: 3.5rem; 
    margin: 0;
    background: linear-gradient(135deg, #bc13fe, #00f2ff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(188, 19, 254, 0.5));
}

.login-subtitle {
    color: #a2b2c8;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-top: -10px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}
.input-icon {
    position: absolute;
    left: 15px; top: 50%;
    transform: translateY(-50%);
    color: #00f2ff;
}
.glass-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}
.glass-input:focus {
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

.choice-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.glow-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-cyan {
    background: #00f2ff;
    color: #050a18;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

.btn-purple {
    background: #bc13fe;
    color: white;
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.4);
}

.glow-btn:hover {
    transform: translateY(-3px) scale(1.05);
    filter: brightness(1.2);
}

.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: fadeIn 0.5s ease;
}
.no-results i {
    font-size: 3rem;
    color: var(--neon-purple);
    filter: drop-shadow(0 0 10px var(--neon-purple));
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================
   FIX FOR UPLOAD MODAL
========================================= */
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.modal {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #121a2b;
    padding: 30px; 
    border-radius: 20px; 
    width: 90%; 
    max-width: 450px;
    border: 1px solid var(--neon-cyan, #00f2ff);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.2);
    display: flex; 
    flex-direction: column; 
    gap: 15px;
    position: relative;
}

#caption-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: white;
    line-height: 20px;
}
.close-modal:hover { color: #ff0055; }

/* =========================================
   PROFILE PAGE STYLES
========================================= */
.profile-header-card {
    background: var(--bg-card-dark);
    border: var(--border-light);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.profile-pic-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    cursor: pointer;
}

#current-user-avatar {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
}

.edit-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    opacity: 0;
    transition: 0.3s;
}

.profile-pic-wrapper:hover .edit-overlay { opacity: 1; }
.edit-overlay i { color: white; font-size: 1.5rem; }

.profile-info { flex: 1; }

.profile-name-row { display: flex; align-items: center; gap: 20px; margin-bottom: 15px; }
.profile-name-row h2 {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 1px;
}

.edit-profile-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 5px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
.edit-profile-btn:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }

.profile-stats { display: flex; gap: 30px; margin-bottom: 15px; font-size: 1.1rem; }
.stat-count { font-weight: 800; color: var(--text-primary); }
.stat-item { color: var(--text-secondary); }
.stat-item.clickable { cursor: pointer; transition: 0.2s; }
.stat-item.clickable:hover { color: var(--neon-purple); }

.profile-bio { font-size: 0.95rem; line-height: 1.4; color: var(--text-primary); }

.highlights-bar {
    display: flex; gap: 20px; overflow-x: auto; padding: 10px 0 25px 0;
    margin-bottom: 10px;
    scrollbar-width: none;
}
.highlight-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-width: 70px; cursor: pointer;
}
.highlight-img-box {
    width: 65px; height: 65px;
    border-radius: 50%;
    padding: 2px;
    border: 1px solid var(--text-secondary);
    background: var(--bg-card-dark);
}
.highlight-img-box img {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--bg-card-dark);
}
.highlight-title { font-size: 0.8rem; font-weight: 600; }

.profile-tabs {
    display: flex; justify-content: center; gap: 50px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}
.tab {
    padding: 15px 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem; letter-spacing: 1px;
    position: relative;
}
.tab.active { color: white; }
.tab.active::before {
    content: ''; position: absolute; top: -1px; left: 0; width: 100%; height: 1px;
    background: var(--text-primary);
    box-shadow: 0 0 10px white;
}

.profile-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.grid-post {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
}
.grid-post img {
    width: 100%; height: 100%; object-fit: cover;
    transition: 0.3s;
}
.grid-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex; justify-content: center; align-items: center; gap: 20px;
    opacity: 0; transition: 0.2s;
    font-weight: bold; font-size: 1.2rem;
}
.grid-post:hover .grid-overlay { opacity: 1; }

@media (max-width: 600px) {
    .profile-header-card { flex-direction: column; text-align: center; padding: 20px; }
    .profile-pic-wrapper { margin: 0 auto; }
    .profile-name-row { justify-content: center; flex-direction: column; gap: 10px; }
    .profile-stats { justify-content: center; gap: 15px; font-size: 0.9rem; }
    .profile-grid-container { gap: 2px; }
}

.user-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}
.user-list-item:hover { background: rgba(255,255,255,0.05); }
.user-list-avatar { width: 40px; height: 40px; border-radius: 50%; }
.user-list-info { flex: 1; display: flex; flex-direction: column; }
.uli-username { font-weight: bold; color: var(--text-primary); }
.uli-name { font-size: 0.8rem; color: var(--text-secondary); }
.user-list-scroll { max-height: 300px; overflow-y: auto; }

/* =========================================
   POST VIEW MODAL
========================================= */
.modal-wide {
    width: 90%;
    max-width: 1100px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 85vh;
}

.post-modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
    background: var(--bg-card-dark);
}

.pm-image-container {
    flex: 1.5;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.pm-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pm-details-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pm-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.pm-username-text { font-weight: bold; color: var(--text-primary); }

.pm-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pm-comment-row {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.pm-comment-row strong { color: var(--text-primary); margin-right: 5px; }

.pm-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-card-dark);
}

@media (max-width: 768px) {
    .modal-wide { height: auto; max-height: 90vh; overflow-y: auto; }
    .post-modal-layout { flex-direction: column; }
    .pm-image-container { height: 400px; width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .pm-details-container { height: auto; }
    .pm-comments-list { max-height: 200px; }
}

/* =========================================
   SHARE MODAL
========================================= */
.share-modal-content {
    max-width: 400px;
    background: var(--bg-card-dark);
}

.share-targets-row {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}
.share-targets-row::-webkit-scrollbar { display: none; }

.share-target-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 70px;
    cursor: pointer;
}

.share-target-user img {
    width: 55px; height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: 0.2s;
}
.share-target-user:hover img { border-color: var(--neon-cyan); transform: scale(1.05); }
.share-target-user span { font-size: 0.75rem; color: var(--text-secondary); }

.share-actions-list {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}
.share-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.action-icon {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: 0.2s;
}
.share-action-item:hover .action-icon {
    background: var(--bg-deep-space);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}
.share-action-item span { font-size: 0.75rem; color: var(--text-secondary); }

/* =========================================
   TOAST NOTIFICATION
========================================= */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 242, 255, 0.9);
    color: #050a18;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 30000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#view-post-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #ffffff;
    font-size: 2.5rem;
    z-index: 1000;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 0;
    transition: 0.2s;
}

#view-post-modal .close-modal:hover {
    background: var(--neon-pink);
    color: white;
}

/* =========================================
   STORY & HIGHLIGHT VIEWER
========================================= */
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 50000;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.story-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#story-image {
    max-height: 85vh;
    max-width: 90vw;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.2);
    object-fit: contain;
}

.close-story {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}

.close-story:hover {
    background: var(--neon-pink);
    transform: scale(1.1);
}

@media (max-width: 600px) {
    .close-story {
        top: 20px;
        right: 20px;
        position: fixed;
    }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake-anim {
    animation: shake 0.3s ease-in-out;
    box-shadow: 0 0 15px #ff0055 !important;
}

/* =========================================
   FOLLOW BUTTON STYLES
========================================= */
.follow-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
    border: none;
    margin-left: 15px;
}

.follow-btn.not-following {
    background: var(--neon-cyan);
    color: #050a18;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}
.follow-btn.not-following:hover {
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
}

.follow-btn.following {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.follow-btn.following:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ff0055;
}

/* =========================================
   FEED FOLLOW BUTTON
========================================= */
.feed-follow-btn {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feed-follow-btn.following {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.1);
}
.feed-follow-btn.following:hover {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    background: rgba(255, 0, 85, 0.1);
    content: "Unfollow";
}

.feed-follow-btn.follow {
    background: var(--neon-cyan);
    color: #050a18;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
    border: 1px solid transparent;
}
.feed-follow-btn.follow:hover {
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.6);
    transform: scale(1.05);
}

/* =========================================
   9. MOBILE RESPONSIVENESS (FIXED)
========================================= */

/* 1. FORCE FIT - Prevents horizontal scrolling */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* 2. TABLET & MOBILE SHARED STYLES */
@media (max-width: 1024px) {
    .container { width: 100%; max-width: 100%; margin-top: 0; }
    .nav-content { padding: 0 15px; }
}

/* 3. MOBILE DEVICES (Phones) */
@media (max-width: 768px) {
    
    /* --- NAVBAR --- */
    .navbar { padding: 10px 15px; }
    .logo { font-size: 1.3rem; }
    
    /* Hide the text search bar on mobile to save space */
    #search-bar { display: none; } 
    /* Or make it tiny if you prefer: width: 120px; */

    .nav-icons { display: flex; gap: 15px; }
    .nav-icons i { margin-left: 0; font-size: 1.3rem; }


    /* --- MAIN FEED --- */
    .container {
        gap: 0;
        margin-bottom: 60px; /* Space for bottom scroll */
    }

    .feed-list-view .post-card {
        margin-bottom: 10px;
        border-radius: 0; /* Flat look */
        border-left: none;
        border-right: none;
    }

    /* --- PROFILE PAGE (Stacking) --- */
    .profile-header-card {
        flex-direction: column;
        text-align: center;
        padding: 20px 10px;
        gap: 15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .profile-pic-wrapper {
        width: 90px; height: 90px;
        margin: 0 auto;
    }

    .profile-name-row {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    .profile-name-row h2 { font-size: 1.5rem; }

    .profile-stats {
        justify-content: center;
        gap: 20px;
        font-size: 0.9rem;
    }

    /* --- STORIES --- */
    .stories-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 15px 10px;
        margin-bottom: 5px;
    }
    .story-circle { width: 65px; height: 65px; }


    /* --- MODALS (The Critical Fix) --- */
    /* Forces modals to shrink if the screen is small */
    .modal-content, 
    .login-box-glass, 
    .share-modal-content {
        width: 90% !important; /* Never wider than screen */
        max-width: 400px !important;
        margin: auto;
    }

    /* Post View (Theater Mode) Mobile Fix */
    .modal-wide {
        height: 100vh;
        max-height: 100vh;
        width: 100% !important;
        border-radius: 0;
    }
    .post-modal-layout { flex-direction: column; }
    .pm-image-container { 
        height: 50vh; 
        border-right: none; 
        border-bottom: 1px solid rgba(255,255,255,0.1); 
    }
    .pm-details-container { height: 50vh; }
    
    /* Move Close Button so it's visible on phones */
    #view-post-modal .close-modal {
        top: 10px; right: 10px;
        width: 35px; height: 35px;
        font-size: 1.5rem;
        background: rgba(0,0,0,0.6);
    }
}