/* --- Global Reset & Sharp Edges --- */
/* No curves allowed, keep it sharp bro! */
*, *::before, *::after { 
    box-sizing: border-box; 
    border-radius: 0 !important; 
}

/* --- Root Variables --- */
/* The main color engine */
:root { 
    --primary-bg: #ffffff; 
    --secondary-bg: #f0f2f5; 
    --header-bg: #3b5998; 
    --nav-bg: #4e69a2; 
    --text-color: #1c1e21; 
    --text-muted: #65676b; 
    --border-color: #ced0d4; 
    --accent-color: #3578e5; 
    --wrapper-width: 1200px; 
}

/* --- Base Body Styles --- */
/* Standard setup for the base */
body { 
    font-family: Tahoma, Verdana, Arial, sans-serif;
    background-color: var(--secondary-bg); 
    margin: 0; 
    padding: 0; 
    color: var(--text-color); 
    line-height: 1.3; 
    -webkit-font-smoothing: antialiased; 
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.country-flag {
    width: 18px;
    height: 13.5px;
    vertical-align: middle;
    margin-left: 4px;
}

/* Main Wrapper */
.wrapper{
    width:100%;
    max-width:var(--wrapper-width);
    margin: 0 auto;
    display:flex;
    gap:5px;
    align-items:flex-start;
    background:transparent;
    border:none;
}

/* Main Content (70%) */
.main-content{
    width:70%;
    background:#fff;
    border-left:1px solid var(--border-color);
    border-right:1px solid var(--border-color);
}

/* Sidebar (30%) */
.sidebar{
    width:30%;
    position:sticky;
    top:65px;
    align-self:flex-start;
}
.side-box{
    background:#fff;
    border:1px solid #ddd;
    margin-bottom:15px;
}
.side-title{
    padding:10px;
    background:#f5f6f7;
    border-bottom:1px solid #ddd;
    font-weight:bold;
    font-size:14px;
}
.side-content{
    padding:0;
}
.side-links a{
    display:block;
    padding:9px 12px;
    color:#333;
    text-decoration:none;
    border-bottom:1px solid #eee;
    font-size:13px;
}
.side-links a:hover{
    background:#f5f6f7;
    color:#3578e5;
}
.side-links a:last-child{
    border-bottom:none;
}

/* --- Header & Search Bar --- */
.sticky-header{
    position:sticky;
    top:0;
    z-index:9999;
}

header{
    background:var(--header-bg);
    padding:6px 12px;
    display:flex;
    align-items:center;
    gap:10px;
}

.brand{
    color:#fff;
    font-size:18px;
    font-weight:bold;
    text-decoration:none;
    letter-spacing:-1px;
}

.search-bar{
    display:flex;
    flex:1;
    min-width:160px;
    background:#fff;
    border:1px solid #1d3567;
}

.search-bar input{
    border:none;
    padding:5px 10px;
    width:100%;
    outline:none;
    font-size:13px;
}

.search-bar button{
    background:#f0f2f5;
    border:none;
    border-left:1px solid #ddd;
    padding:0 12px;
    color:var(--text-muted);
    cursor:pointer;
}

/* --- Navigation Menu --- */
nav{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    background:var(--nav-bg);
    border-bottom:1px solid rgba(0,0,0,.15);
    padding:0;
}

nav a{
    color:rgba(255,255,255,.9);
    font-size:14px;
    padding:5px 8px;
    text-decoration:none;
    white-space:nowrap;
    line-height:1.3;
}

nav a.active,
nav a:hover{
    background:rgba(0,0,0,.1);
    color:#fff;
}

.nav-icon-wrap{
    position:relative;
    display:inline-block;
}

/* --- Search Results --- */
/* Showing what you found */
.search-results-wrap {
    background: #fff;
    min-height: 80vh;
}

.result-section-title {
    padding: 10px;
    background: #f6f7f9;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
    color: #666;
}

.user-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}

.u-avatar-img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.u-info b {
    display: block;
    color: var(--header-bg);
    font-size: 14px;
}

.u-info span {
    font-size: 11px;
    color: #777;
}

.country-flag-sm {
    width: 16px;
    height: 11px;
    vertical-align: middle;
    margin-left: 3px;
    border: 1px solid #eee;
}

#search-loader, #comment-loader-spinner, #post-loader-spinner, #load-notif-spinner {
    text-align: center;
    padding: 20px;
    display: none;
    color: var(--text-muted);
    font-size: 14px;
}

.no-results {
    padding: 50px 10px;
    text-align: center;
    color: #999;
}

/* --- Post Composer Card --- */
/* Where you write your story */
.composer-card { 
    padding: 12px; 
    background-color: #f6f7f9; 
    border-bottom: 8px solid var(--secondary-bg); 
}

.composer-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 10px; 
}

