/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Global Light Mode Modal Optimization: No blur as requested */
html:not(.dark-mode) .modal,
html:not(.dark-mode) .modal-overlay,
html:not(.dark-mode) .admin-edit-modal,
html:not(.dark-mode) .custom-modal-overlay {
    backdrop-filter: none !important;
    background-color: rgba(0, 0, 0, 0.4) !important;
}

html:not(.dark-mode) .modal {
    backdrop-filter: none;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 500px;
    max-width: 90%;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

html.dark-mode .modal-content {
    background-color: rgba(45, 55, 72, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--shadow-light) !important;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--text-color-dark);
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.modal-content .form-row {
    display: flex;
    gap: 15px;
}

.modal-content .form-row>div {
    flex: 1;
}

.close-modal {
    color: var(--text-color-light);
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-color-dark);
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color-normal);
}

.comments-section {
    display: none;
    margin-top: 15px;
    padding: 15px;
    border-top: 1px solid var(--border-color-light);
    background: transparent; /* Đồng nhất với nền trắng của bài viết */
    border-radius: 8px;
}

.comments-section.show {
    display: block !important;
    visibility: visible !important;
}

.comment-trigger {
    cursor: pointer;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color-input);
    border-radius: 6px;
    background-color: var(--bg-input);
    color: var(--text-color-dark);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-footer {
    text-align: right;
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-color-hover);
}

.btn-success {
    background-color: var(--color-success);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-success:hover {
    background-color: #218838;
}

.alert-message {
    margin-bottom: 20px;
}

.alert-success {
    background-color: rgba(var(--success-rgb), 0.15);
    color: var(--color-success);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(var(--success-rgb), 0.25);
}

.alert-danger {
    background-color: rgba(var(--danger-rgb), 0.15);
    color: var(--color-danger);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(var(--danger-rgb), 0.25);
}

/* --- Layout --- */

.newsfeed-container {
    /* Inherit width from parent .container */
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Page Layout Grid: Main Feed + Right Sidebar */
.newsfeed-layout {
    display: block;
    width: 100%;
}

.newsfeed-main {
    width: 100%;
}

/* Ensure Feed fills the Main column (Fixing "bó hẹp" / constricted feel) */
.social-feed {
    max-width: 100%;
    /* Override profile css constraint */
    margin: 0;
}

/* Sidebar */
.newsfeed-sidebar {
    width: 100%;
    /* In grid, it fills the column width */
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 20px;
}

/* Sticky the last widget so sidebar is never empty on long scrolls */
.newsfeed-sidebar>*:last-child {
    position: sticky;
    top: 80px;
    z-index: 10;
}




/* Responsive: Stack on mobile */
@media (max-width: 991px) {
    .newsfeed-layout {
        grid-template-columns: 1fr;
    }

    .newsfeed-sidebar {
        display: none;
        /* Hide on mobile or stack if preferred */
    }
}

/* Adjust Header & Tabs to align with Main Column */
.clean-tabs-nav {
    display: flex;
    align-items: center;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 55px;
    background-color: var(--bg-body);
    z-index: 80;
    padding: 10px 0;
}




/* --- Social Post Styling --- */
/* 
   NOTE: All .social-post, .post-header, .visual-snippet styles are inherited strictly 
   from public/css/public-profile.css to ensure 100% consistency.
   DO NOT Duplicate styles here.
*/

.loading-state {
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Tab Transition Animation --- */
.feed-fade-in {
    animation: tabFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Widgets (Flat Modern Style) */
.sidebar-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    margin-bottom: var(--app-gap);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

html.dark-mode .sidebar-widget {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

html.dark-mode .sidebar-widget:hover {
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.widget-title {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-color);
    padding-left: 12px;
    border-left: 4px solid var(--primary-color);
    line-height: 1.2;
}

    opacity: 0.8;
}

/* Comment Bubble (Modern Minimalist - Soft Glass) */
.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-start;
    position: relative;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
}

.comment-bubble {
    background: var(--bg-hover);
    border: 1px solid var(--border-color-light);
    padding: 10px 16px;
    border-radius: 14px;
    display: inline-block;
    max-width: calc(100% - 45px);
    min-width: 80px;
    position: relative;
}

html.dark-mode .comment-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.replies-list {
    position: relative;
    border-left: 2px solid var(--border-color);
    margin-top: -2px;
    padding-top: 4px;
    transition: border-color 0.3s;
}

html.dark-mode .replies-list {
    border-left: 2px solid rgba(255, 255, 255, 0.05);
}

.replies-list:hover {
    border-left-color: var(--primary-color);
}

.comment-author {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 2px;
}

.comment-author a {
    color: inherit !important;
    text-decoration: none !important;
}

.comment-text {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.5;
    word-break: break-word;
}

.btn-text-tiny {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.btn-text-tiny:hover {
    color: var(--primary-color);
}

/* Comment Input Area (Neumorphic) */
.comment-input-area {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 15px;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color-input);
    border-radius: 30px;
    padding: 6px 18px;
    transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
}

.comment-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 8px 0 !important;
    font-size: 14px;
    color: var(--text-color);
    outline: none !important;
    box-shadow: none !important;
}

.input-wrapper input.comment-input:focus,
.input-wrapper input.comment-input:active,
.input-wrapper input.comment-input {
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

.send-comment-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s;
}

.send-comment-btn:hover {
    transform: scale(1.1);
}

.send-comment-btn:active {
    transform: scale(0.9);
}

/* --- Horoscope Post Decoration simplified --- */
/* Special border and background removed as requested */


.horoscope-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(90deg, var(--color-success), #5cd87a);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}