/* Global Styles */
:root {
    /* Define the new color palette */
    --color-dark-blue: #1A2E5B;
    --color-light-blue: #5C9DFF;
    --color-purple: #7D5CFF;
    --color-light-purple-accent: #B39CFF; /* A lighter purple for accents */
    --color-light-grey: #F8F9FA; /* A very light background color */
    --color-very-dark-blue: #0F1E40; /* Even darker blue for gradients */
    --color-dark-red: #c0392b; /* Darker red for error/delete */

    /* Map the new palette to the existing variable names, adjusting for contrast */
    --primary-color: #3A76C8; /* A specific blue that has good contrast on light grey */
    --secondary-color: var(--color-purple); /* Used for blog hero gradient end */
    --accent-color: var(--color-light-purple-accent); /* Keeping definition, might not be used in this specific CSS */
    --dark-color: var(--color-dark-blue); /* Main dark background/text color */
    --light-color: var(--color-light-grey); /* Main light background color */
    --success-color: #28a745; /* Keeping green as is */
    --error-color: var(--color-dark-red); /* Use darker red */

    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Define new gradients using the palette */
    --gradient-blog-hero: linear-gradient(135deg, var(--color-light-blue), var(--color-purple)); /* Light blue to purple for blog hero */
    --gradient-button-primary: linear-gradient(135deg, var(--color-dark-blue), var(--color-very-dark-blue)); /* Dark blue gradient for main buttons */

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color-dark);
    background-color: var(--light-color);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--color-light-blue); /* Use light blue for hover */
}

ul {
    list-style: none;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.primary-btn {
    background: var(--gradient-button-primary); /* Use the dark blue button gradient */
    color: white;
}

.primary-btn:hover {
    opacity: 0.9;
    color: white;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--dark-color);
    color: var(--dark-color);
}

.secondary-btn:hover {
    background-color: var(--dark-color);
    color: white;
}

/* Header Styles (Improved) */
header {
    background-color: var(--dark-color); /* Use dark blue background */
    color: white; /* Default text color is white */
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000; /* Ensure it's above other content */
    box-shadow: var(--box-shadow); /* Use existing box shadow variable */
    transition: var(--transition);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem; /* Add some padding to the sides */
}

.logo a {
    color: white; /* White logo text */
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
     transition: var(--transition);
}

.logo a:hover {
    color: var(--primary-color); /* Light blue accent on hover */
}

/* Desktop Navigation (Improved) */
.desktop-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.desktop-nav ul li {
    margin-left: 2rem; /* Use consistent spacing */
}

.desktop-nav ul li a {
    color: white; /* White link text on dark blue background */
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: var(--transition);
}

.desktop-nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color); /* Light blue underline */
    transition: var(--transition);
}

.desktop-nav ul li a.active::after,
.desktop-nav ul li a:hover::after {
    width: 100%;
}

.desktop-nav ul li a.active,
.desktop-nav ul li a:hover {
    color: white; /* Keep text white for better contrast on dark blue background */
}


/* Hamburger Styles (Improved) */
.hamburger {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    justify-content: space-between; /* Keep justify-content */
    width: 25px;
    height: 18px;
    cursor: pointer;
    z-index: 1000; /* Ensure it's clickable */
    transition: var(--transition);
    gap: 5px; /* Use gap for spacing spans */
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: white; /* White hamburger icon */
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu styles (Improved) */
.mobile-menu {
    position: absolute;
    top: 100%; /* Position right below the header */
    left: 0;
    width: 100%;
    background-color: var(--dark-color); /* Dark blue background for mobile menu */
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-height: 0; /* Hidden by default */
    transition: max-height 0.3s ease-out;
    z-index: 999;
    display: flex; /* Use flex for potential internal layout */
    flex-direction: column;
}

.mobile-menu.active {
    max-height: 300px; /* Adjust based on content height - make sure this is large enough! */
    transition: max-height 0.5s ease-in;
}

/* Style the cloned nav elements within the mobile menu */
.mobile-menu nav {
    width: 100%; /* Ensure the nav takes full width */
    padding: 1rem 0; /* Add vertical padding */
}

.mobile-menu nav ul {
    display: block; /* Stack list items */
    padding: 0; /* Remove internal padding */
}

.mobile-menu nav ul li {
    margin: 0; /* Remove default margin */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle white border */
}

.mobile-menu nav ul li:last-child {
    border-bottom: none;
}

.mobile-menu nav ul li a {
    display: block; /* Make links fill the list item */
    padding: 12px 20px;
    color: white; /* White text on dark blue background */
    transition: var(--transition);
}

.mobile-menu nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.08); /* Subtle white background on hover */
    color: white; /* Keep text white */
}


