/* --- Global Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    line-height: 1.6;
}
.container {
    width: 100%;
    margin: 0;
    padding: 0;
}
.container.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
h1, h2, h3 { color: #333; }
a { color: #4A00E0; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.btn {
    background: linear-gradient(90deg, #8E2DE2 0%, #4A00E0 100%);
    color: white !important;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    filter: brightness(110%);
}
.btn-secondary {
    background: #e0e0e0;
    color: #333 !important;
}
.btn-danger {
    background: #c9340c;
    font-size: 14px;
    padding: 8px 12px;
    color: white !important;
}

/* --- Sticky/Floating & Collapsible Nav --- */
.main-nav {
    background-color: #ffffff;
    padding: 15px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    position: sticky;
    top: 0;
    z-index: 1000;
}
.main-nav .logo {
    font-size: 24px;
    font-weight: bold;
    color: #4A00E0;
}
.nav-toggle {
    display: block; 
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}
.nav-toggle .hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: all 0.3s ease-in-out;
}
.nav-links {
    display: none; 
    width: 100%; 
}
.nav-links.active {
    display: block; 
}
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column; 
    width: 100%;
    padding-top: 15px;
}
.main-nav ul li {
    width: 100%;
    text-align: center;
}
.main-nav ul li a {
    font-weight: 600;
    color: #333;
    padding: 10px;
    display: block;
}

@media (min-width: 768px) {
    .nav-toggle {
        display: none; 
    }
    .nav-links {
        display: flex !important; 
        width: auto; 
    }
    .main-nav ul {
        flex-direction: row; 
        width: auto;
        padding-top: 0;
    }
    .main-nav ul li {
        width: auto;
    }
}

/* --- Card Layout --- */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    padding: 24px 32px;
    margin-bottom: 24px;
}
.error {
    background-color: #fbeae5;
    border: 1px solid #f6c6b9;
    color: #c9340c;
    font-weight: 600;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    word-wrap: break-word;
}
.error pre {
    white-space: pre-wrap;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    color: #333;
}

/* --- 1. ADMIN PANEL STYLES --- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-form .form-group {
    margin-bottom: 20px;
}
.admin-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}
.admin-form input[type="text"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 14px;
    font-family: inherit;
    font-size: 16px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    box-sizing: border-box;
    background-color: #f9f9f9;
}
.admin-form textarea {
    min-height: 250px;
    resize: vertical;
}
.admin-post-list ul { list-style: none; padding: 0; }
.admin-post-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
}
.admin-post-list .post-title { 
    font-weight: 600; 
    flex-grow: 1;
    margin-right: 15px;
}
.admin-post-list .post-actions { 
    display: flex; 
    gap: 10px; 
    flex-shrink: 0;
}

/* --- 2. PUBLIC PORTFOLIO STYLES --- */
.hero {
    text-align: center;
    padding: 100px 40px;
    background: linear-gradient(90deg, #8E2DE2 0%, #4A00E0 100%);
    color: white;
    width: 100%;
    box-sizing: border-box;
}
.hero h1 { font-size: 56px; margin-bottom: 10px; color: white; }
.hero p { font-size: 22px; opacity: 0.9; margin-bottom: 30px; }

.section { 
    width: 100%;
    padding: 80px 0;
    box-sizing: border-box;
    margin: 0;
}
.section:nth-child(even) {
    background-color: #fafafa;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 40px;
    box-sizing: border-box;
}
.section-header h2 {
    margin: 0;
    padding: 0 0 15px 0;
}
.section h2 {
    font-size: 42px;
    border-bottom: 4px solid #4A00E0;
    padding-bottom: 15px;
    display: inline-block;
    margin: 0 0 40px 0;
    color: #1c1e21;
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 40px;
    padding-right: 40px;
    box-sizing: border-box;
}
.section-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}
.view-all-btn {
    font-weight: 600;
    font-size: 16px;
}

/* 'About Me' Section Styles */
.about-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
}
.about-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.about-text h3 {
    font-size: 24px;
    color: #4A00E0;
    margin-top: 0;
}
.about-text p {
    font-size: 16px;
}
@media (min-width: 640px) {
    .about-section {
        flex-direction: row;
        text-align: left;
    }
}

/* Services Grid & Tools Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    width: 100%;
}
.service-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    text-align: center;
    display: flex;
    flex-direction: column;
}
.service-card .icon { font-size: 48px; }
.service-card h3 { margin-top: 15px; color: #4A00E0; }
.service-card p {
    flex-grow: 1;
}
.service-card .btn {
    margin-top: auto;
}

/* Blog Card Grid (Max 3 Cols) */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 30px;
    width: 100%;
}
@media (min-width: 640px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 960px) {
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1400px) {
    .blog-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.blog-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease-in-out;
}
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.card-image-link img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}
.card-category {
    font-size: 12px;
    font-weight: 600;
    color: #8E2DE2;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.card-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}
.card-content h3 a {
    color: #1c1e21;
}
.card-content h3 a:hover {
    color: #4A00E0;
}
.post-meta {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}
.card-content p {
    font-size: 16px;
    color: #333;
    flex-grow: 1; 
    margin-bottom: 20px;
}
.btn-read-more {
    font-weight: 600;
    color: #4A00E0;
    align-self: flex-start;
}

/* --- Loader Overlay --- */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.loader-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f0f2f5;
    border-top-color: #4A00E0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Pagination Styles --- */
.pagination {
    text-align: center;
    margin-top: 40px;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}
.pagination a {
    background-color: #fff;
    color: #4A00E0;
    border: 1px solid #ddd;
}
.pagination a:hover {
    background-color: #f0f2f5;
}
.pagination span.current-page {
    background-color: #4A00E0;
    color: #fff;
    border: 1px solid #4A00E0;
}
.pagination span.disabled {
    color: #999;
    background-color: #f9f9f9;
    border: 1px solid #eee;
}

/* --- ★★★ SINGLE POST STYLES ★★★ --- */
/* (These are the styles that were missing) */
.post-header {
    border-bottom: 2px solid #f0f2f5;
    margin-bottom: 24px;
}
.post-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    color: #1c1e21;
}
.post-meta {
    font-size: 14px;
    color: #555;
    margin-bottom: 24px;
    display: flex; 
    flex-wrap: wrap; 
    gap: 15px; 
}
.post-meta-category {
    background-color: #f0f2f5;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 600;
    color: #4A00E0;
}
.post-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 24px;
}
.post-full-content {
    line-height: 1.7;
    font-size: 16px;
}
/* Styles for the AI-generated HTML content */
.post-full-content h2 { font-size: 24px; color: #333; margin-top: 30px; }
.post-full-content h3 { font-size: 20px; color: #4A00E0; margin-top: 24px; }
.post-full-content ul { padding-left: 20px; }
.post-full-content p { margin-bottom: 16px; }
.back-link {
    display: inline-block;
    margin-top: 24px;
    font-weight: 600;
    font-size: 16px;
}