:root {
    /* Light Mode Colors */
    --bg-primary: #f3f4f6;
    /* Light Gray Background */
    --bg-secondary: #ffffff;
    /* White (for inputs/backgrounds) */
    --bg-card: #ffffff;
    /* White Cards */

    --text-primary: #111827;
    /* Dark Text */
    --text-secondary: #6b7280;
    /* Gray Text */

    --accent: #63f168;
    /* Darker Green for visibility on white */
    --accent-hover: #4f46e5;

    --border: #e5e7eb;
    /* Light Border */
    --success: #16a34a;
    --danger: #ef4444;
}

/* 2. DARK MODE OVERRIDES */
/* When <body class="dark-mode"> is active, these values take over */
body.dark-mode {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #171717;

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;

    --accent: #63f168;
    /* Original Neon Green */
    --accent-hover: #818cf8;

    --border: #333333;
    --success: #22c55e;
    --danger: #ef4444;
}

/* 3. BODY STYLES (Added transition for smooth switching) */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Smooth toggle animation */
}

.flexDA {
    display: flex;
    align-items: center;
    gap: 5px;
}

.flex {
    display: flex;
    justify-content: center;
    align-items: center;
}

.comunitycontainer {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 60px;
    height: fit-content;
}

.sidebar-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
}

.sidebar-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.trending-list {
    list-style: none;
}

.trending-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.trending-list li:last-child {
    border-bottom: none;
}

.rank {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #e9e9e9;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}
body.dark-mode .tag{
    background: var(--bg-secondary);
}

.tag:hover {
    background: var(--accent);
    color: var(--text-primary);
}

/* Active Users */
.active-users {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-left: auto;
}

/* Events */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-item {
    display: flex;
    gap: 12px;
}

.event-date {
    background: var(--accent);
    border-radius: 10px;
    padding: 8px 12px;
    text-align: center;
    min-width: 50px;
    color: white;
}

.event-date .day {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.event-date .month {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
}

.event-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.event-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Avatar */
.avtar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.profileimage {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}


/* Create Post Card */
.divider {
    border: none;
    border-top: 3px solid #a0a0a06b;
    margin: 5px 0;
}


#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 50;
}

#overlay.active {
    opacity: 1;
    visibility: visible;
}

.mentionedbook {
    position: absolute;
    z-index: 51;
    /* higher than overlay */
}

.mentionedbook {
    display: none;
    position: absolute;
    width: 40%;
    left: 30%;
    padding: 10px;
    border: 1px solid rgb(205, 205, 205);
    border-radius: 10px;
    background: rgba(151, 151, 151, 0.347);

}

.search-container {
    display: flex;
    align-items: center;
    background: white;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
}

body.dark-mode .search-container {
    background: #212121;
}

.search-container input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 16px;
    background: none;
    color: inherit;
}

.watched-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode .watched-section {
    background: #212121;
}

body.dark-mode .watched-book:hover {
    background-color: rgb(69, 69, 69);
    border-radius: 10px;
}


.watched-book {
    padding: 8px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watched-book:hover {
    background-color: rgb(234, 234, 234);
    border-radius: 10px;
}

.watched-book:last-child {
    border-bottom: none;
}

.post-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tools {
    display: flex;
    gap: 10px;
}

.tool-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

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

/* Styles for the "Active" inputs when they appear */
.attachment-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-top: 10px;
}



.attachment-row input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
}

.image-row {
    position: relative;
    overflow: hidden;
    max-height: 500px;
}

.image-row img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 500px;
    border-radius: 8px;
}

.close-btn {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 12px;
}

.image-row .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

.login-reminder {
    background: #fff3f3;
    border: 1px solid #ffcccc;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 15px;
    color: #ff6402;
}

body.dark-mode .login-reminder {
    background: #444444;
}


.login-reminder span {
    color: #ff8602;
    font-weight: bold;
    text-decoration: underline;
}

.create-post-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

#postForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mainborder {
    border: 1px solid #9595952c;
    border-radius: 12px;
}


.editable-box {
    min-height: 100px;
    padding: 10px;
    outline: none;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 250px;
    overflow-y: auto;
}


.book-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #2d63ff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    margin: 2px;
    white-space: normal;
}

body.dark-mode .book-tag {
    background: var(--bg-secondary);
    ;
    color: var(--accent);
}


