
/* =========================================================
   MYBLOG - COMPLETE DARK MODE FIX
   Put this CSS LAST, before </head>
   ========================================================= */

html.dark-mode {
    color-scheme: dark;

    --dm-bg: #18191a;
    --dm-card: #242526;
    --dm-card-2: #3a3b3c;
    --dm-input: #3a3b3c;
    --dm-border: #3e4042;
    --dm-hover: #4e4f50;
    --dm-text: #e4e6eb;
    --dm-text-secondary: #b0b3b8;
    --dm-muted: #8b949e;
    --dm-primary: #4599ff;
}


/* =========================================================
   PAGE
   ========================================================= */

html.dark-mode,
html.dark-mode body {
    background: var(--dm-bg) !important;
    color: var(--dm-text) !important;
}

html.dark-mode body {
    color-scheme: dark;
}


/* =========================================================
   HEADER
   ========================================================= */

html.dark-mode .top-header {
    background: rgba(36, 37, 38, .97) !important;
    color: var(--dm-text) !important;
    border-bottom-color: var(--dm-border) !important;
}

html.dark-mode .brand-name {
    color: #4599ff !important;
}

html.dark-mode .header-button {
    background: var(--dm-card-2) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .header-button:hover {
    background: var(--dm-hover) !important;
}

html.dark-mode .header-profile {
    border-color: var(--dm-border) !important;
}

html.dark-mode .notification-badge {
    border-color: var(--dm-card) !important;
}


/* =========================================================
   ALL SECTIONS / CARDS
   ========================================================= */

html.dark-mode .section,
html.dark-mode .composer,
html.dark-mode .post,
html.dark-mode .ads-section,
html.dark-mode .empty-feed {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}


/* =========================================================
   SECTION HEADERS
   ========================================================= */

html.dark-mode .section-header {
    background: var(--dm-card) !important;
}

html.dark-mode .section-title {
    color: var(--dm-text) !important;
}

html.dark-mode .section-title i,
html.dark-mode .section-link {
    color: var(--dm-primary) !important;
}


/* =========================================================
   STORIES
   ========================================================= */

html.dark-mode .story-name {
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .story-avatar img {
    border-color: var(--dm-card) !important;
}

html.dark-mode .story-avatar.viewed {
    background: #555 !important;
}

html.dark-mode .story-add {
    border-color: var(--dm-card) !important;
}

html.dark-mode .no-stories {
    color: var(--dm-muted) !important;
}


/* =========================================================
   COMPOSER
   ========================================================= */

html.dark-mode .composer {
    background: var(--dm-card) !important;
}

html.dark-mode .composer-input {
    background: var(--dm-input) !important;
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .composer-actions {
    border-top-color: var(--dm-border) !important;
}


/* =========================================================
   REELS
   ========================================================= */

html.dark-mode .reels-list {
    background: var(--dm-card) !important;
}

html.dark-mode .reel-card {
    background: #111 !important;
}


/* =========================================================
   ADS
   ========================================================= */

html.dark-mode .ad-card {
    background: var(--dm-card) !important;
    border-color: var(--dm-border) !important;
}

html.dark-mode .ad-image {
    background: var(--dm-input) !important;
}

html.dark-mode .ad-label {
    color: var(--dm-muted) !important;
}

html.dark-mode .ad-title {
    color: var(--dm-text) !important;
}

html.dark-mode .ad-description {
    color: var(--dm-text-secondary) !important;
}


/* =========================================================
   POSTS
   ========================================================= */

html.dark-mode .post {
    background: var(--dm-card) !important;
}

html.dark-mode .post-author-name,
html.dark-mode .post-text {
    color: var(--dm-text) !important;
}

html.dark-mode .post-meta {
    color: var(--dm-muted) !important;
}

html.dark-mode .post-menu {
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .post-menu:hover {
    background: var(--dm-hover) !important;
}

html.dark-mode .post-content {
    color: var(--dm-text) !important;
}


/* =========================================================
   POST TEXT
   ========================================================= */

html.dark-mode .post-text,
html.dark-mode .post-text-short,
html.dark-mode .post-text-full {
    color: var(--dm-text) !important;
}

html.dark-mode .read-more-btn {
    color: var(--dm-primary) !important;
}

html.dark-mode .post-hashtag {
    color: var(--dm-primary) !important;
}


/* =========================================================
   POST MEDIA
   ========================================================= */

html.dark-mode .media-grid {
    background: var(--dm-bg) !important;
}

html.dark-mode .media-item {
    background: #111 !important;
}


/* =========================================================
   POST ACTIONS
   ========================================================= */

html.dark-mode .post-actions {
    background: var(--dm-card) !important;
    border-top-color: var(--dm-border) !important;
    border-bottom-color: var(--dm-border) !important;
}

html.dark-mode .post-action {
    background: transparent !important;
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .post-action:hover {
    background: var(--dm-hover) !important;
}

html.dark-mode .post-action.liked,
html.dark-mode .post-action.active-like,
html.dark-mode .post-action.active-save {
    color: var(--dm-primary) !important;
}

html.dark-mode .post-action i {
    color: inherit !important;
}


/* =========================================================
   POST COMMENTS / COMMENT BOX
   ========================================================= */

html.dark-mode .comment-form {
    background: var(--dm-card) !important;
    border-top-color: var(--dm-border) !important;
}

html.dark-mode .comment-form-input {
    background: var(--dm-input) !important;
    color: var(--dm-text) !important;
    border-color: var(--dm-border) !important;
}

html.dark-mode .comment-form-input::placeholder {
    color: var(--dm-muted) !important;
}

html.dark-mode .comment-form-input:focus {
    background: var(--dm-card-2) !important;
    border-color: var(--dm-primary) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .comment-send {
    background: var(--dm-primary) !important;
    color: white !important;
}


/* =========================================================
   POST MODAL
   ========================================================= */

html.dark-mode .post-modal {
    background: rgba(0, 0, 0, .82) !important;
}

html.dark-mode .post-modal-dialog {
    background: var(--dm-card) !important;
}

html.dark-mode .post-modal-side {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .post-modal-header {
    background: var(--dm-card) !important;
    border-bottom-color: var(--dm-border) !important;
}

html.dark-mode .modal-author-name {
    color: var(--dm-text) !important;
}

html.dark-mode .modal-author-meta {
    color: var(--dm-muted) !important;
}

html.dark-mode .post-modal-close {
    background: var(--dm-input) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .post-modal-close:hover {
    background: var(--dm-hover) !important;
}


/* =========================================================
   MODAL CONTENT
   ========================================================= */

html.dark-mode .modal-post-content {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .modal-post-text {
    color: var(--dm-text) !important;
}

html.dark-mode .modal-actions {
    background: var(--dm-card) !important;
    border-top-color: var(--dm-border) !important;
    border-bottom-color: var(--dm-border) !important;
}

html.dark-mode .modal-action {
    background: transparent !important;
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .modal-action:hover {
    background: var(--dm-hover) !important;
}

html.dark-mode .modal-action.liked {
    color: var(--dm-primary) !important;
}


/* =========================================================
   MODAL COMMENTS
   ========================================================= */

html.dark-mode .modal-comments {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .comment-item {
    background: transparent !important;
}

html.dark-mode .comment-content {
    background: var(--dm-input) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .comment-author {
    color: var(--dm-text) !important;
}

html.dark-mode .comment-text {
    color: var(--dm-text) !important;
}

html.dark-mode .comment-time {
    color: var(--dm-muted) !important;
}

html.dark-mode .comments-loading,
html.dark-mode .no-comments {
    color: var(--dm-muted) !important;
}


/* =========================================================
   MODAL COMMENT FORM
   ========================================================= */

html.dark-mode .comment-form {
    background: var(--dm-card) !important;
    border-top-color: var(--dm-border) !important;
}

html.dark-mode .modal-comment-avatar {
    border-color: var(--dm-border) !important;
}

html.dark-mode .comment-form-input {
    background: var(--dm-input) !important;
    border-color: var(--dm-border) !important;
}


/* =========================================================
   EMPTY FEED
   ========================================================= */

html.dark-mode .empty-feed {
    color: var(--dm-text) !important;
}

html.dark-mode .empty-feed h3 {
    color: var(--dm-text) !important;
}

html.dark-mode .empty-feed p {
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .empty-icon {
    color: var(--dm-primary) !important;
}


/* =========================================================
   BOTTOM NAV
   ========================================================= */

html.dark-mode .bottom-nav {
    background: rgba(36, 37, 38, .98) !important;
    border-top-color: var(--dm-border) !important;
}

html.dark-mode .bottom-nav a,
html.dark-mode .bottom-nav button {
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .bottom-nav a.active,
html.dark-mode .bottom-nav a:hover {
    color: var(--dm-primary) !important;
}


/* =========================================================
   DROPDOWNS / MENUS
   ========================================================= */

html.dark-mode .dropdown-menu,
html.dark-mode .post-menu-dropdown,
html.dark-mode .menu-dropdown,
html.dark-mode .action-menu {
    background: var(--dm-card) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,.45) !important;
}

html.dark-mode .dropdown-menu a,
html.dark-mode .dropdown-menu button,
html.dark-mode .post-menu-dropdown button,
html.dark-mode .menu-dropdown button {
    color: var(--dm-text) !important;
}

html.dark-mode .dropdown-menu a:hover,
html.dark-mode .dropdown-menu button:hover,
html.dark-mode .post-menu-dropdown button:hover,
html.dark-mode .menu-dropdown button:hover {
    background: var(--dm-hover) !important;
}


/* =========================================================
   INPUTS / TEXTAREAS / SELECTS
   ========================================================= */

html.dark-mode input,
html.dark-mode textarea,
html.dark-mode select {
    background: var(--dm-input) !important;
    color: var(--dm-text) !important;
    border-color: var(--dm-border) !important;
}

html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder {
    color: var(--dm-muted) !important;
}

html.dark-mode input:focus,
html.dark-mode textarea:focus,
html.dark-mode select:focus {
    background: var(--dm-card-2) !important;
    color: var(--dm-text) !important;
    border-color: var(--dm-primary) !important;
}

html.dark-mode select option {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}


/* =========================================================
   BUTTONS
   ========================================================= */

html.dark-mode button {
    color: var(--dm-text) !important;
}

html.dark-mode button:disabled {
    color: var(--dm-muted) !important;
    opacity: .7;
}


/* =========================================================
   LINKS
   ========================================================= */

html.dark-mode a {
    color: inherit;
}

html.dark-mode .section-link,
html.dark-mode .post-hashtag,
html.dark-mode .read-more-btn {
    color: var(--dm-primary) !important;
}


/* =========================================================
   SWEETALERT
   ========================================================= */

html.dark-mode .swal2-popup {
    background: var(--dm-card) !important;
    color: var(--dm-text) !important;
}

html.dark-mode .swal2-title {
    color: var(--dm-text) !important;
}

html.dark-mode .swal2-html-container {
    color: var(--dm-text-secondary) !important;
}

html.dark-mode .swal2-input,
html.dark-mode .swal2-textarea {
    background: var(--dm-input) !important;
    color: var(--dm-text) !important;
    border-color: var(--dm-border) !important;
}


/* =========================================================
   SCROLLBARS
   ========================================================= */

html.dark-mode * {
    scrollbar-color: #4e4f50 var(--dm-bg);
}

html.dark-mode *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html.dark-mode *::-webkit-scrollbar-track {
    background: var(--dm-bg);
}

html.dark-mode *::-webkit-scrollbar-thumb {
    background: #4e4f50;
    border-radius: 10px;
}

html.dark-mode *::-webkit-scrollbar-thumb:hover {
    background: #666;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    html.dark-mode .post-modal-dialog {
        background: var(--dm-card) !important;
    }

    html.dark-mode .post-modal-side {
        background: var(--dm-card) !important;
    }

    html.dark-mode .post-modal-header,
    html.dark-mode .modal-comments,
    html.dark-mode .comment-form {
        background: var(--dm-card) !important;
    }

}

html.dark-mode .topbar {
height: 58px;
    background: var(--bg-color);
    border-bottom: 1px solid #3c3b3b;
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

html.dark-mode .post-card {
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    overflow: hidden;
}
html.dark-mode .action-btn:hover {
    background: var(--bg-color);
}

/* End Dark Mode Styles */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f0f2f5;
    font-family: Arial, Helvetica, sans-serif;
    color: #050505;
}

.page {
    width: 100%;
    max-width: 760px;
    margin: 30px auto;
    padding: 0 12px;
}

.post-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    flex: 1;
}

.author-name {
    font-weight: 700;
    font-size: 15px;
}

.author-meta {
    color: #65676b;
    font-size: 13px;
    margin-top: 3px;
}

.post-content {
    padding: 4px 16px 14px;
    line-height: 1.5;
    /* white-space: pre-wrap; */
    word-break: break-word;
}

.media-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #ddd;
}

.media-item {
    background: #000;
    position: relative;
}

.media-item img,
.media-item video {
    width: 100%;
    display: block;
    max-height: 750px;
    object-fit: contain;
    background: #000;
}

.media-number {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,.65);
    color: #fff;
    padding: 5px 9px;
    border-radius: 15px;
    font-size: 12px;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    padding: 11px 16px;
    color: #65676b;
    font-size: 14px;
}

.post-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.action-btn {
    border: 0;
    background: transparent;
    padding: 12px 5px;
    cursor: pointer;
    color: #65676b;
    font-size: 14px;
    font-weight: 600;
}

.action-btn:hover {
    background: #f2f2f2;
}

.action-btn i {
    margin-right: 5px;
    font-size: 18px;
}

.action-btn.liked {
    color: #1877f2;
}

.action-btn.saved {
    color: #1877f2;
}

.comments {
    padding: 14px 16px;
}

.comment {
    display: flex;
    gap: 9px;
    margin-bottom: 14px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body {
    background: #f0f2f5;
    border-radius: 15px;
    padding: 8px 12px;
}

.comment-name {
    font-weight: 700;
    font-size: 13px;
}

.comment-text {
    font-size: 14px;
    margin-top: 3px;
}

.comment-time {
    color: #65676b;
    font-size: 11px;
    margin-top: 4px;
}

.comment-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #ddd;
}

.comment-form img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50%;
}

.comment-input {
    flex: 1;
    border: 0;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
}

.comment-send {
    border: 0;
    background: #1877f2;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

/* SHARE MODAL */

.share-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.share-overlay.show {
    display: flex;
}

.share-box {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0,0,0,.3);
}

.share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid #ddd;
}

.share-title {
    font-size: 20px;
    font-weight: 700;
}

.share-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #eee;
    cursor: pointer;
    font-size: 18px;
}

.share-body {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
}

.share-search {
    width: 100%;
    border: 0;
    background: #f0f2f5;
    padding: 12px 15px;
    border-radius: 22px;
    outline: none;
    margin-bottom: 12px;
}

.friend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
}

.friend-row:hover {
    background: #f0f2f5;
}

.friend-row img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-weight: 600;
}

.friend-username {
    color: #65676b;
    font-size: 12px;
}

.send-share {
    border: 0;
    background: #1877f2;
    color: #fff;
    border-radius: 18px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
}

.send-share:disabled {
    opacity: .6;
}

.share-message {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
    resize: vertical;
    min-height: 60px;
}

.empty-friends {
    text-align: center;
    color: #65676b;
    padding: 30px 10px;
}

.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #222;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10000;
    transition: .25s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

@media(max-width:600px) {

    .page {
        margin: 0 auto;
        padding: 0;
    }

    .post-card {
        border-radius: 0;
    }

    .media-item img,
    .media-item video {
        max-height: 600px;
    }
}


.save-button.saved {
    font-weight: 600;
}

.save-button.saved i {
    transform: scale(1.05);
}


.topbar {
            height: 58px;
            background: #fff;
            border-bottom: 1px solid #ddd;
            display: flex;
            align-items: center;
            padding: 0 15px;
            position: sticky;
            top: 0;
            z-index: 1000;
        }


        .back-btn {
            width: 40px;
            height: 40px;
            border: 0;
            background: transparent;
            border-radius: 50%;
            font-size: 23px;
            display: flex;
            align-items: center;
            justify-content: center;
        }


        .back-btn:hover {
            background: #f0f2f5;
        }


        .top-title {
            font-weight: 700;
            font-size: 18px;
            margin-left: 8px;
        }
