/* assets/css/style.css */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    color: #1c1e21;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Page */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    flex-direction: column;
}

.auth-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 350px;
    text-align: center;
    margin-bottom: 20px;
}

.auth-box h2 {
    color: #dc5451;
}

.auth-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.btn {
    width: 100%;
    padding: 10px;
    background-color: #dc5451;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
}

.btn:hover {
    background-color: #af4240;
}

.btn-green {
    background-color: #af4240;
}

.btn-green:hover {
    background-color: #d84441;
}

/* Header */
header {
    background: #ffffff;
    padding: 10px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

.logo {
    color: #dc5451;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
}

.user-menu {
    display: flex;
    gap: 15px;
    align-items: center;
}

.profile-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Feed & Layout */
.main-layout {
    display: flex;
    max-width: 1200px;
    margin: 20px auto;
    gap: 20px;
    padding: 0 10px;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
}

.feed-container {
    flex-grow: 1;
    max-width: 600px;
    /* margin: 20px auto; removed auto */
}

/* Sidebar Components */
.sidebar-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 20px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
    color: #65676b;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title.group-member-slidebar {
    font-size: 16px;
    font-weight: bold;
    color: #65676b;
    margin-bottom: 10px;
    display: block;
}

.group-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.group-list-item:hover {
    background-color: #f0f2f5;
}

.group-icon {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
}

.group-name {
    font-weight: 600;
    font-size: 15px;
}

/* Group Header (for group.php) */
.group-header-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 0;
    margin-bottom: 20px;
    overflow: hidden;
}

