:root {
	--panel-bg: #ffffff;
	--text-color: #333333;
	--text-muted: #666666;
	--border-color: #e0e0e0;
	--primary-color: #007bff;
	--primary-hover: #0056b3;
	--success-color: #28a745;
	--warning-color: #ffc107;
	--table-header-bg: #f8f9fa;
	--card-shadow: rgba(0,0,0,0.2);
}

[data-theme="dark"] {
	--panel-bg: #1e1e1e;
	--text-color: #e0e0e0;
	--text-muted: #a0a0a0;
	--border-color: #333333;
	--primary-color: #375a7f;
	--primary-hover: #2b4764;
	--success-color: #198754;
	--warning-color: #ffc107;
	--table-header-bg: #2a2a2a;
	--card-shadow: rgba(255,255,255,0.2);
}

.preview-img {
	max-width: 150px;
}

.cat-container {
	width: 90%;
	min-height: calc(100vh - 180px);
	margin: 15px auto;
	background: var(--panel-bg);
	padding: 24px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

/* Шапка и управление */
.header-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 15px;
}

h1 {
	font-size: 1.5rem;
}

.controls {
	display: flex;
	gap: 10px;
}

.thumb {
	height: 70px;
}

/* Кнопки */
.btn {
	padding: 8px 16px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	transition: background 0.2s;
}

.btn-primary { 
	background-color: var(--primary-color); 
	color: #fff; 
}
.btn-primary:hover { 
	background-color: var(--primary-hover); 
}
.btn-success { background-color: var(--success-color); color: #fff; }
.btn-warning { background-color: var(--warning-color); color: #212529; }
        
.btn-theme {
	background-color: transparent;
	border: 1px solid var(--border-color);
	color: var(--text-color);
}

        /* Таблица */
        .table-responsive {
            width: 100%;
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
            margin-top: 10px;
        }

        th, td {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-color);
        }

        th {
            background-color: var(--table-header-bg);
            font-weight: 600;
        }

        .count-badge {
            background-color: var(--border-color);
            color: var(--text-color);
            padding: 4px 8px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: bold;
        }

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

/*============= Модальное окно ===================*/
.btn-close { 
	background: #dc3545; 
	color: #fff; 
}

.modal-overlay {
	position: fixed; 
	top: 0; 
	left: 0; 
	width: 100%; 
	height: 100%;
	background: rgba(0,0,0,0.5); 
	display: none; 
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.modal-window {
	background: var(--bg-card); 
	padding: 25px; 
	border-radius: 8px; 
	width: 400px;
	box-shadow: 0 4px 15px var(--card-shadow); 
	position: relative;
}
.modal-title { 
	margin-top: 0; 
	font-size: 1.3rem; 
}
        
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-control { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
.preview-img { max-width: 100px; max-height: 100px; display: block; margin-top: 10px; border-radius: 4px; }
.actions { display: flex; justify-content: space-between; margin-top: 20px; }
  





        /* Адаптивность для мобильных устройств (Экран < 768px) */
        @media screen and (max-width: 768px) {
            table, thead, tbody, th, td, tr {
                display: block;
            }

            thead tr {
                position: absolute;
                top: -9999px;
                left: -9999px;
            }

            tr {
                border: 1px solid var(--border-color);
                border-radius: 6px;
                margin-bottom: 15px;
                background: var(--panel-bg);
                padding: 10px;
            }

            td {
                border: none;
                border-bottom: 1px solid var(--border-color);
                position: relative;
                padding-left: 50%;
                text-align: right;
            }

            td:last-child {
                border-bottom: none;
            }

            td:before {
                position: absolute;
                left: 15px;
                width: 45%;
                white-space: nowrap;
                text-align: left;
                font-weight: 600;
                color: var(--text-muted);
            }

            /* Динамические метки колонок для мобильных */
            td:nth-of-type(1):before { content: "ID"; }
            td:nth-of-type(2):before { content: "Название категории"; }
            td:nth-of-type(3):before { content: "Кол-во подкатегорий"; }
            td:nth-of-type(4):before { content: "Кол-во товаров"; }
            td:nth-of-type(5):before { content: "Действия"; }

            .actions-cell {
                justify-content: flex-end;
            }
            
            .header-actions {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .controls {
                width: 100%;
                justify-content: space-between;
            }
        }

.news-container {
	width: 90%;
	max-width: 800px;
	min-height: calc(100vh - 280px);
	margin: 15px auto;
	background: var(--panel-bg);
	padding: 24px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.news-main-container {
	width: 90%;
	max-width: 1400px;
	min-height: calc(100vh - 280px);
	margin: 15px auto;
	background: var(--panel-bg);
	padding: 24px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.controls {
	display: flex;
	gap: 10px;
}

.forbutton {
	display: flex;
	width: 100%;
}


.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #495057;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 16px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 30px;
}

.btn-back:hover {
    color: #1a73e8;
    border-color: #1a73e8;
    background-color: #f1f7fe;
    transform: translateX(-2px);
}

/* Карточка новости */
.news-article {
	background-color: var(--panel-bg);
	padding: 40px;
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Мета-данные (категория и дата) */
.news-meta {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-bottom: 16px;
	font-size: 14px;
}

.news-category {
    background-color: #e8f0fe;
    color: #1a73e8;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.news-date {
	color: var(--text-color);
}

/* Заголовок */
.news-title {
	font-size: 32px;
	line-height: 1.3;
	margin: 0 0 24px 0;
	color: var(--text-color);
}

/* Адаптивный контейнер для картинки */
.news-image-wrapper {
	margin: 0 -40px 30px -40px; /* Растягиваем картинку на всю ширину карточки */
	overflow: hidden;
}

.news-image {
	width: 100%;
	height: auto;
	max-height: 450px;
	object-fit: cover; /* Сохраняет пропорции, обрезая лишнее */
	display: block;
}

/* Текст новости */
.news-content {
	font-size: 18px;
	color: var(--text-color);
	white-space: pre-line;
}

/* Адаптивность под мобильные устройства */
@media (max-width: 768px) {
    .news-container {
        margin: 20px auto;
    }
    
    .news-article {
        padding: 20px;
    }

    .news-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .news-image-wrapper {
        margin: 0 -20px 20px -20px;
    }

    .news-content {
        font-size: 16px;
    }
}
