/* 🔹 Фильтры и форма каталога */
.catalog-filter-form {
    margin-bottom: 20px;
}

.div-catalog {
    margin-top: 20px;
}


/* Flex-контейнер для карточки */
/* Flex-контейнер карточки */
.catalog-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    margin-bottom: 15px;
    transition: background 0.2s;
}

.catalog-item:hover {
    background: #f0f8ff;
}

/* Основная информация */
.catalog-info {
    flex: 1;
    margin-left: 10px;
}

/* 🔹 Кастомный чекбокс */
.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-right: 10px;
}

.custom-checkbox input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    background-color: #fff;
    border: 2px solid #007263;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #007263;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 🔹 Количество с кнопками ± */
.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-tovar-count {
    width: 100px;
    text-align: center;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #007263;
    background-color: #fff;
    color: #007263;
    font-size: 18px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover {
    background-color: #007263;
    color: #fff;
}


.form-control-full {
    width: 100%;
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.pagination {
    display: flex;
    flex-wrap: wrap; /* 🌟 перенос на новую строку */
    gap: 5px; /* промежутки между страницами */
    margin: 15px 0;
    justify-content: flex-start; /* выравнивание слева */
    font-size: 14px;
}

.pagination a,
.pagination span {
    padding: 6px 10px;
    border: 1px solid #ccc;
    text-decoration: none;
    color: #007263;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
}

.pagination a:hover {
    background-color: #007263;
    color: #fff;
}

.pagination .active-page {
    font-weight: bold;
    background-color: #007263;
    color: #fff;
    border-color: #007263;
}


/* 🔹 Списки категорий */
.category-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
}

.category-inline-list label {
    margin-right: 10px;
}


/* 🔹 Описание категории/подкатегории под H1 */
.category-description {
    margin-top: 12px;
    padding: 10px 15px;
    background-color: #f9f9f9;
    border-left: 4px solid #4CAF50; /* акцент слева */
    border-radius: 4px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    max-width: 800px;
}


.custom-fieldset {
    margin-top: 15px;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 15px 15px 20px 15px;
}

.custom-fieldset legend {
    padding: 0 12px;
    font-weight: bold;
}

/* 🔹 Сетка категорий */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;           /* равномерные отступы */
    margin-top: 20px;
    justify-content: flex-start; /* плитки всегда прижаты влево */
}

/* 🔹 Плитки */
.category-tile {
    background-color: #f2f2f2;
    border-radius: 8px;
    flex: 1 1 200px;     /* минимальная ширина 200px */
    max-width: 250px;    /* максимальная ширина */
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative;
}



.category-tile:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    background-color: #eaeaea;
}

.category-tile a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

.category-name {
    padding: 10px;
}

/* 🔹 Плитки подкатегорий и вложенные (универсально) */
.subcategory-tile { 
    width: 240px; 
    height: 140px; 
}

/* Используем общий стиль для всех карточек категорий */
.category-tile {
    background-color: #f2f2f2;
    border-radius: 8px;
    width: 200px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative;
}

.category-tile:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    background-color: #eaeaea;
}

.category-tile a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

.category-name {
    padding: 10px;
}


/* 🔹 Кнопки редактирования/удаления в режиме редактирования */
.edit-top-left,
.edit-bottom-right {
    position: absolute;
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    color: #fff;
    text-decoration: none;
}


.edit-top-left {
    top: 5px;
    left: 5px;
    background-color: rgba(0,123,255,0.85);
}

.edit-bottom-right {
    bottom: 5px;
    right: 5px;
    background-color: rgba(220,53,69,0.85);
}

body.edit-mode .category-tile:hover .edit-top-left,
body.edit-mode .category-tile:hover .edit-bottom-right {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

body.edit-mode .category-tile .edit-top-left:hover,
body.edit-mode .category-tile .edit-bottom-right:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}


/* Для администратора показываем обе кнопки */
body.admin-mode .category-tile:hover .edit-top-left,
body.admin-mode .category-tile:hover .edit-bottom-right {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Для редактора показываем только кнопку редактирования */
body.editor-mode .category-tile:hover .edit-top-left {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* По умолчанию скрываем */
.edit-top-left,
.edit-bottom-right {
    position: absolute;
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    color: #fff;
    text-decoration: none;
}





/* Скрываем кнопки по умолчанию */
.catalog-item .edit-top-left,
.catalog-item .edit-bottom-right {
    position: absolute;
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    color: #fff;
    text-decoration: none;
}

/* Кнопки появляются при наведении */
body.admin-mode .catalog-item:hover .edit-top-left,
body.admin-mode .catalog-item:hover .edit-bottom-right {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Эффект наведения на кнопку */
body.admin-mode .catalog-item .edit-top-left:hover,
body.admin-mode .catalog-item .edit-bottom-right:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Если нужно для редактора только редактировать */
body.editor-mode .catalog-item:hover .edit-top-left {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}



/* Для всех collapsible блоков одинаково */
.collapsible {
  position: relative;
}

.collapsible .collapsible-content {
  max-height: 0;
  overflow: hidden;
  margin-top: 10px;
  transition: max-height 0.3s ease;
}

.arrow-toggle {
  position: absolute;
  top: 2px;
  right: 12px;
  width: 30px;
  height: 30px;
  font-size: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
}

.arrow-toggle:hover {
  color: #000;
}

.collapsible.open .arrow-toggle {
  transform: rotate(90deg);
}

/* 🔹 Кастомный чекбокс — увеличенный, как поле ± */
.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 50px;   /* ширина как у поля количества */
    height: 28px;  /* высота как у поля количества */
    flex-shrink: 0;
    margin: 0 8px; /* отступ слева и справа */
}

.custom-checkbox input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;  /* совпадает с шириной блока */
    height: 28px; /* совпадает с высотой блока */
    background-color: #fff;
    border: 2px solid #007263;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #007263;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
    left: 18px; /* позиция галочки внутри */
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

