/* --- ШРИФТЫ --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

/* --- ЦВЕТОВЫЕ ПЕРЕМЕННЫЕ (DEFAULT: DARK) --- */
:root {
    --bg-body: #050505;
    --bg-card: #121212;
    --bg-input: #1c1c1c;
    --bg-header: rgba(5, 5, 5, 0.85);
    
    --text-main: #e5e5e5;
    --text-muted: #737373;
    
    --border: #2d2d2d;
    
    --accent: #00ff41;        /* Termux Green */
    --accent-hover: #00cc33;
    --accent-text: #000000;
    
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* --- СВЕТЛАЯ ТЕМА --- */
[data-theme="light"] {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;
    --bg-header: rgba(255, 255, 255, 0.9);
    
    --text-main: #111827;
    --text-muted: #6b7280;
    
    --border: #e5e7eb;
    
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-text: #ffffff;
    
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* --- ГЛОБАЛЬНЫЕ СТИЛИ --- */
* { box-sizing: border-box; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a { 
    text-decoration: none; 
    color: inherit; 
    transition: all 0.2s ease; 
}

main { flex: 1; }

.container { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 0 20px; 
    width: 100%; 
}

/* --- ШАПКА (HEADER) --- */
.main-header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 12px 0;
}

.header-inner { display: flex; justify-content: space-between; align-items: center; }

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
.nav-links a:hover { color: var(--accent); }

/* Кнопка смены темы */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* --- ЭЛЕМЕНТЫ ФОРМ --- */
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }

input[type="text"], input[type="password"], textarea, select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.1);
}

/* --- ПОИСК (Кнопка внутри инпута) --- */
.search-wrapper {
    position: relative;
    margin: 35px 0;
    max-width: 100%;
}
.search-wrapper form {
    display: flex;
    align-items: center;
    position: relative;
}
.search-input {
    width: 100%;
    padding: 18px 55px 18px 25px; /* Отступ справа для кнопки */
    border-radius: 50px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 1.05rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.search-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* --- КНОПКИ --- */
.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.2s;
    font-size: 0.95rem;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
}

/* --- КОД: INLINE (ВНУТРИ СТРОКИ) --- */
code {
    background: rgba(128, 128, 128, 0.15);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* --- КОД: BLOCKS (БОЛЬШИЕ) --- */
pre.command-block {
    display: block;
    background: #0d0d0d !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    
    /* Отступы: Справа 60px чтобы текст не лез под кнопку */
    padding: 20px 60px 20px 20px; 
    margin: 25px 0;
    
    position: relative;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e5e5e5;
    
    overflow-x: auto;   /* Горизонтальный скролл */
    overflow-y: hidden; /* Вертикальный запрещен */
    white-space: pre;   /* Сохранять форматирование */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* Сброс стилей code внутри pre */
pre.command-block code {
    background: transparent;
    padding: 0;
    color: inherit;
    border-radius: 0;
    font-size: inherit;
}

/* Кнопка копирования */
.copy-btn-icon {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 10;
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.copy-btn-icon:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    transform: scale(1.05);
}

/* --- СТАТЬИ (POSTS) --- */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: block;
}
.post-card:hover { 
    transform: translateY(-4px); 
    border-color: var(--accent); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.post-category {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--accent); margin-bottom: 10px; display: inline-block;
}

.post-header h1 { font-size: 2.2rem; margin: 10px 0; line-height: 1.2; }
.post-meta { color: var(--text-muted); font-size: 0.9rem; display: flex; gap: 15px; margin-bottom: 20px; }

/* Контент статьи */
.article-content { font-size: 1.15rem; line-height: 1.8; color: var(--text-main); }
.article-content h2 { margin-top: 40px; color: var(--accent); }
.article-content ul { padding-left: 20px; }
.article-content li { margin-bottom: 10px; }

.read-more-btn {
    display: inline-flex; align-items: center; color: var(--accent);
    font-weight: 600; margin-top: 15px; gap: 8px;
}

/* --- КНОПКИ ПОДЕЛИТЬСЯ --- */
.share-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: 15px; margin-top: 40px; 
}
.share-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 15px; border-radius: var(--radius);
    color: white; font-weight: 600; font-size: 0.9rem;
    border: none; cursor: pointer; transition: 0.2s; text-align: center; gap: 8px;
}
.share-tile:hover { transform: translateY(-3px); filter: brightness(1.1); }

.bg-tg { background: #229ED9; }
.bg-vk { background: #0077FF; }
.bg-copy { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-main); }
.bg-pdf { background: #e11d48; }

/* --- ДИСКЛЕЙМЕР --- */
.ai-disclaimer {
    margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--border);
    font-size: 0.85rem; color: var(--text-muted); font-style: italic; opacity: 0.7;
}

/* --- FOOTER --- */
.main-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 50px 0 20px; margin-top: 60px; font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px; }
.footer-col h4 { color: var(--text-main); margin-bottom: 20px; font-weight: 700; font-size: 1.1rem; }
.footer-col a { display: block; margin-bottom: 10px; color: var(--text-muted); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 40px; padding-top: 20px; text-align: center; color: var(--text-muted); }

/* --- АДМИНКА --- */
.admin-table-wrapper { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-card); }
.admin-table th { background: var(--bg-input); color: var(--text-muted); font-weight: 600; padding: 15px; text-align: left; }
.admin-table td { padding: 15px; border-bottom: 1px solid var(--border); }
.admin-table tr:hover { background: var(--bg-input); }

/* --- МОБИЛЬНАЯ ВЕРСИЯ --- */
@media (max-width: 600px) {
    .header-inner { flex-wrap: wrap; }
    .nav-links { width: 100%; justify-content: space-between; margin-top: 15px; overflow-x: auto; padding-bottom: 5px; }
    .post-header h1 { font-size: 1.8rem; }
    .share-grid { grid-template-columns: 1fr 1fr; }
    pre.command-block { font-size: 0.85rem; padding: 15px 50px 15px 15px; }
}
/* ... весь ваш предыдущий CSS ... */

/* --- LEGAL BANNER (Cookie + Disclaimer) --- */
.legal-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%); /* Центрируем */
    width: 90%;
    max-width: 800px;
    
    background: var(--bg-header); /* Полупрозрачный фон из темы */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    
    border: 1px solid var(--accent);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 16px;
    
    padding: 20px;
    z-index: 9999;
    
    display: none; /* Скрыт по умолчанию, JS покажет */
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    animation: slideUp 0.5s ease-out;
}

.legal-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.legal-icon {
    font-size: 1.5rem;
    color: var(--accent);
    margin-top: 5px;
}

.legal-text strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-main);
    font-size: 1rem;
}

.legal-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.legal-text b {
    color: var(--text-main);
}

@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Адаптив для телефонов */
@media (max-width: 600px) {
    .legal-banner {
        flex-direction: column;
        align-items: stretch;
        bottom: 10px;
        width: 95%;
    }
    .legal-text p { font-size: 0.8rem; }
    #accept-legal { width: 100%; justify-content: center; }
}
/* Анимация появления новых постов */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}