.avatar { 
    width: 40px; 
    height: 40px; 
    object-fit: cover; 
    border: 1px solid var(--border-color); 
    background: #eee; 
}

.input-title { 
    flex-grow: 1; 
    border: 1px solid var(--border-color); 
    padding: 6px 10px; 
    font-size: 14px; 
    outline: none; 
}

.input-story { 
    width: 100%; 
    height: 80px; 
    border: 1px solid var(--border-color); 
    padding: 8px; 
    font-family: inherit; 
    font-size: 13px; 
    resize: none; 
    margin-bottom: 10px; 
    outline: none; 
    display: block; 
}

#preview-container { 
    display: none; 
    margin-bottom: 10px; 
    border: 1px solid var(--border-color); 
    background: #fff; 
    padding: 5px; 
}

#preview-container img { 
    width: 100%; 
    max-height: 250px; 
    object-fit: contain; 
}

.form-row { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    margin-bottom: 10px; 
}

.select-custom { 
    flex: 1; 
    min-width: 140px; 
    padding: 6px; 
    border: 1px solid var(--border-color); 
    font-size: 12px; 
    background: #fff; 
}

.composer-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-top: 1px solid #ddd; 
    padding-top: 10px; 
}

.btn-upload { 
    font-size: 13px; 
    color: var(--accent-color); 
    cursor: pointer; 
    font-weight: bold; 
}

.btn-submit { 
    background-color: var(--header-bg); 
    color: #fff; 
    border: 1px solid #1d3567; 
    padding: 6px 20px; 
    font-weight: bold; 
    cursor: pointer; 
}

/* --- News Feed & Post Cards --- */
/* The main scrolling zone */
.feed { 
    background-color: var(--primary-bg); 
}

.post-card { 
    padding: 12px; 
    border-bottom: 8px solid var(--secondary-bg); 
    text-decoration: none; 
    color: inherit; 
    display: block; 
    position: relative; /* Added from profile post-card duplicate */
}

.post-top { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 10px; 
}

/* Post specific avatar */
.post-card .avatar {
    width: 40px;
    height: 40px;
}

.author-name { 
    font-weight: bold; 
    font-size: 14px; 
    color: var(--header-bg); 
    text-decoration: none; 
}

.post-meta { 
    font-size: 11px; 
    color: var(--text-muted); 
}

.post-title-display {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 5px;
    color: #333;
}

.post-text {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 5px;
    white-space: normal;
    word-wrap: break-word;
}

.read-more {
    color: var(--accent-color);
    font-weight: bold;
    cursor: pointer;
}

/* Flexible Feed Image */
.post-media {
    margin: 8px 0;
    background: #f5f5f5;
    border: 1px solid #ccd0d5;
    overflow: hidden;
    width: 100%;
    max-height: 600px;
    position: relative;
}

.post-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 600px;
    object-fit: contain;
    cursor: zoom-in;
    opacity: 0;
    transition: opacity .25s ease;
}

.post-media img.loaded {
    opacity: 1;
}

.image-loader {
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
}

.image-loader span {
    width:25px;
    height:25px;
    border:3px solid #ddd;
    border-top-color:#3578e5;
    border-radius:50%;
    animation:spin .8s linear infinite;
}

@keyframes spin {
    to { transform:rotate(360deg); }
}

