/* ==========================================================================
   Iron Neo — Main Stylesheet
   Версия: 1.0
   ========================================================================== */

/* ---------- RESET & BASE ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scrollbar-gutter: stable;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #4a6394;
    background: #f7f9fc;
}

a { color: inherit; }

/* ---------- LAYOUT: HEADER ---------- */
.site-header {
    background: linear-gradient(135deg, #1a2d4d 0%, #2d4570 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(26, 45, 77, 0.2);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
    padding: 0.25rem 0;
}

.logo svg {
    height: 40px;
    width: auto;
    display: block;
}

.logo:hover {
    opacity: 0.85;
}

.site-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.site-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.site-nav a:hover {
    background: rgba(145, 168, 208, 0.2);
    color: white;
}

.site-nav a.active {
    background: rgba(145, 168, 208, 0.3);
    color: white;
    border-bottom: 2px solid #91a8d0;
}

.admin-link {
    background: rgba(145, 168, 208, 0.15) !important;
    border: 1px solid rgba(145, 168, 208, 0.4) !important;
}

.admin-link:hover {
    background: rgba(145, 168, 208, 0.3) !important;
}

/* ---------- LAYOUT: MAIN ---------- */
.site-main {
    min-height: 70vh;
    padding: 3rem 0;
}

/* ---------- LAYOUT: FOOTER ---------- */
.site-footer {
    background: #1a2d4d;
    color: #b8c7de;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    border-top: 3px solid #91a8d0;
    box-shadow: 0 -2px 10px rgba(26, 45, 77, 0.08);
}

.site-footer p {
    margin: 0;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.site-footer a {
    color: #91a8d0;
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: white;
    text-decoration: underline;
}

/* ---------- PAGE CONTENT (site_layout, home_page) ---------- */
.page-content {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    border: 1px solid #eef3f9;
    margin-bottom: 2rem;
}

.page-cover {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(26, 45, 77, 0.12);
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #2d4570;
    border-bottom: 3px solid #91a8d0;
    padding-bottom: 0.5rem;
    display: inline-block;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-content h2 {
    font-size: 1.8rem;
    margin: 1.5rem 0 1rem;
    color: #2d4570;
    font-weight: 600;
}

.page-content h3 {
    font-size: 1.3rem;
    margin: 1rem 0 0.5rem;
    color: #4a6394;
    font-weight: 600;
}

.page-content p {
    margin-bottom: 1rem;
    color: #4a6394;
    line-height: 1.7;
}

.page-content a {
    color: #4a6394;
    text-decoration: underline;
    text-decoration-color: #91a8d0;
    text-underline-offset: 2px;
}

.page-content a:hover {
    color: #2d4570;
    text-decoration-color: #2d4570;
}

.page-content blockquote {
    border-left: 4px solid #91a8d0;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: #4a6394;
    font-style: italic;
    background: #f7f9fc;
    border-radius: 0 8px 8px 0;
}

/* ---------- HOME PAGE: SECTION TITLE ---------- */
.section-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2d4570;
    border-left: 4px solid #91a8d0;
    padding-left: 1rem;
    font-weight: 700;
}

/* ---------- HOME PAGE: POSTS GRID ---------- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid #eef3f9;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(26, 45, 77, 0.15);
    border-color: #b8c7de;
}

.post-card-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #d4dfeb, #b8c7de);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a6394;
    font-size: 3rem;
}

.post-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.post-card-category {
    background: #eef3f9;
    color: #4a6394;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.post-card-date {
    color: #6b84b8;
    font-size: 0.8rem;
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d4570;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-card-title a {
    color: inherit;
    text-decoration: none;
}

.post-card-title a:hover {
    color: #4a6394;
}

.post-card-excerpt {
    color: #4a6394;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    flex: 1;
}

.post-card-link {
    color: #4a6394;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.post-card-link:hover {
    color: #2d4570;
    text-decoration: underline;
}

.all-posts-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: #4a6394;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.all-posts-link:hover {
    background: #2d4570;
}

/* ---------- BLOG LIST ---------- */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2.5rem;
    color: #2d4570;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.page-subtitle {
    color: #6b84b8;
    font-size: 1.1rem;
}

.categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.category-filter {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #d4dfeb;
    border-radius: 999px;
    text-decoration: none;
    color: #4a6394;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.category-filter:hover {
    border-color: #91a8d0;
    color: #2d4570;
    background: #eef3f9;
}

.category-filter.active {
    background: #4a6394;
    color: white;
    border-color: #4a6394;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    display: grid;
    grid-template-columns: 280px 1fr;
    border: 1px solid #eef3f9;
    transition: all 0.2s;
}

.post-item:hover {
    box-shadow: 0 8px 20px rgba(26, 45, 77, 0.15);
    border-color: #b8c7de;
}

.post-item-cover {
    width: 100%;
    height: 100%;
    min-height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #d4dfeb, #b8c7de);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a6394;
    font-size: 4rem;
}

.post-item-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.post-item-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.post-item-category {
    background: #eef3f9;
    color: #4a6394;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.post-item-date,
.post-item-author {
    color: #6b84b8;
    font-size: 0.85rem;
}

.post-item-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d4570;
    margin-bottom: 0.75rem;
}

.post-item-title a {
    color: inherit;
    text-decoration: none;
}

.post-item-title a:hover {
    color: #4a6394;
}

.post-item-excerpt {
    color: #4a6394;
    margin-bottom: 1rem;
    flex: 1;
}

.post-item-link {
    color: #4a6394;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.post-item-link:hover {
    color: #2d4570;
    text-decoration: underline;
}

/* ---------- PAGINATION ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #d4dfeb;
    border-radius: 8px;
    background: white;
    color: #4a6394;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #eef3f9;
    border-color: #91a8d0;
    color: #2d4570;
}

.pagination .page-current {
    background: #4a6394;
    color: white;
    border-color: #4a6394;
    font-weight: 600;
    cursor: default;
}

.pagination .page-disabled {
    color: #b8c7de;
    background: #f7f9fc;
    border-color: #eef3f9;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination .page-nav {
    padding: 0 1rem;
    font-weight: 600;
}

.pagination-info {
    text-align: center;
    color: #6b84b8;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* ---------- BLOG POST ---------- */
.post-header {
    margin-bottom: 2rem;
}

.post-back {
    display: inline-block;
    color: #4a6394;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
}

.post-back:hover {
    color: #2d4570;
}

.post-cover {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.post-title {
    font-size: 2.5rem;
    color: #2d4570;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-weight: 700;
}

.post-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: #6b84b8;
    font-size: 0.95rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #eef3f9;
    margin-bottom: 2rem;
}

.post-category {
    background: #eef3f9;
    color: #4a6394;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.post-content {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    border: 1px solid #eef3f9;
}

.post-content h1 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
    color: #2d4570;
}