/* Blog Hero Section */
.blog-hero {
    background: var(--gradient-blog-hero); /* Light blue to purple gradient */
    color: white;
    padding: 60px 0;
    text-align: center;
}

.blog-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.blog-hero p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* Blog Content Section */
.blog-content {
    padding: 50px 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    font-size: 1.1rem;
    color: var(--dark-color);
}

.post-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.post-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: opacity 0.3s ease;
    display: block;
}

.post-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-card-content h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--dark-color);
    line-height: 1.3;
}

.post-card-content p {
    font-size: 0.95rem;
    color: var(--text-color-dark);
    margin-bottom: 15px;
    flex-grow: 1;
}


.post-meta {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    color: var(--text-color-dark);
    font-size: 0.85rem;
}

.post-category {
    display: inline-block;
    background-color: #CFE2FF;
    color: var(--dark-color);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-transform: capitalize;
}

.delete-btn {
    background-color: var(--error-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    align-self: flex-start;
    font-size: 0.9rem;
}

.delete-btn:hover {
    background-color: #a93226;
}


/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
}

.sidebar-widget {
    background-color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
}

.sidebar-widget h3 {
    margin-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 10px;
    color: var(--dark-color);
}

.sidebar-widget p {
    color: var(--text-color-dark);
    font-size: 0.95rem;
    line-height: 1.7;
}

.categories li {
    margin-bottom: 8px;
}

.categories li a {
    display: block;
    padding: 5px 0;
    color: var(--text-color-dark);
    transition: var(--transition);
}

.categories li a:hover {
    color: var(--dark-color);
    padding-left: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 700px;
    width: 100%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}


.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--dark-color);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--error-color);
    transform: rotate(90deg);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease-in-out;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(58, 134, 255, 0.25);
}


.form-group textarea {
    resize: vertical;
}

#single-post-content {
    padding: 15px 0;
}

#single-post-content h1 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 2rem;
    line-height: 1.2;
}

#single-post-content .post-info {
    color: var(--text-color-dark);
    margin-bottom: 25px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--light-color);
    padding-bottom: 15px;
}

#single-post-content .post-body {
    line-height: 1.8;
    color: var(--text-color-dark);
    font-size: 1rem;
}

#single-post-content .post-body p {
    margin-bottom: 15px;
}

/* Footer Styles */
footer {
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: white;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--light-color);
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    color: white;
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-icons a:hover {
    color: var(--primary-color); /* Primary color on hover (darker blue) */
}

.copyright {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

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

    .sidebar {
        position: static;
        margin-top: 30px;
    }
     .sidebar-widget {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) { /* Combined media query */
    .desktop-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

     /* Adjust header container padding on small screens */
    header .container {
        padding: 0 1rem;
    }

     /* Ensure mobile menu is stacked */
     .mobile-menu nav ul {
         flex-direction: column;
         text-align: center;
     }

      .mobile-menu nav ul li {
         margin-left: 0; /* Remove desktop margin */
     }

     .mobile-menu nav ul li a {
         padding: 12px 1rem; /* Adjust padding for mobile links */
     }
}


@media (max-width: 576px) {
    .blog-hero h1 {
        font-size: 2rem;
    }

    .blog-hero p {
        font-size: 1rem;
    }

    .post-card-content {
        padding: 15px;
    }

    .post-card-content h2 {
        font-size: 1.2rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-section ul {
        padding: 0;
    }
     .footer-section ul li {
        margin-bottom: 8px;
    }

    .social-icons {
        justify-content: center;
    }

     .modal-content {
         padding: 20px;
     }
}


/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* post-card animation is applied via JS or another method,
   but keeping the animation definition */


.no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 1.2rem;
    color: var(--text-color-dark);
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}
