/* --- ПЕРЕМЕННЫЕ (Светлая лесная палитра) --- */
:root {
    --primary: #2d5a27;    /* Глубокий хвойный */
    --primary-hover: #3d7a35;
    --accent: #5d4037;     /* Древесный */
    --bg-header: #f8f9f2;  /* Очень светлый оливковый для хедера */
    --bg-site: #fdfdfd;
    --text: #333;
    --text-muted: #777;
    --white: #ffffff;
    --border: #e0e4d9;
    --shadow: 0 4px 15px rgba(0,0,0,0.06);
    --radius: 8px;
}

/* --- БАЗОВЫЕ СТИЛИ --- */
* { box-sizing: border-box; }
html, body { overflow-x: hidden; width: 100%; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    line-height: 1.6; color: var(--text); background: var(--bg-site); margin: 0; 
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- ВЫДЕЛЕННЫЙ ХЕДЕР --- */
.site-header { 
    background: var(--bg-header); 
    border-bottom: 2px solid var(--primary); 
    padding: 8px 0; position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.logo a { font-weight: 800; font-size: 22px; text-decoration: none; color: var(--primary); display: flex; align-items: center; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { text-decoration: none; color: #555; font-size: 14px; font-weight: 600; transition: 0.2s; }
.main-nav a:hover { color: var(--primary); }
.admin-link { color: #b08d57 !important; text-transform: uppercase; letter-spacing: 0.5px; }

/* --- КНОПКИ --- */
button, .btn, .btn-ok { 
    background: var(--primary); color: white; border: none; 
    padding: 10px 20px; border-radius: var(--radius); cursor: pointer; 
    font-weight: 600; transition: 0.3s; display: inline-block; text-align: center;
}
button:hover, .btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-no { background: #c0392b; color: white; padding: 8px 15px; border-radius: 4px; border:none; cursor:pointer; }
.btn-small { padding: 5px 12px; font-size: 13px; }

/* --- МОДАЛКИ (ЦЕНТРИРОВАНИЕ И ФИКС) --- */
.modal { 
    display: none; position: fixed !important; z-index: 9000; 
    left: 0; top: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
}
.modal-content { 
    background: var(--white); padding: 40px; border-radius: 12px; 
    width: 95%; max-width: 420px; position: relative; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.2); border-top: 6px solid var(--primary);
}
.modal-content h3 { margin: 0 0 20px 0; font-size: 22px; color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.close { position: absolute; right: 20px; top: 15px; font-size: 30px; cursor: pointer; color: #bbb; line-height: 1; }
.close:hover { color: var(--primary); }

/* --- ФОРМЫ --- */
.form-box { background: white; padding: 25px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 25px; }
input, select, textarea { 
    width: 100%; padding: 12px; margin: 8px 0 18px; 
    border: 1px solid #d1d5db; border-radius: 6px; font-size: 15px; background: #fff;
}
input:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1); }

/* --- ОТЗЫВЫ (2 В РЯД, СТИЛЬ КАРТ) --- */
.reviews-list { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin: 30px 0; }
.review-card { 
    background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border);
    display: flex; flex-direction: column; transition: 0.3s;
}
.review-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.review-header { display: flex; justify-content: space-between; margin-bottom: 15px; align-items: flex-start; }
.author { font-weight: 700; font-size: 16px; color: var(--accent); }
.date { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.rating { color: #f1c40f; font-size: 18px; }
.review-text { text-align: center; margin: 20px 0; flex-grow: 1; font-style: italic; color: #444; }
.review-card img { 
    width: 100%; height: 200px; object-fit: cover; border-radius: 8px; 
    cursor: pointer; border: 1px solid #eee; margin-top: 15px;
}

/* --- НОВОСТИ И СТАТЬИ --- */
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.news-card { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.news-card-content { padding: 20px; }
.news-card h3 { margin: 0 0 10px 0; color: var(--primary); font-size: 20px; }
.news-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

/* --- АДМИН-ПАНЕЛЬ: СЕТКА --- */
.news-admin-grid { display: grid; grid-template-columns: 280px 1fr; gap: 30px; align-items: start; }
.admin-nav { background: #34495e; padding: 15px; border-radius: var(--radius); margin-bottom: 30px; display: flex; gap: 20px; }
.admin-nav a { color: white; text-decoration: none; font-weight: bold; font-size: 14px; }
.admin-nav a:hover { color: #f1c40f; }

/* ТАБЛИЦЫ */
.data-table { width: 100%; border-collapse: collapse; margin-top: 20px; background: white; }
.data-table th { background: #f9fafb; padding: 15px; text-align: left; border-bottom: 2px solid var(--primary); font-size: 13px; text-transform: uppercase; color: #666; }
.data-table td { padding: 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }

/* --- ИСПРАВЛЕНИЕ РЕДАКТОРА СТАТЕЙ --- */
.editor-toolbar { background: #f3f4f6 !important; border: 1px solid var(--border) !important; border-bottom: none !important; opacity: 1 !important; }
.editor-toolbar button { color: #374151 !important; border: 1px solid transparent !important; width: 36px !important; height: 30px !important; }
.editor-toolbar button.active, .editor-toolbar button:hover { background: #fff !important; border-color: #d1d5db !important; }
.CodeMirror { border: 1px solid var(--border) !important; border-radius: 0 0 8px 8px !important; font-size: 15px; }

/* --- ГАЛЕРЕЯ (ВКЛАДКИ) --- */
.gallery-tabs { display: flex; gap: 8px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; }
.tab { padding: 12px 24px; text-decoration: none; color: #666; font-weight: 600; border-radius: 8px 8px 0 0; transition: 0.3s; background: #f0f0f0; }
.tab.active { background: var(--primary); color: white; }
.gallery-subtabs { display: flex; gap: 15px; margin-bottom: 20px; padding: 10px; background: #f9fafb; border-radius: 8px; }
.subtab { text-decoration: none; color: var(--accent); font-weight: 500; font-size: 14px; }
.subtab:hover { text-decoration: underline; }

/* --- ЛАЙТБОКС (ПРОСМОТР ФОТО) --- */
.lightbox-container { position: relative; max-width: 90vw; max-height: 90vh; }
#lightbox-img { max-width: 100%; max-height: 85vh; border: 6px solid white; border-radius: 4px; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
.prev, .next { position: fixed; top: 50%; transform: translateY(-50%); font-size: 60px; color: white; cursor: pointer; padding: 20px; user-select: none; text-decoration: none; z-index: 9999; }
.prev { left: 20px; } .next { right: 20px; }

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (RESPONSIVE) --- */
@media (max-width: 992px) {
    .news-admin-grid { grid-template-columns: 1fr; }
    .news-admin-grid aside { order: 2; }
    .news-admin-grid section { order: 1; }
}

@media (max-width: 768px) {
    .header-flex { flex-direction: column; gap: 15px; }
    .main-nav { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .reviews-list, .news-grid { grid-template-columns: 1fr; }
    .modal-content { padding: 25px; }
    .prev, .next { font-size: 40px; }
}

/* --- ВСПЛЫВАШКИ --- */
#toast-container { position: fixed; top: 80px; right: 20px; z-index: 10000; }
.toast { background: #27ae60; color: white; padding: 15px 30px; margin-bottom: 10px; border-radius: 8px; opacity: 0; transform: translateX(100px); transition: 0.4s; box-shadow: 0 5px 15px rgba(0,0,0,0.15); font-weight: 600; }
.toast.error { background: #e74c3c; }
.toast.show { opacity: 1; transform: translateX(0); }