/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    transition: background 0.4s ease-in-out, color 0.4s ease-in-out;
}

/* Container */
/* .container {
    display: flex;
    height: 100vh;
} */
.container {
    display: flex;
    flex-direction: row;
}


/* Dark Mode */
/* body.dark-mode {
    background-color: #1e1e1e;
    color: #ddd;
} */

.dark-mode {
    background-color: #121212;
    color: #f5f5f5;
}

/* Blog Modal Dark Mode */
.dark-mode .modal-content {
    background-color: #222;
    color: white;
}

.dark-mode .close-modal {
    background: #ff4d4d;
}

.dark-mode .tts-button {
    background: #4caf50;
}

/* .dark-mode .blog-item {
    background: #1e1e1e;
    border: 1px solid #333;
} */

/* .dark-mode .blog-detail-container {
    background: #222;
    border: 1px solid #444;
}

button {
    transition: background 0.3s ease, transform 0.2s ease;
}

button:hover {
    transform: scale(1.05);
} */

/* Sidebar Styles */
.sidebar {
    
    
    
    
}
.sidebar {
    width: 280px;
    min-width: 250px;
    background: #f8f9fa;
    padding: 15px;
    height: 100vh;
    overflow-y: auto;
    position: fixed; /* Sidebar stays fixed */
    left: 0;
    top: 0;
    /* transition: transform 0.3s ease; */

    box-shadow: 2px 0px 10px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.4s ease-in-out;
    z-index: 1000;
}

.dark-mode .sidebar {
    background: #1e1e1e;
    color: white;
}

/* Sidebar Open */
.sidebar.open {
    transform: translateX(0);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    left: 10px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    background: #ff9800;
    color: white;
    border-radius: 50%;
    padding: 10px;
    transition: 0.3s;
}

.sidebar-toggle:hover {
    background: #ff5722;
}

/* Active Category Highlight */
#category-list li {
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    border-bottom: 1px solid #eee;
    transition: background 0.3s ease, color 0.3s ease;
}

#category-list li:hover,
#category-list li.active {
    background: #007bff;
    color: white;
}

.dark-mode .category-list li.active {
    background: #ff5722;
}

.sidebar h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

#last-read {
    font-size: 14px;
    margin-bottom: 15px;
}

/* #category-list {
    list-style: none;
    padding: 0;
} */



/* Search Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    width: 100%;
}

#search {
    padding: 10px;
    width: 70%;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

/* Dark Mode Toggle */
#theme-toggle {
    padding: 10px;
    border: none;
    background-color: #333;
    color: white;
    cursor: pointer;
    border-radius: 5px;
}

#theme-toggle:hover {
    background-color: #555;
}


/* Main Blog Section */

/* Blog Grid Layout */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Blog Card Design */
.blog-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.blog-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.blog-info {
    padding: 15px;
    text-align: center;
}

.blog-info h3 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 10px 0;
}

.blog-date {
    font-size: 14px;
    color: #666;
}

.blog-category {
    background: #f3f3f3;
    color: #333;
    font-size: 12px;
    padding: 5px 10px;
    display: inline-block;
    border-radius: 20px;
    margin-top: 5px;
}

/* Hover Effects */
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
}
.blog-section {
    flex: 1;
    margin-left: 260px; /* Make space for the sidebar */
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Blog List - Grid Layout */
#blog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

/* Blog Item */
.blog-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    height: auto;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

.blog-item:hover {
    transform: scale(1.03);
}

.blog-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    background-color: #f0f0f0;
}

.blog-item h3 {
    margin: 10px 0;
    font-size: 18px;
}

.blog-item p {
    font-size: 14px;
    color: #777;
}

.blog-item button {
    padding: 10px 12px;
    border: none;
    background: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.blog-item button:hover {
    background: #0056b3;
}

/* Blog Detail Section */
.blog-detail {
    display: none; /* Initially hidden */
    width: 100%;
    background: white;
    padding: 20px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: relative;
    overflow-y: auto;
    margin-top: 10px;
    max-width: 900px;
    margin: auto;
}

.blog-detail h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.blog-detail p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.blog-detail img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
}

.blog-detail .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    background: red;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.blog-detail .close-btn:hover {
    background: darkred;
}


/* Blog Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    overflow-y: auto; /* Allows scrolling */
}

.modal-content {
    background: white;
    padding: 20px;
    width: 60%;
    max-width: 800px;
    max-height: 90vh; /* Ensures the modal does not overflow */
    overflow-y: auto; /* Enables scrolling inside the modal */
    border-radius: 10px;
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
}

.modal-content img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
}

/* .blog-text-content {
    text-align: left;
    margin-top: 15px;
} */

.modal-body {
    padding: 20px;
    text-align: left;
    max-height: 60vh; /* Makes sure the content fits and scrolls */
    overflow-y: auto;
}

.close-modal {
    background: red;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 18px;
}

.tts-button {
    background: green;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}


/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .blog-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 240px;
        height: auto;
        padding: 10px;
        position: fixed;
        left: -250px; /* Hide sidebar by default */
        transition: left 0.3s ease-in-out;
        z-index: 1000;
        background: white;
        box-shadow: 2px 0px 5px rgba(0, 0, 0, 0.2);
    }

    .sidebar.open {
        left: 0;
    }

    /* Toggle button for sidebar */
    .sidebar-toggle {
        position: fixed;
        top: 15px;
        left: 15px;
        background: #007bff;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 5px;
        cursor: pointer;
        z-index: 1100;
    }

    .blog-section {
        margin-left: 0;
        padding: 20px;
        width: 100%;
    }

    .blog-list {
        grid-template-columns: 1fr 1fr;
    }

    .blog-detail {
        max-width: 100%;
        padding: 15px;
    }
}

@media (max-width: 600px) {
    .blog-list {
        grid-template-columns: 1fr;
    }

    .blog-detail {
        max-width: 100%;
    }

    .sidebar-toggle {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
    }
}

