/*
Theme Name: My First Theme
Author: Danya
Description: A professional theme built with Gemini's help.
Version: 1.8
*/

/* ==========================================================================
   ✅ 1. General Styles & Setup
   ========================================================================== */
body {
    font-family: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f8;
    color: #333;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4 {
    font-family: 'Poppins', sans-serif;
}

/* ==========================================================================
   ✅ 2. Header Styles
   ========================================================================== */
#site-header {
    text-align: center;
    padding-top: 20px;
    background-color: #f4f6f8;
}

.site-title, .site-description {
}

/* Main Container for Full-Width Pages */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==========================================================================
   ✅ 3. Navigation Menu
   ========================================================================== */
.main-nav {
    margin: 20px 0 30px 0;
}
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 15px;
    background-color: #ffffff;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    transition: background-color 0.3s;
}
.main-nav li {
    display: inline-block;
    margin: 0 5px;
}
.main-nav a {
    display: inline-block;
    color: #34495e;
    background-color: #eef2f5;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

/* Ad Widget Styles */
.header-ad-area {
    text-align: center;
    margin: 20px 0;
}

/* ==========================================================================
   ✅ 4. Grid Layout for Posts (3-Column)
   ========================================================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
.post-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
    display: flex;
    flex-direction: column;
}
.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.post-item .post-thumbnail a {
    display: block;
}
.post-item .post-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.post-item .post-title {
    font-size: 1.2em;
    margin: 20px;
    line-height: 1.4;
    flex-grow: 1; 
}
.post-item .post-title a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s;
}

/* ==========================================================================
   ✅ 5. Single Post Layout & Typography
   ========================================================================== */
.single .single-post-container {
    max-width: 920px;
    margin: 0 auto;
    padding: 40px;
    background-color: #fff;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.single .entry-title {
    font-size: 42px;
    margin-top: 0;
    line-height: 1.3;
    margin-bottom: 20px;
    text-align: center; 
}
.single .post-content {
    font-size: 18px;
    line-height: 1.8;
}
.single .post-content p {
    text-align: left;
    margin-bottom: 1.5em;
    word-break: break-word;
}
.single .post-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
    text-align: left;
    transition: color 0.3s, border-color 0.3s;
}

/* Related Posts Section */
.related-posts-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 40px 20px 0 20px;
    border-top: 2px solid #f0f0f0;
    transition: border-color 0.3s;
}
.related-title {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 30px;
    color: #333;
}
.posts-grid.four-columns {
    grid-template-columns: repeat(4, 1fr);
}

/* ==========================================================================
   ✅ 6. Responsive
   ========================================================================== */
@media screen and (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media screen and (max-width: 768px) {
    .main-nav li {
        margin: 5px;
    }
    .single .single-post-container {
        padding: 25px;
    }
    .single .entry-title {
        font-size: 28px;
    }
}
@media screen and (max-width: 580px) {
    .posts-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    .posts-grid.four-columns {
        grid-template-columns: repeat(2, 1fr);
    }
    .single .single-post-container {
        padding: 18px;
    }
    .single .entry-title {
        font-size: 24px;
        line-height: 1.3;
    }
    .single .post-content {
        font-size: 16px;
        line-height: 1.6;
    }
    .btn {
        padding: 8px 18px;
        font-size: 14px;
    }
    .read-more-container {
        text-align: center;
        margin: 0 15px 15px 15px;
    }
}

/* ==========================================================================
   ✅ 7. Other Components (Buttons, Ads, etc.)
   ========================================================================== */
.btn {
    display: inline-block;
    background-color: #34495e;
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.3s;
}
.read-more-container {
    margin: 0 20px 20px 20px;
}

/* In-Post Ads */
.in-post-ad {
    margin: 30px 0;
    padding: 15px;
    background-color: #f1f1f1;
    text-align: center;
    overflow: hidden;
}

/* Back to Top Button */
#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99;
    border: none;
    background-color: #34495e;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 22px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s, opacity 0.3s, transform 0.3s;
}
#backToTopBtn:hover {
    transform: scale(1.1);
}

/* ==========================================================================
   ✅ 8. Dark Mode
   ========================================================================== */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}
.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}
.theme-switch input {
    display: none;
}
.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #2196F3;
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* Dark Mode Theme */
[data-theme="dark"] {
    background-color: #2c3e50;
    color: #ecf0f1;
}
[data-theme="dark"] #site-header {
    background-color: #2c3e50;
}
[data-theme="dark"] .main-nav ul {
    background-color: #34495e;
}
[data-theme="dark"] .post-item, 
[data-theme="dark"] .single .single-post-container {
    background-color: #34495e;
}
[data-theme="dark"] .post-item .post-title a, 
[data-theme="dark"] .related-title {
    color: #ecf0f1;
}
[data-theme="dark"] .single .post-meta {
    color: #bdc3c7;
    border-color: #46627f;
}
/* Dark Mode - Single Post Content + Title */
[data-theme="dark"] .single .single-post-container,
[data-theme="dark"] .single .post-content,
[data-theme="dark"] .single .entry-title {
    color: #ecf0f1;
}

/* ✅ Fix: Single Post Content Colors in Dark Mode */
[data-theme="dark"] .single .post-content,
[data-theme="dark"] .single .post-content p {
    color: #ecf0f1;
}
[data-theme="dark"] .single .post-content h2,
[data-theme="dark"] .single .post-content h3,
[data-theme="dark"] .single .post-content h4 {
    color: #e67e22;
}

/* ==========================================================================
   ✅ 9. Sticky Header
   ========================================================================== */
#site-header.sticky {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 10px 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    background-color: #ffffff;
}
#site-header.sticky .site-title,
#site-header.sticky .site-description,
#site-header.sticky .header-ad-area,
#site-header.sticky .theme-switch-wrapper {
    display: none;
}
#site-header.sticky .main-nav {
    margin: 0;
}
[data-theme="dark"] #site-header.sticky {
    background-color: #34495e;
}

/* ==========================================================================
   ✅ 10. Reading Progress Bar
   ========================================================================== */
.progress-container {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
}
.progress-bar {
    height: 8px;
    width: 0%;
}
[data-theme="dark"] .progress-container {
    background: #46627f;
}

/* ==========================================================================
   ✅ 11. Post Rating Styles (NEW)
   ========================================================================== */
.post-rating {
  margin: 24px 0 8px;
  text-align: center;
}
.post-rating .stars {
  font-size: 30px;
  line-height: 1;
  user-select: none;
}
.post-rating .star {
  color: #ccc;
  margin: 0 4px;
  cursor: pointer;
  transition: color .2s, transform .1s;
  display: inline-block;
  outline: none;
}
.post-rating .star:hover,
.post-rating .star:focus {
  color: #e67e22;
  transform: scale(1.1);
}
.post-rating .star.filled {
  color: #f39c12;
}
.post-rating .rating-meta {
  margin: 8px 0 0;
  font-size: 14px;
  color: #666;
}
.post-rating .rating-hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: #999;
}

/* Dark mode tweaks for rating */
[data-theme="dark"] .post-rating .rating-meta { color: #bdc3c7; }
[data-theme="dark"] .post-rating .rating-hint { color: #a9b7c6; }
[data-theme="dark"] .post-rating .star { color: #95a5a6; }
[data-theme="dark"] .post-rating .star.filled { color: #f1c40f; }
[data-theme="dark"] .post-rating .star:hover,
[data-theme="dark"] .post-rating .star:focus { color: #e67e22; }
