/* ===================================
   Blog System Styles
   =================================== */

/* Blog Admin Page */
.blog-admin {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.blog-admin h2 {
    color: #1a1a1a;
    margin-bottom: 10px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Blog Editor Section */
.blog-editor-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.blog-editor-section h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="url"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e74c3c;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.current-image {
    margin-bottom: 15px;
}

.current-image img {
    border-radius: 8px;
    border: 2px solid #eee;
}

/* Blog List Section */
.blog-list-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blog-list-section h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #2c3e50;
}

.blog-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.blog-table thead {
    background: #f8f9fa;
}

.blog-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
}

.blog-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.blog-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
}

/* Buttons */
.btn, .btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background: #e74c3c;
    color: white;
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    margin-right: 5px;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-delete:hover {
    background: #c0392b;
}

/* ===================================
   Blog Display Pages
   =================================== */

/* Blog List Container */
.blog-list-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.blog-list-header {
    text-align: center;
    margin-bottom: 50px;
}

.blog-list-header h1 {
    color: #1a1a1a;
    margin-bottom: 10px;
}

.blog-list-header p {
    color: #666;
    font-size: 18px;
}

/* Blog Grid */
.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.blog-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.blog-card-image {
    display: block;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 25px;
}

.blog-card-content h2 {
    margin: 0 0 15px 0;
    font-size: 22px;
}

.blog-card-content h2 a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s;
}

.blog-card-content h2 a:hover {
    color: #e74c3c;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.blog-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-card-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.read-more {
    color: #e74c3c;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s;
}

.read-more:hover {
    color: #c0392b;
}

/* Individual Blog Post */
.blog-post-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.blog-post {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blog-post-header {
    padding: 40px 40px 20px 40px;
}

.blog-post-header h1 {
    margin: 0 0 20px 0;
    color: #1a1a1a;
    font-size: 36px;
    line-height: 1.3;
}

.blog-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 15px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.blog-post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-post-featured-image {
    width: 100%;
    max-height: 500px;
    overflow: hidden;
}

.blog-post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-post-content {
    padding: 40px;
    font-size: 17px;
    line-height: 1.8;
    color: #333;
}

.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.blog-post-content p {
    margin-bottom: 20px;
}

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
}

.blog-post-content .img-responsive {
    width: 100%;
    height: auto;
}

.blog-post-content .img-rounded {
    border-radius: 15px;
}

.blog-post-content .img-circle {
    border-radius: 50%;
    max-width: 300px;
}

.blog-post-content figure {
    margin: 30px 0;
    text-align: center;
}

.blog-post-content figcaption {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.blog-post-content .mce-content-body {
    max-width: 100%;
}

.blog-post-content ul,
.blog-post-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.blog-post-content li {
    margin-bottom: 10px;
}

.blog-post-content a {
    color: #e74c3c;
    text-decoration: underline;
}

.blog-post-content a:hover {
    color: #c0392b;
}

.blog-post-footer {
    padding: 30px 40px;
    background: #f8f9fa;
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.post-navigation a {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-navigation a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: #e74c3c;
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
}

.back-to-blog {
    text-align: center;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
}

.pagination a {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.pagination a:hover {
    background: #c0392b;
}

.pagination-info {
    color: #666;
    font-weight: 500;
}

.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

/* Homepage Blog Section */
.blog-home-section {
    padding: 60px 0;
    background: white;
}

.blog-home-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.blog-home-section h2 {
    text-align: center;
    color: var(--text-dark, #212121);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 600;
}

.blog-home-section .section-subtitle {
    text-align: center;
    color: var(--text-light, #757575);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
    max-width: 100%;
}

/* Limit width when only 1 or 2 posts */
.blog-grid:has(> :only-child) {
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.blog-grid:has(> :nth-child(2):last-child) {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.blog-card-home {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
    border: 1px solid var(--border-color, #e0e0e0);
}

.blog-card-home:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg, 0 4px 16px rgba(0, 0, 0, 0.15));
}

.blog-thumb {
    display: block;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.blog-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.blog-card-home:hover .blog-thumb img {
    transform: scale(1.05);
}

.blog-card-body {
    padding: 20px;
}

.blog-card-body h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.blog-card-body h3 a {
    color: var(--text-dark, #212121);
    text-decoration: none;
    transition: color 0.3s;
}

.blog-card-body h3 a:hover {
    color: var(--primary-color, #d32f2f);
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.blog-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 15px;
}

.read-more-link {
    color: var(--primary-color, #d32f2f);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.read-more-link:hover {
    gap: 10px;
    color: var(--primary-dark, #9a0007);
}

.view-all-link {
    text-align: center;
    margin-top: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-post-header h1 {
        font-size: 28px;
    }
    
    .blog-post-header,
    .blog-post-content,
    .blog-post-footer {
        padding: 20px;
    }
    
    .post-navigation {
        flex-direction: column;
    }
    
    .blog-table {
        font-size: 14px;
    }
    
    .blog-table th,
    .blog-table td {
        padding: 8px;
    }
}

/* User Management Table Styles */
.blog-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-collapse: separate;
    border-spacing: 0;
}

.blog-table thead {
    background: #2c3e50;
    color: white;
}

.blog-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

.blog-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.blog-table tbody tr:last-child td {
    border-bottom: none;
}

.blog-table tbody tr:hover {
    background: #f8f9fa;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.9em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
