/* ─────────────────────────────────────────────────────────────────────────
   MXH (Mạng Xã Hội) — Social Network Page Styles
   ───────────────────────────────────────────────────────────────────────── */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.mxh-page {
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px 0 40px;
}

.mxh-container {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    align-items: start;
}

/* ── Left Sidebar ─────────────────────────────────────────────────────────── */

.mxh-sidebar-left {
    position: sticky;
    top: 72px;
}

.mxh-left-nav {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 16px;
}

.mxh-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 1rem;
    color: #c0392b;
}

.mxh-nav-brand svg {
    width: 22px;
    height: 22px;
    stroke: #c0392b;
}

.mxh-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mxh-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.mxh-nav-item:hover {
    background: #f5f5f5;
    color: #c0392b;
}

.mxh-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mxh-nav-logout-form {
    margin: 0;
}

.mxh-nav-logout {
    color: #888;
}

.mxh-nav-logout:hover {
    color: #c0392b;
}

.mxh-nav-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

/* Hot Tags */
.mxh-hot-tags {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.mxh-section-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #888;
    margin: 0 0 12px;
}

.mxh-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mxh-tag-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    background: #fef2f2;
    color: #c0392b;
    font-size: .8rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #fecaca;
    transition: background .15s, color .15s;
}

.mxh-tag-pill:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

/* ── Center Feed ──────────────────────────────────────────────────────────── */

.mxh-feed {
    min-width: 0;
}

/* Create Post Bar */
.mxh-create-post-bar {
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mxh-create-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #999;
}

.mxh-create-post-avatar svg {
    width: 22px;
    height: 22px;
}

.mxh-create-post-input {
    flex: 1;
    background: #f0f2f5;
    border: none;
    border-radius: 20px;
    padding: 9px 16px;
    font-size: .9rem;
    color: #888;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.mxh-create-post-input:hover {
    background: #e4e6ea;
}

/* Post Card */
.mxh-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 16px;
    overflow: hidden;
}

.mxh-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 8px;
}

.mxh-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #999;
    overflow: hidden;
}

.mxh-author-avatar svg {
    width: 24px;
    height: 24px;
}

.mxh-author-avatar picture.mxh-author-pic,
.mxh-author-avatar img.mxh-author-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mxh-card-meta {
    display: flex;
    flex-direction: column;
}

.mxh-author-name {
    font-weight: 600;
    font-size: .9rem;
    color: #1a1a1a;
    line-height: 1.3;
}

.mxh-post-time {
    font-size: .78rem;
    color: #999;
}

.mxh-card-body-link {
    display: block;
    padding: 4px 16px 10px;
    text-decoration: none;
    color: inherit;
}

.mxh-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
    line-height: 1.4;
}

.mxh-card-title:hover {
    color: #c0392b;
}

.mxh-card-desc {
    font-size: .88rem;
    color: #555;
    margin: 0;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mxh-card-image-link {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f0f2f5;
}

.mxh-card-image-link picture,
.mxh-card-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.mxh-card-image-link:hover img {
    transform: scale(1.03);
}

.mxh-card-pic {
    display: block;
    width: 100%;
    height: 100%;
}

/* Post Actions */
.mxh-post-actions {
    display: flex;
    border-top: 1px solid #f0f2f5;
    margin-top: 2px;
}

.mxh-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: none;
    border: none;
    border-radius: 0;
    color: #888;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.mxh-action-btn:hover {
    background: #f5f5f5;
    color: #c0392b;
}

.mxh-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Share Menu */
.mxh-share-wrap {
    position: relative;
    flex: 1;
    display: flex;
}

.mxh-share-wrap .mxh-action-btn {
    flex: 1;
}

.mxh-share-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    min-width: 170px;
    z-index: 100;
    overflow: hidden;
}

.mxh-share-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: .88rem;
    color: #333;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background .12s;
}

.mxh-share-opt:hover {
    background: #f5f5f5;
}