.post-content h2 {
    font-size: 1.6rem;
    margin: 1.75rem 0 1rem;
    color: #2d4570;
    border-bottom: 2px solid #eef3f9;
    padding-bottom: 0.3rem;
}

.post-content h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.75rem;
    color: #4a6394;
}

.post-content h4 {
    font-size: 1.15rem;
    margin: 1.25rem 0 0.6rem;
    color: #4a6394;
    font-weight: 600;
}

.post-content h5 {
    font-size: 1.05rem;
    margin: 1rem 0 0.5rem;
    color: #6b84b8;
    font-weight: 600;
}

.post-content h6 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
    color: #6b84b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-content p {
    margin-bottom: 1rem;
    color: #4a6394;
    line-height: 1.7;
}

.post-content blockquote {
    border-left: 4px solid #91a8d0;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: #4a6394;
    font-style: italic;
    background: #f7f9fc;
    border-radius: 0 8px 8px 0;
}

.post-content pre {
    background: #1a2d4d;
    color: #d4dfeb;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Courier New', monospace;
    border: 1px solid #2d4570;
}

.post-content code {
    background: #eef3f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    color: #4a6394;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.post-content a {
    color: #4a6394;
    text-decoration: underline;
    text-decoration-color: #91a8d0;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: #2d4570;
    text-decoration-color: #2d4570;
}

.post-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

