/* Общие стили */
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    background-color: #f4f4f9;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Шапка сайта */
.site-header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 30px;
}

.site-header h1 {
    margin: 0;
    font-size: 2.5rem;
}

.site-header p {
    margin: 5px 0 0;
    font-size: 1.1rem;
    color: #bdc3c7;
}

/* Стили для постов на главной странице */
.post {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden; /* Чтобы скруглённые углы работали с картинкой */
    transition: transform 0.2s ease-in-out;
}

.post:hover {
    transform: translateY(-5px);
}

.post-image {
    width: 100%;
    height: auto;
    display: block;
}

.post-content {
    padding: 25px;
}

.post-content h2 {
    margin-top: 0;
    color: #34495e;
}

.post-meta {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.post-text {
    font-size: 1rem;
    color: #555;
}

/* Подвал сайта */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    background-color: #34495e;
    color: #bdc3c7;
}

/* --- Стили для админ-панели (admin.php) --- */
.admin-form,
.post-list {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.admin-form h2,
.post-list h2 {
    margin-top: 0;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Важно для правильного расчёта ширины */
    font-family: 'Montserrat', sans-serif;
}

.form-group textarea {
    resize: vertical; /* Позволяет менять высоту текстового поля */
}

.btn {
    display: inline-block;
    background-color: #3498db;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #2980b9;
}

/* Таблица с постами в админке */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background-color: #ecf0f1;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.btn-delete {
    color: #fff;
    background-color: #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    display: inline-block; /* Чтобы padding работал корректно */
}

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

/* Адаптивность для мобильных устройств */
@media (max-width: 600px) {
    .site-header h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 10px;
    }

    .post,
    .admin-form,
    .post-list {
        padding: 15px;
    }
}
/* --- Стили для страницы входа --- */
.login-page {
    background-color: #34495e;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
}

.error-message {
    color: #e74c3c;
    background-color: #fbe2e2;
    border: 1px solid #e74c3c;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.logout-link {
    color: #fff;
    text-decoration: none;
    background: #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    position: absolute;
    top: 20px;
    right: 20px;
}
.logout-link:hover {
    background: #c0392b;
}

/* --- Стили для кнопок действий в админке --- */
.actions a {
    margin-right: 10px;
}
.actions a:last-child {
    margin-right: 0;
}

.btn-edit {
    color: #fff;
    background-color: #2980b9;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.btn-edit:hover {
    background-color: #3498db;
}
/* --- Стили для страницы редактирования --- */
.back-link {
    color: #fff;
    text-decoration: none;
    background: #3498db;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    position: absolute;
    top: 20px;
    right: 20px;
}
.back-link:hover {
    background: #2980b9;
}

.success-message {
    color: #27ae60;
    background-color: #e9f7ef;
    border: 1px solid #27ae60;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}
/* --- Стили для комментариев --- */
.comments-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.comments-section h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.comment-form {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 40px;
    border: 1px solid #e0e0e0;
}

.comment-form h4 {
    margin-top: 0;
    margin-bottom: 20px;
}

.comments-list .comment {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.comments-list .comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: 700;
    color: #3498db;
}

.comment-date {
    font-size: 0.85rem;
    color: #95a5a6;
}

.comment-body p {
    margin: 0;
    line-height: 1.6;
    color: #34495e;
}