.mxh-share-opt svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mxh-share-fb { color: #1877f2; }
.mxh-share-x  { color: #000; }
.mxh-share-copy { color: #555; }

/* Infinite Scroll Trigger */
.mxh-load-more {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.mxh-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: .85rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #c0392b;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* ── Right Sidebar ────────────────────────────────────────────────────────── */

.mxh-sidebar-right {
    position: sticky;
    top: 72px;
}

.mxh-top-posts {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.mxh-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mxh-top-item {
    border-bottom: 1px solid #f0f2f5;
    padding: 10px 0;
}

.mxh-top-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mxh-top-item:first-child {
    padding-top: 0;
}

.mxh-top-link {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.mxh-top-link:hover .mxh-top-title {
    color: #c0392b;
}

.mxh-top-thumb {
    width: 100px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f2f5;
}

.mxh-top-thumb picture,
.mxh-top-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mxh-top-info {
    flex: 1;
    min-width: 0;
}

.mxh-top-title {
    font-size: .85rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.4;
    overflow: hidden;
}

.mxh-top-time {
    font-size: .75rem;
    color: #aaa;
}

/* ── Post Detail ──────────────────────────────────────────────────────────── */

.mxh-post-detail {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    padding: 20px;
    margin-bottom: 16px;
}

.mxh-post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mxh-author-info {
    display: flex;
    flex-direction: column;
}

.mxh-post-detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px;
    line-height: 1.4;
}

.mxh-post-detail-desc {
    font-size: .95rem;
    color: #555;
    margin: 0 0 16px;
    line-height: 1.6;
}

.mxh-post-detail-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.mxh-post-detail-body {
    font-size: 1rem;
    color: #333;
    line-height: 1.7;
    margin-bottom: 16px;
}
.mxh-post-detail-body > * {
    margin-top: 0;
    margin-bottom: 1.25em;
}
.mxh-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.mxh-tag-chip {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    color: #555;
    border-radius: 20px;
    font-size: .8rem;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.mxh-tag-chip:hover {
    background: #c0392b;
    color: #fff;
}

.mxh-post-actions--detail {
    border-top: 1px solid #f0f2f5;
    border-bottom: none;
}

.mxh-comments-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    padding: 20px;
}

.mxh-comments-loading {
    text-align: center;
    color: #aaa;
    padding: 24px 0;
    font-size: .9rem;
}

/* ── Create Post Modal ────────────────────────────────────────────────────── */

.mxh-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mxh-modal-overlay.active {
    display: flex;
}

.mxh-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modal-in .2s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mxh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.mxh-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.mxh-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}

.mxh-modal-close:hover {
    background: #f0f2f5;
    color: #333;
}

.mxh-modal-close svg {
    width: 20px;
    height: 20px;
}

.mxh-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.mxh-form-group {
    margin-bottom: 14px;
}

.mxh-input {
    width: 100%;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .95rem;
    color: #1a1a1a;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.mxh-input:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}

.mxh-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #f8f9fa;
    border: 1.5px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.mxh-editor-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 5px;
    color: #555;
    font-size: .9rem;
    line-height: 1;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
}

.mxh-editor-btn:hover {
    background: #e8e8e8;
    color: #c0392b;
}

.mxh-editor-sep {
    width: 1px;
    height: 18px;
    background: #ddd;
    margin: 0 4px;
}

.mxh-editor-content {
    min-height: 140px;
    border: 1.5px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 10px 14px;
    font-size: .9rem;
    color: #333;
    line-height: 1.6;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.mxh-editor-content:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}

.mxh-editor-content:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none;
}

.mxh-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.mxh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
}

.mxh-btn:active {
    transform: scale(.97);
}

.mxh-btn-secondary {
    background: #f0f2f5;
    color: #555;
}

.mxh-btn-secondary:hover {
    background: #e4e6ea;
}

.mxh-btn-primary {
    background: #c0392b;
    color: #fff;
}

.mxh-btn-primary:hover {
    background: #a93226;
}

/* ── New post card (inserted by HTMX) ────────────────────────────────────── */

.mxh-card.is-new {
    animation: card-in .4s ease;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .mxh-container {
        grid-template-columns: 220px 1fr;
    }

    .mxh-sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .mxh-container {
        grid-template-columns: 1fr;
        padding: 0 12px;
    }

    .mxh-sidebar-left {
        display: none;
    }

    .mxh-page {
        padding: 12px 0 40px;
    }

    .mxh-modal {
        max-height: 100%;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
    }

    .mxh-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
}

.home-mxh-post-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-mxh-list-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Home MXH Section ─────────────────────────────────────────────────────── */

.mxh-home-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    /* border-top: 3px solid var(--color-primary, #e63946); */
    border-bottom: 1px solid #e2e8f0;
    padding: 28px 0 32px;
    margin: 32px 0;
}

.mxh-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mxh-home-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.mxh-home-brand img {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

.mxh-home-brand span {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.01em;
}

.mxh-home-view-all {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary, #e63946);
    text-decoration: none;
    padding: 6px 14px;
    border: 1.5px solid var(--color-primary, #e63946);
    border-radius: 20px;
    transition: background 0.15s, color 0.15s;
}

.mxh-home-view-all:hover {
    background: var(--color-primary, #e63946);
    color: #fff;
}

.mxh-home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 32px;
}

.mxh-home-card {
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mxh-home-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mxh-home-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mxh-home-avatar svg {
    width: 20px;
    height: 20px;
    color: #94a3b8;
    fill: #94a3b8;
}

.mxh-home-card-author {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.mxh-home-author-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mxh-home-card-author time {
    font-size: 0.72rem;
    color: #9ca3af;
}

.mxh-home-card-body {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.mxh-home-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mxh-home-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mxh-home-title-link {
    color: #1a202c;
    text-decoration: none;
    transition: color 0.15s;
}

.mxh-home-title-link:hover {
    color: var(--color-primary, #e63946);
}

.mxh-home-read-more {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-primary, #e63946);
    text-decoration: none;
}

.mxh-home-card-thumb {
    width: 130px;
    aspect-ratio: 4/3;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .mxh-home-grid {
        grid-template-columns: 1fr;
    }
}