.group-cover {
    height: 200px;
    background: linear-gradient(to right, #1877f2, #00c6ff);
}

.group-header-info {
    padding: 20px;
    position: relative;
}

.group-header-title {
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.group-header-meta {
    color: #65676b;
    font-size: 14px;
    margin-bottom: 15px;
}

.group-join-btn {
    position: absolute;
    right: 20px;
    top: 20px;
}

/* Post Group Badge */
.post-group-badge {
    color: #65676b;
    font-size: 13px;
    font-weight: normal;
}

.post-group-badge a {
    font-weight: bold;
    color: #1c1e21;
    text-decoration: none;
}

.post-group-badge a:hover {
    text-decoration: underline;
}

.create-post {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.create-post textarea {
    width: 100%;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    min-height: 60px;
    outline: none;
    border-bottom: 1px solid #ccd0d5;
    margin-bottom: 10px;
}

.post {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

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

.post-avatar {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-info {
    flex-grow: 1;
}

.post-author {
    font-weight: bold;
    color: #1c1e21;
    display: block;
}

.post-date {
    font-size: 12px;
    color: #65676b;
}

.post-content {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 15px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.post-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
}

.post-actions {
    border-top: 1px solid #ccd0d5;
    padding-top: 10px;
    display: flex;
    gap: 10px;
}

.action-btn {
    background: none;
    border: none;
    color: #65676b;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
}

.action-btn:hover {
    background-color: #f0f2f5;
}

.action-btn.liked {
    color: #1877f2;
}

/* Comments */
.comments-section {
    margin-top: 10px;
    border-top: 1px solid #f0f2f5;
    padding-top: 10px;
}

.comments-list {
    margin-bottom: 10px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

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

.comment-body {
    background-color: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    flex-grow: 1;
}

.comment-header {
    margin-bottom: 4px;
}

.comment-author {
    font-weight: bold;
    font-size: 13px;
    color: #1c1e21;
}

.comment-text {
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.comment-image {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
}

.comment-actions {
    margin-left: 42px;
    font-size: 12px;
    color: #65676b;
    display: flex;
    gap: 10px;
}

.comment-action {
    cursor: pointer;
    font-weight: bold;
}

.comment-action:hover {
    text-decoration: underline;
}

.comment-action.liked {
    color: #1877f2;
}

.comment-form {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 10px;
}

.comment-form textarea {
    flex-grow: 1;
    border-radius: 18px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    resize: none;
    height: 36px;
    font-family: inherit;
    outline: none;
    background-color: #f0f2f5;
}

.comment-file-btn {
    padding: 8px;
    cursor: pointer;
    background: #e4e6eb;
    border-radius: 50%;
}

/* Modal Comment Input */
.comment-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.comment-input-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 18px;
    padding-right: 5px;
}

.comment-input-wrapper textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    resize: none;
    padding: 10px 12px;
    height: 40px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    overflow: hidden;
    /* Hide scrollbar if single line focus */
}

.btn-send {
    background: none;
    border: none;
    cursor: pointer;
    color: #1877f2;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-send:hover {
    background-color: #e4e6eb;
}

.btn-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Modal */
.modal {
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.4);
    /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 5vh auto;
    /* Use vh for better vertical centering/margin */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    animation-name: animatetop;
    animation-duration: 0.4s;
    max-height: 90vh;
    /* Prevent overflowing screen */
    overflow-y: auto;
    /* Scroll internally */
    display: flex;
    flex-direction: column;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

@keyframes animatetop {
    from {
        top: -300px;
        opacity: 0
    }

    to {
        top: 0;
        opacity: 1
    }
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
}

/* --- Mobile / Responsive --- */
/* --- Mobile / Responsive --- */
@media (max-width: 940px) {
    .main-layout {
        flex-direction: column;
        margin: 10px auto;
    }

    .sidebar {
        display: none;
        /* Hidden by default on mobile, moved to header menu */
        width: 100%;
    }

    .feed-container {
        width: 100%;
        max-width: 100%;
    }

    /* Mobile Groups Menu in Header */
    .mobile-groups-toggle {
        display: block !important;
        cursor: pointer;
        padding: 5px 10px;
        background: #f0f2f5;
        border-radius: 6px;
        font-weight: bold;
        font-size: 14px;
        margin-right: 10px;
    }

    .mobile-groups-dropdown {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100% - 60px);
        background: white;
        z-index: 999;
        display: none;
        overflow-y: auto;
        padding: 20px;
        box-sizing: border-box;
    }

    .mobile-groups-dropdown.active {
        display: block;
    }
}

@media (min-width: 941px) {

    .mobile-groups-toggle,
    .mobile-groups-dropdown {
        display: none !important;
    }
}

/* --- Header Redesign --- */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notif-icon-container {
    position: relative;
    cursor: pointer;
    font-size: 24px;
    /* Slightly larger for SVG */
    user-select: none;
    display: flex;
    align-items: center;
}

.bell-icon {
    width: 24px;
    height: 24px;
    fill: #65676b;
    /* Default Grey */
    transition: fill 0.3s ease;
}

.bell-icon.has-notif {
    fill: #000000;
    /* Black when has notifications */
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e41e3f;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    /* Allow expansion */
    height: 18px;
    padding: 0 4px;
    /* Padding for double digits */
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    /* Include padding in width */
    display: none;
    line-height: 1;
    /* Reset line height for centering */
}

.user-menu-container {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
}

.user-avatar-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
}

/* Dropdowns */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    width: 300px;
    /* Wider for notifications */
    display: none;
    z-index: 1000;
    overflow: hidden;
    margin-top: 10px;
}

.dropdown-item {
    padding: 10px 15px;
    display: block;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

/* Notification Items */
.notif-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: #f0f0f0;
}

.notif-item.unread {
    background: #e6f7ff;
    /* Distinct unread color */
}

.notif-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.3;
}

.notif-time {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

.notif-header {
    background: #fff;
    padding: 10px 15px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.mark-all-read {
    font-size: 11px;
    color: #1877f2;
    cursor: pointer;
}

/* Post Options Menu */
.post-header {
    position: relative;
    /* For absolute positioning of menu */
}

.post-options-btn {
    margin-left: auto;
    cursor: pointer;
    padding: 5px;
    color: #65676b;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
}

.post-options-btn:hover {
    background-color: #f0f2f5;
}

.post-options-menu {
    position: absolute;
    top: 30px;
    right: 10px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    width: 150px;
    z-index: 10;
    display: none;
    overflow: hidden;
    border: 1px solid #ddd;
}

.post-options-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #1c1e21;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-options-item:hover {
    background-color: #f0f2f5;
}

.post-options-item.delete {
    color: #dc3545;
}

/* Comment Options */
.comment-body {
    position: relative;
    padding-right: 30px;
    /* Space for menu trigger */
}

.comment-options-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    color: #65676b;
    cursor: pointer;
    font-weight: bold;
    display: none;
    /* Show on hover */
}

.comment-body:hover .comment-options-btn {
    display: block;
}

.comment-options-menu {
    position: absolute;
    top: 25px;
    right: 10px;
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 120px;
    z-index: 10;
    display: none;
    border: 1px solid #ddd;
}

.comment-options-item {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.comment-options-item:hover {
    background: #f0f2f5;
}

.edited-label {
    font-size: 11px;
    color: #65676b;
    margin-left: 5px;
    font-weight: normal;
}

.mark-all-read:hover {
    text-decoration: underline;
}