.book-tag img {
    width: 18px;
    height: 22px;
    border-radius: 4px;
}

.book-tag * {
    pointer-events: none;
}

.book-tag .remove-tag {
    pointer-events: auto;
    cursor: pointer;
    margin-left: 4px;
}


/* Image Upload */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.image-upload-area:hover {
    border-color: var(--accent);
}

.upload-placeholder {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.image-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: none;
}

.image-preview.show {
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    font-size: 14px;
}

.remove-image-btn.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-btn {
    background: var(--accent);
    color: rgb(0, 0, 0);
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-end;
}

.post-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Posts Feed */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.postoption{
    display: none;
    width: 100px;
    color: inherit;
    background: #d3d3d380;
    padding: 5px;
    text-align: center;
    border-radius: 5px;
    font-size: 12px;
    position: absolute;
    top: 0;
    font-weight: 600;
    right: 100%;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.deletepost:hover{
    background: rgba(255, 41, 41, 0.233);
}
body.dark-mode .postoption{
    background: #434343;
}

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

.post-content {
    font-size: 15px;
    line-height: 1.7;
    margin: 0px 0 15px 15px;
    padding: 10px 0 0 0;
}

.book-mention {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #d7d7d7;
    padding: 0px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #0005c3;
    font-weight: 700;
    margin: 0 0 10px 10px;
    border: 1px solid #696969;
}

body.dark-mode .book-mention {
    background: #363636;
    color: var(--accent);
}

.search-results-section {
    background: white;
    border-radius: 12px;
    ;
    padding: 3px;
}

body.dark-mode .search-results-section {
    background: #212121;
}

.search-book-item {
    margin: 5px;
}

.contentbox {
    background: #f0f0f0;
    border-radius: 7px;
    margin: 5px -15px 5px -15px;
    padding: 12px;
    box-sizing: border-box;
}

body.dark-mode .contentbox {
    background: #1f1f1f;
}

.post-images {
    display: flex;
    justify-content: center; 
    gap: 5px; 
    overflow: hidden;
    border-radius: 0 !important;
    width: 100%;
    height: 350px; 
}

.post-image {
    flex: 1; 
    width: 50%; 
    height: 100%; 
    object-fit: cover; 
    cursor: pointer;
    border-radius: 5px;
}

.post-image:only-child {
    flex: 0 0 auto; 
    width: auto;
    max-width: 100%;
    object-fit: contain; 
}

.image-modal {
    display: none;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 9999;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85);
}

/* Large image */
.modal-content-img {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 0 20px #000;
}

/* Close button */
.close-img-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}
.close-img-modal:hover {
    color: #f95a5a;
}

.post-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
}

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

.action-btn.liked {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.action-btn .count {
    font-weight: 600;
}
.skeleton-card {
    height: 70px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, #e5e7eb 0px, #f0f1f3 60px, #e5e7eb 120px);
    background-size: 600px;
    animation: shimmer 1.6s infinite linear;
}

body.dark-mode .skeleton-card{
    background: linear-gradient(90deg, #3c3d3d 0px, #454545 60px, #424447 120px);
}


@keyframes shimmer {
    0% { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

/* No Posts */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-posts span {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1100px) {
    .comunitycontainer {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-card {
        flex: 1;
        min-width: 250px;
    }

    .left-sidebar {
        order: 2;
    }

    .main-content {
        order: 1;
    }

    .right-sidebar {
        order: 3;
    }
}

@media (max-width: 600px) {
    .comunitycontainer {
        padding: 12px;
        gap: 16px;
    }

    .sidebar-card {
        min-width: 100%;
    }

    .post-actions {
        flex-wrap: wrap;
    }

    .action-btn {
        flex: 1 1 45%;
    }
}
.read-more-btn {
    color: var(--accent, #4c6fff);
    cursor: pointer;
    font-weight: 600;
}
.openpost{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    z-index: 99;
}


.pagination-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.see-more-btn {
    background-color: white;
    border: 1px solid #e5e7eb;
    color: inherit;
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}
.refresh-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    background: #71bdff;
    padding: 2px;
    gap: 5px;
    font-size: 14px;
    color: black;
    position: fixed;
    top: 60px;
    width: 100%;
    z-index: 9;

}

body.dark-mode .see-more-btn{
    background-color: #525252;
}

.see-more-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}