/* ====== Reset & Base ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-primary:   #2b6cb0;
    --c-text:       #1a202c;
    --c-muted:     #718096;
    --c-bg:        #f7fafc;
    --c-card-bg:   #ffffff;
    --c-border:   #e2e8f0;
    --c-danger:   #e53e3e;
    --radius:     12px;
    --shadow:     0 2px 8px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
}

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

/* ====== Header ====== */
.site-header {
    background: var(--c-card-bg);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow);
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    padding-bottom: 16px;
}
.site-header h1 {
    font-size: 1.4rem;
    color: var(--c-primary);
}
.site-header nav a {
    margin-left: 20px;
    text-decoration: none;
    color: var(--c-muted);
    font-weight: 500;
    transition: color .2s;
}
.site-header nav a:hover { color: var(--c-primary); }

/* ====== News Grid ====== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 32px 0;
}

.news-card {
    background: var(--c-card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .3s, transform .3s;
}
.news-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.news-img, .news-img-placeholder {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.news-img-placeholder {
    background: linear-gradient(135deg, #edf2f7, #cbd5e0);
}

.news-body {
    padding: 16px 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.news-date {
    font-size: .85rem;
    color: var(--c-muted);
    margin-bottom: 8px;
}
.news-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: var(--c-text);
}
.news-lead {
    color: var(--c-muted);
    margin-bottom: 14px;
}

.news-full {
    margin-bottom: 14px;
    overflow: hidden;
    animation: fadeIn .3s ease;
}
.news-full[hidden] { display: none; }

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

/* ====== Buttons ====== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: var(--c-primary);
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .2s, background .2s;
}
.btn:hover { opacity: .88; }
.btn-secondary { background: var(--c-muted); }
.btn-danger { background: var(--c-danger); }
.btn-small { padding: 4px 12px; font-size: .85rem; }

/* ====== Pagination ====== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 24px 0 40px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--c-text);
    background: var(--c-card-bg);
    font-weight: 500;
    transition: all .2s;
}
.page-link:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
}
.page-current {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* ====== Footer ====== */
.site-footer {
    background: var(--c-card-bg);
    border-top: 1px solid var(--c-border);
    padding: 20px 0;
    text-align: center;
    color: var(--c-muted);
    font-size: .9rem;
}

/* ====== Empty state ====== */
.empty-state {
    text-align: center;
    color: var(--c-muted);
    font-size: 1.1rem;
    padding: 60px 0;
    grid-column: 1 / -1;
}

/* ====== Admin ====== */
.admin-login {
    max-width: 400px;
    margin: 60px auto;
}
.admin-form-section, .admin-list {
    margin: 32px 0;
}
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 600px;
}
.admin-form label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
    gap: 6px;
}
.admin-form input,
.admin-form textarea {
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.admin-form input:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--c-primary);
}
.admin-form .hint {
    font-size: .85rem;
    color: var(--c-muted);
    font-weight: 400;
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}
.admin-table th {
    background: var(--c-primary);
    color: #fff;
    font-weight: 600;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f0f4f8; }
.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}
.admin-list h2 {
    margin-bottom: 16px;
}

/* ====== Messages ====== */
.msg {
    padding: 12px 18px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}
.msg-success { background: #c6f6d5; color: #22543d; }
.msg-error   { background: #fed7d7; color: #742a2a; }

/* ====== Responsive ====== */
/* Планшеты вертикальные */
@media (max-width: 1199px) {
    .news-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Планшеты */
@media (max-width: 991px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Большие телефоны */
@media (max-width: 767px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .container { padding: 0 14px; }
    .news-img, .news-img-placeholder { height: 160px; }
}

/* Телефоны */
@media (max-width: 575px) {
    .news-grid { grid-template-columns: 1fr; }
    .site-header .container { flex-direction: column; gap: 10px; }
    .site-header nav a { margin-left: 0; margin: 0 8px; }
    .admin-table { font-size: .85rem; }
    .admin-table th, .admin-table td { padding: 8px; }
    .pagination { gap: 4px; }
    .page-link { min-width: 34px; height: 34px; font-size: .9rem; }
}
