/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER & NAVIGATION ===== */
header {
    background: #1e2a3a;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header .logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

header nav a {
    color: #ddd;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s;
}

header nav a:hover {
    color: #fff;
}

/* ===== BUTTONS ===== */
.button, button, .cta-button {
    display: inline-block;
    background: #2c7da0;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.button:hover, button:hover, .cta-button:hover {
    background: #1f5e7a;
}

.button-danger {
    background: #c0392b;
}

.button-danger:hover {
    background: #a93226;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 20px;
    margin: 20px 0;
    border-radius: 5px;
    font-size: 0.9rem;
}

.success {
    background: #d4edda;
    color: #155724;
    border-left: 5px solid #28a745;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 5px solid #dc3545;
}

/* ===== ADMIN DASHBOARD TABLE ===== */
table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px 15px;
    text-align: left;
}

th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
}

tr {
    border-bottom: 1px solid #ecf0f1;
}

tr:hover {
    background: #f9f9f9;
}

td a {
    color: #2c7da0;
    text-decoration: none;
    margin-right: 10px;
}

td a:hover {
    text-decoration: underline;
}

/* ===== ADMIN FORM (CREATE/EDIT) ===== */
.form-sec {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 900px;
    margin: 30px auto;
}

.form-sec h1, .form-sec h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

input[type="text"],
input[type="file"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border 0.3s;
}

input[type="text"]:focus,
textarea:focus {
    border-color: #2c7da0;
    outline: none;
    box-shadow: 0 0 0 3px rgba(44,125,160,0.2);
}

textarea {
    resize: vertical;
    min-height: 200px;
}

img.preview-image {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

button[type="submit"] {
    background: #2c7da0;
    width: auto;
    padding: 12px 30px;
    font-size: 1rem;
    margin-top: 10px;
}

button[type="submit"]:hover {
    background: #1f5e7a;
}

/* ===== BLOG FRONTEND STYLES (Listing & Single) ===== */
article {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

article h1, article h2 {
    margin-bottom: 10px;
}

article h2 a {
    color: #1e2a3a;
    text-decoration: none;
}

article .meta {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

article img {
    max-width: 100%;
    border-radius: 5px;
    margin: 15px 0;
}

article .content {
    line-height: 1.8;
}

.pagination {
    text-align: center;
    margin: 30px 0;
}

.pagination a {
    background: white;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 4px;
    color: #2c7da0;
    text-decoration: none;
    border: 1px solid #ddd;
}

.pagination a:hover {
    background: #2c7da0;
    color: white;
    border-color: #2c7da0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    th, td {
        padding: 8px 10px;
    }
    header {
        flex-direction: column;
        text-align: center;
    }
    header nav a {
        margin: 0 10px;
    }
    .form-sec {
        padding: 20px;
    }
}

/* ===== BLOG PAGE TITLE ===== */
.page-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5rem;
    color: #2c3e50;
}

/* ===== POST CARDS GRID ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f0f2f5;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.post-card:hover .card-image img {
    transform: scale(1.03);
}

.card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    line-height: 1.3;
}

.card-title a {
    color: #1e2a3a;
    text-decoration: none;
    transition: color 0.2s;
}

.card-title a:hover {
    color: #2c7da0;
}

.card-meta {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 8px;
}

.card-excerpt {
    color: #34495e;
    line-height: 1.5;
    margin-bottom: 20px;
    flex: 1;
}

.read-more {
    display: inline-block;
    background: none;
    color: #2c7da0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
    align-self: flex-start;
}

.read-more:hover {
    color: #1f5e7a;
    text-decoration: underline;
}

/* ===== PAGINATION ===== */
.pagination {
    text-align: center;
    margin: 40px 0 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

.page-link {
    background: white;
    padding: 8px 18px;
    border-radius: 30px;
    color: #2c7da0;
    text-decoration: none;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.page-link:hover {
    background: #2c7da0;
    color: white;
    border-color: #2c7da0;
}

.page-current {
    background: #f0f2f5;
    padding: 8px 18px;
    border-radius: 30px;
    color: #2c3e50;
}

.no-posts {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .page-title {
        font-size: 1.8rem;
    }
    .card-title {
        font-size: 1.2rem;
    }
}