/* ---------- LOGIN PAGE ---------- */
.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(26, 45, 77, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-title {
    font-size: 1.8rem;
    color: #2d4570;
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 700;
}

.login-subtitle {
    color: #6b84b8;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #4a6394;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d4dfeb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #91a8d0;
    box-shadow: 0 0 0 3px rgba(145, 168, 208, 0.2);
}

.btn {
    width: 100%;
    padding: 0.85rem;
    background: #4a6394;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #2d4570;
}

.error {
    background: #f5e5e5;
    color: #8b4a4a;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid #e5c5c5;
}

.captcha-box {
    background: #eef3f9;
    border: 2px solid #91a8d0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.captcha-question {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d4570;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.captcha-hint {
    font-size: 0.8rem;
    color: #6b84b8;
}

.security-notice {
    background: #f5eedf;
    border-left: 3px solid #d0b891;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #8b7355;
    margin-bottom: 1rem;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: #4a6394;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
    color: #2d4570;
}

/* ---------- ADMIN PAGE ---------- */
body.admin {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    color: #2d4570;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    border: 1px solid #eef3f9;
}

.top-bar h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d4570;
}

.top-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.top-bar a {
    color: #4a6394;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 2px solid #4a6394;
    border-radius: 6px;
    transition: all 0.2s;
}

.top-bar a:hover {
    background: #4a6394;
    color: white;
}

.logout-btn {
    color: #c97b7b !important;
    border-color: #d4a5a5 !important;
}

.logout-btn:hover {
    background: #c97b7b !important;
    color: white !important;
}

.nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d4dfeb;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a6394;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-btn.active {
    background: #4a6394;
    color: white;
    border-color: #4a6394;
}

.nav-btn:hover:not(.active) {
    background: #eef3f9;
    border-color: #91a8d0;
}

.view { display: none; }
.view.active { display: block; }

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(26, 45, 77, 0.06);
    margin-bottom: 1rem;
    border: 1px solid #eef3f9;
}

.admin-form-group {
    margin-bottom: 1rem;
}

textarea.admin-textarea {
    min-height: 200px;
    font-family: 'Courier New', monospace;
}

.btn-admin {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 0.5rem;
    transition: background 0.2s;
}

.btn-primary {
    background: #4a6394;
    color: white;
}

.btn-primary:hover {
    background: #2d4570;
}

.btn-secondary {
    background: #6b84b8;
    color: white;
    display: none;
}

.btn-secondary:hover {
    background: #4a6394;
}

.btn-danger {
    background: #c97b7b;
    color: white;
}

.btn-danger:hover {
    background: #a86868;
}

.item {
    padding: 1rem;
    border-bottom: 1px solid #eef3f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item:last-child {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid #d4dfeb;
    background: white;
    cursor: pointer;
}

.btn-sm:hover {
    background: #eef3f9;
    border-color: #91a8d0;
}

.btn-delete {
    color: #c97b7b;
    border-color: #d4a5a5;
}

.btn-delete:hover {
    background: #faf5f5;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto auto;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f7f9fc;
    border-radius: 6px;
}

.field-row input,
.field-row select {
    max-width: 100%;
    padding: 0.4rem;
    font-size: 0.9rem;
}

.hidden { display: none; }

.hint {
    font-size: 0.8rem;
    color: #6b84b8;
    margin-top: 0.3rem;
}

.image-uploader {
    border: 2px dashed #d4dfeb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    background: #f7f9fc;
}

.image-uploader:hover {
    border-color: #91a8d0;
    background: #eef3f9;
}

.image-preview {
    max-width: 300px;
    max-height: 200px;
    border-radius: 6px;
    margin-top: 0.5rem;
    display: block;
}

.image-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.files-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.file-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d4dfeb;
    cursor: pointer;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumb:hover {
    border-color: #91a8d0;
}

.file-thumb .delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(201, 123, 123, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 0.8rem;
    display: none;
}

.file-thumb:hover .delete-btn {
    display: block;
}

/* ---------- UTILITIES ---------- */
.required {
    color: #c97b7b;
}

.admin-heading {
    margin-top: 0;
    color: #2d4570;
}

.admin-editor {
    border: 2px solid #91a8d0;
}

/* ---------- RESPONSIVE (подготовка к mobile-first) ---------- */
/* Здесь будут @media запросы на шаге 2 */