/* ========================================
   Блог-движок - Минималистичный дизайн
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #fff;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: 14px;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Layout
======================================== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Боковая панель
======================================== */
.sidebar {
    width: 220px;
    min-width: 220px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.logo {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.close-sidebar {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px;
    cursor: pointer;
}

/* Навигация */
.sidebar-nav {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.nav-link:hover {
    background-color: #e0e0e0;
}

.nav-link.active {
    background-color: #333;
    color: #fff;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Секции */
.sidebar-section {
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.section-title {
    font-size: 11px;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 0 20px 10px;
}

.category-list {
    list-style: none;
}

.category-item {
    margin: 0;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-link:hover {
    background-color: #e0e0e0;
}

.category-link.active {
    background-color: #e0e0e0;
}

.category-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Теги */
.tag-cloud {
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-item {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.tag-item:hover {
    opacity: 0.8;
}

.tag-item.active {
    box-shadow: 0 0 0 2px #333;
}

/* Переключатель темы */
.sidebar-footer {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

.theme-toggle {
    width: 100%;
    padding: 10px;
    border: 1px solid #333;
    background-color: #e0e0e0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: #d5d5d5;
}

.icon-sun, .icon-moon {
    width: 16px;
    height: 16px;
}

.icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: block;
}

/* Оверлей */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Основной контент
======================================== */
.main-content {
    margin-left: 220px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Хедер */
.header {
    padding: 20px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    padding: 8px;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #999;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
}

.search-input:focus {
    outline: none;
    border-color: #999;
}

.search-input::placeholder {
    color: #999;
}

.search-clear {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.search-input:not(:placeholder-shown) + .search-icon {
    right: 35px;
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    opacity: 1;
    visibility: visible;
}

.filter-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background-color: #f5f5f5;
    border-radius: 3px;
    font-size: 12px;
}

.filter-tag button {
    padding: 0 2px;
    font-size: 14px;
    color: #999;
}

.filter-tag button:hover {
    color: #333;
}

/* Контент */
.content-container {
    flex: 1;
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* ========================================
   Карточки постов
======================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.post-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-card-poster {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background-color: #f5f5f5;
    overflow: hidden;
}

.post-card-poster img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-poster svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    color: #ccc;
}

.post-card-content {
    padding: 15px;
}

.post-card-title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.post-card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.post-card-category svg {
    width: 14px;
    height: 14px;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.post-card-tag {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
}

/* Пустое состояние */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    color: #ccc;
}

.empty-state p {
    font-size: 15px;
}

/* ========================================
   Админ-панель
======================================== */
.admin-container {
    max-width: 800px;
    margin: 0 auto;
}

.admin-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 13px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #666;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #333;
    border-bottom-color: #333;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-actions {
    margin-bottom: 20px;
}

.admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #fff;
}

.admin-item-info {
    flex: 1;
}

.admin-item-title {
    font-weight: 500;
    margin-bottom: 3px;
}

.admin-item-meta {
    font-size: 12px;
    color: #666;
}

.admin-item-actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   Кнопки
======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
}

.btn-primary:hover {
    background-color: #555;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #333;
}

.btn-secondary:hover {
    background-color: #d5d5d5;
}

.btn-danger {
    background-color: #fff;
    color: #c00;
    border: 1px solid #c00;
}

.btn-danger:hover {
    background-color: #c00;
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px;
}

/* ========================================
   Экспорт/Импорт
======================================== */
.import-export-section {
    margin-bottom: 25px;
}

.import-export-section h3 {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #333;
}

.export-buttons,
.import-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-input-label {
    cursor: pointer;
}

/* ========================================
   Модальные окна
======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    background-color: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-sm .modal-content {
    max-width: 400px;
}

.modal-md .modal-content {
    max-width: 500px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-title {
    font-size: 16px;
    font-weight: bold;
}

.modal-close {
    padding: 5px;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

/* ========================================
   Модальное окно поста
======================================== */
.post-modal .modal-content {
    max-width: 700px;
}

.modal-nav-btn {
    padding: 5px;
    color: #999;
    transition: color 0.2s;
}

.modal-nav-btn:hover {
    color: #333;
}

.modal-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.post-category {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.post-category svg {
    width: 14px;
    height: 14px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.post-content {
    line-height: 1.7;
}

.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: bold;
}

.post-content h1 { font-size: 1.5rem; }
.post-content h2 { font-size: 1.3rem; }
.post-content h3 { font-size: 1.1rem; }

.post-content p {
    margin-bottom: 15px;
}

.post-content strong {
    font-weight: bold;
}

.post-content em {
    font-style: italic;
}

.post-content code {
    padding: 2px 6px;
    background-color: #f5f5f5;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.post-content pre {
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 15px;
}

.post-content pre code {
    padding: 0;
    background: none;
}

.post-content ul, .post-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.post-content li {
    margin-bottom: 5px;
}

.post-content blockquote {
    padding: 10px 15px;
    border-left: 3px solid #e0e0e0;
    background-color: #f5f5f5;
    margin-bottom: 15px;
    color: #666;
}

.post-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 20px 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.post-content th, .post-content td {
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.post-content th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.post-content a {
    color: #333;
    text-decoration: underline;
}

.post-content img {
    max-width: 100%;
    border-radius: 4px;
    margin: 15px 0;
    cursor: pointer;
}

.post-image {
    margin: 20px 0;
    text-align: center;
}

.post-image-caption {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

/* ========================================
   Формы
======================================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #999;
}

textarea {
    resize: vertical;
    min-height: 150px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* ========================================
   Редактор
======================================== */
.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.toolbar-btn {
    padding: 5px 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.toolbar-btn:hover {
    background-color: #e0e0e0;
}

.editor-toolbar + textarea {
    border-radius: 0 0 4px 4px;
}

.preview-toggle {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.toggle-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toggle-btn:hover {
    background-color: #e0e0e0;
}

.toggle-btn.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.preview-container {
    min-height: 150px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fff;
}

/* ========================================
   Загрузка изображений
======================================== */
.images-upload {
    border: 2px dashed #e0e0e0;
    border-radius: 4px;
    padding: 15px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    font-size: 13px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.upload-btn:hover {
    background-color: #e0e0e0;
}

.images-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .delete-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background-color: #c00;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-preview-item:hover .delete-btn {
    opacity: 1;
}

/* ========================================
   Выбор иконок
======================================== */
.icon-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 5px;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background-color: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s, background-color 0.2s;
}

.icon-option:hover {
    background-color: #e0e0e0;
}

.icon-option.active {
    border-color: #333;
}

.icon-option svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Выбор тегов
======================================== */
.tags-select {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    min-height: 40px;
}

.tag-checkbox {
    display: none;
}

.tag-label {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tag-checkbox:checked + .tag-label {
    opacity: 1;
    box-shadow: 0 0 0 2px #333;
}

/* ========================================
   Цвет тега
======================================== */
.color-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-tag {
    padding: 3px 12px;
    font-size: 12px;
    border-radius: 3px;
}

.color-hsl {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
}

/* ========================================
   Галерея
======================================== */
.gallery-modal .modal-content {
    max-width: 95vw;
    background-color: transparent;
    box-shadow: none;
}

.gallery-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
}

.gallery-nav {
    padding: 12px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.gallery-nav:hover {
    background-color: #f5f5f5;
}

.gallery-image-container {
    text-align: center;
    max-width: calc(95vw - 120px);
}

.gallery-image-container img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
}

.gallery-caption {
    margin-top: 10px;
    color: #fff;
    font-size: 13px;
}

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.gallery-dot.active {
    background-color: #fff;
}

/* ========================================
   Выбор изображения
======================================== */
.image-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.image-select-item {
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s;
}

.image-select-item:hover {
    opacity: 0.8;
}

.image-select-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Toast уведомления
======================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 3px solid #4caf50;
}

.toast.error {
    border-left: 3px solid #f44336;
}

.toast.info {
    border-left: 3px solid #2196f3;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ========================================
   Мобильная адаптация
======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .close-sidebar {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .search-container {
        max-width: none;
    }

    .filter-info {
        display: none;
    }

    .content-container {
        padding: 15px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
    }

    .export-buttons,
    .import-buttons {
        flex-direction: column;
    }

    .export-buttons .btn,
    .import-buttons .btn {
        width: 100%;
    }

    .gallery-container {
        flex-direction: column;
        padding: 50px 15px 15px;
    }

    .gallery-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .gallery-nav.prev { left: 10px; }
    .gallery-nav.next { right: 10px; }

    .gallery-image-container {
        max-width: 100%;
    }

    .toast-container {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }

    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 15px;
    }

    .content-container {
        padding: 10px;
    }

    .post-card-content {
        padding: 12px;
    }

    .admin-title {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }
}

/* ========================================
   Скроллбар
======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ========================================
   Тёмная тема
======================================== */
[data-theme="dark"] {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

[data-theme="dark"] .sidebar {
    background-color: #252525;
    border-color: #404040;
}

[data-theme="dark"] .sidebar-header,
[data-theme="dark"] .sidebar-nav,
[data-theme="dark"] .sidebar-section,
[data-theme="dark"] .sidebar-footer {
    border-color: #404040;
}

[data-theme="dark"] .section-title {
    color: #888;
}

[data-theme="dark"] .nav-link:hover {
    background-color: #333;
}

[data-theme="dark"] .nav-link.active {
    background-color: #e0e0e0;
    color: #333;
}

[data-theme="dark"] .category-link:hover {
    background-color: #333;
}

[data-theme="dark"] .category-link.active {
    background-color: #333;
}

[data-theme="dark"] .theme-toggle {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
}

[data-theme="dark"] .header {
    background-color: #1a1a1a;
    border-color: #404040;
}

[data-theme="dark"] .search-input {
    background-color: #252525;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .post-card {
    background-color: #252525;
    border-color: #404040;
}

[data-theme="dark"] .post-card:hover {
    border-color: #666;
}

[data-theme="dark"] .post-card-poster {
    background-color: #333;
}

[data-theme="dark"] .empty-state {
    color: #777;
}

[data-theme="dark"] .empty-state svg {
    color: #444;
}

[data-theme="dark"] .admin-item {
    background-color: #252525;
    border-color: #404040;
}

[data-theme="dark"] .modal-content {
    background-color: #252525;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: #404040;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: #333;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .btn-primary {
    background-color: #e0e0e0;
    color: #333;
    border-color: #e0e0e0;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #fff;
}

[data-theme="dark"] .btn-secondary {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: #444;
}

[data-theme="dark"] .editor-toolbar,
[data-theme="dark"] .preview-container,
[data-theme="dark"] .images-upload,
[data-theme="dark"] .tags-select {
    background-color: #333;
    border-color: #404040;
}

[data-theme="dark"] .toolbar-btn:hover,
[data-theme="dark"] .toggle-btn:hover,
[data-theme="dark"] .upload-btn:hover,
[data-theme="dark"] .icon-option:hover {
    background-color: #444;
}

[data-theme="dark"] .toggle-btn.active {
    background-color: #e0e0e0;
    color: #333;
    border-color: #e0e0e0;
}

[data-theme="dark"] .tab-btn {
    color: #888;
}

[data-theme="dark"] .tab-btn:hover,
[data-theme="dark"] .tab-btn.active {
    color: #e0e0e0;
}

[data-theme="dark"] .tab-btn.active {
    border-bottom-color: #e0e0e0;
}

[data-theme="dark"] .post-content code,
[data-theme="dark"] .post-content pre,
[data-theme="dark"] .post-content blockquote {
    background-color: #333;
}

[data-theme="dark"] .post-content th {
    background-color: #333;
}

[data-theme="dark"] .post-content th,
[data-theme="dark"] .post-content td {
    border-color: #404040;
}

[data-theme="dark"] .toast {
    background-color: #333;
    color: #e0e0e0;
}

/* Утилиты */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