/* --- Post Details & Comments --- */
/* Looking deeper into a post */
.post-detail {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.avatar-large {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.post-detail .post-meta {
    font-size: 12px;
}

.post-text-view a, 
.post-meta a {
    color: var(--header-bg);
    text-decoration: none;
}

.post-title-view {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
    color: #000;
}

.post-text-view {
    line-height: 1.4;
    font-size: 16px;
    margin-bottom: 12px;
    white-space: normal;
    word-wrap: break-word;
}

.post-text-view p {
    margin-bottom: 10px;
}

.comment-area {
    padding: 12px;
    background: #f6f7f9;
    border-bottom: 1px solid var(--border-color);
}

.comment-box-input {
    width: 100%;
    height: 65px;
    border: 1px solid var(--border-color);
    padding: 10px;
    font-size: 13px;
    margin-bottom: 8px;
    resize: none;
    outline: none;
    display: block;
    font-family: inherit;
}

/* Comment Styling */
.c-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.c-main-wrap {
    display: flex;
    gap: 10px;
}

.c-avatar-img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.c-content {
    background: #f0f2f5;
    padding: 8px 12px;
    width: fit-content;
    max-width: 90%;
}

.c-author {
    font-weight: bold;
    font-size: 12px;
    color: var(--header-bg);
    text-decoration: none;
    display: block;
    margin-bottom: 2px;
}

.c-txt {
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.c-actions {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 42px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.c-actions span.act-btn {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
}

.c-actions span.act-btn:hover {
    text-decoration: underline;
}

/* Reply Styling */
.replies-container {
    margin-left: 42px;
    margin-top: 8px;
    border-left: 2px solid #ddd;
    padding-left: 10px;
}

.reply-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.r-avatar {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.r-content {
    background: #f0f2f5;
    padding: 6px 10px;
    font-size: 12px;
    width: fit-content;
}

.reply-form-inline {
    display: none;
    margin-left: 42px;
    margin-top: 8px;
}

.reply-input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 5px;
    font-size: 12px;
    outline: none;
    margin-bottom: 5px;
}

.read-more-link {
    color: var(--accent-color);
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}

.hidden-part {
    display: none;
}

/* --- Image Viewer --- */
.image-viewer{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.95);
    display:none;
    justify-content:center;
    align-items:center;
    z-index:99999;
}

.image-viewer img{
    max-width:95vw;
    max-height:95vh;
    object-fit:contain;
}

.viewer-close{
    position:absolute;
    top:15px;
    right:20px;
    font-size:40px;
    color:#fff;
    cursor:pointer;
    user-select:none;
}

/* --- Stats & Interaction --- */
/* Likes and comments count */
.interaction-stats { 
    padding: 8px 0; 
    border-bottom: 1px solid #eee; 
    font-size: 12px; 
    color: var(--text-muted); 
    display: flex; 
    justify-content: space-between; 
}

.interaction-btns { 
    display: flex; 
    justify-content: space-around; 
    padding-top: 5px; 
}

.interaction-btns button { 
    background: none; 
    border: none; 
    color: var(--text-muted); 
    font-weight: bold; 
    font-size: 13px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 10px 5px; 
    flex: 1; 
}

/* --- Loader & Progress --- */
#loader { 
    text-align: center; 
    padding: 20px; 
    display: none; 
    color: var(--text-muted); 
    font-size: 13px; 
}

#global-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-color);
    display: none;
    z-index: 10000;
}

/* --- Profile Section --- */
/* The main user hub */
.profile-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.cover-box {
    width: 100%;
    aspect-ratio: 1280 / 474;
    overflow: hidden;
}

.cover-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meta-action-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 12px;
    margin-top: -45px;
    position: relative;
}

.avatar-box {
    position: relative;
    display: inline-block;
}

.avatar-box img {
    width: 95px;
    height: 95px;
    border: 4px solid #fff;
    object-fit: cover;
    background: #eee;
}

.action-btns-right {
    margin-bottom: 10px;
    display: flex;
    gap: 5px;
}

.btn-p {
    padding: 6px 15px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #f0f2f5;
    color: #333;
    height: 34px;
}

.btn-active {
    background: var(--header-bg);
    color: #fff;
    border-color: #1d3567;
}
.cover-box {
    position: relative;
    width: 100%;
}
.cam-overlay {
    position: absolute;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
    display: none;
}

.edit-mode-active .cam-overlay {
    display: block;
}

.cover-cam { top: 10px; right: 10px; }
.profile-cam { bottom: 8px; right: 8px; }

.details-box { padding: 0 8px 12px 12px; }
.details-box h2 { padding-bottom: 8px; margin:0; font-size: 20px; color: #000; }

.bio-text {
    color: var(--text-muted);
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.4;
}

.profile-stats {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.stat-item { font-size: 13px; color: #333; }

#edit-profile-form {
    display: none;
    background: #f6f7f9;
    padding: 12px;
    border: 1px solid #ddd;
    margin: 10px 12px;
}

.edit-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.opt-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
}

.opt-menu {
    display: none;
    position: absolute;
    top: 30px;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    z-index: 100;
    min-width: 120px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.opt-menu a {
    display: block;
    padding: 10px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    color: #333;
    text-decoration: none;
}

/* --- Notifications --- */
/* Who liked what bro */
.notif-wrapper {
    background: #fff;
    min-height: 85vh;
}

.notif-head {
    padding: 10px;
    background: #f6f7f9;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 14px;
}

.notif-link {
    display: flex;
    gap: 12px;
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.notif-link:hover { background: #f9f9f9; }

.notif-unread {
    background: #ebedf0;
    border-left: 3px solid var(--header-bg);
}

.actor-avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.notif-info { flex: 1; }

.notif-txt {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-color);
    margin-bottom: 3px;
}

.notif-txt b { color: var(--header-bg); }

.notif-date {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.type-icon { font-size: 11px; }
.icon-blue { color: #3578e5; }
.icon-green { color: #45bd62; }
.icon-red { color: #f3425f; }

/* --- Footer --- */
footer { 
    padding: 30px 10px; 
    text-align: center; 
    font-size: 12px; 
    color: var(--text-muted); 
    background: #fff; 
}
/* --- Responsive Stuff --- */
@media (max-width:768px){

    .wrapper{
        display:block;
        margin:0;
    }

    .main-content,
    .sidebar{
        width:100%;
    }

    .sidebar{
        position:static;
    }
    .post-media,
    .post-media img{
        max-height:480px;
    }

}
