/* clicpick.ru: кнопка "Купить" и счетчик "- 1 +" в списках товаров (cart-counter.js).
 * Только раскладка. Цвета и скругление - из темы: классы btn-primary / btn-default / text-danger
 * и переменные --cc-*, которые cart-counter.js берет из стилей этих же классов темы.
 * Ряд кнопок на компьютере показывается и прячется по наведению, как в теме. */

/* Слот на месте кнопки "Купить": кнопка темы, счетчик, "Добавлено", "В корзине: N шт." - по режиму */
.cc-wrap {
	position: relative;
}

.cc-wrap > .cc-counter,
.cc-wrap > .cc-added,
.cc-wrap > .cc-incart {
	display: none !important;
}

.cc-box.cc-mode-edit .cc-wrap > .cc-counter {
	display: flex !important;
}

.cc-box.cc-mode-added .cc-wrap > .cc-added,
.cc-box.cc-mode-incart .cc-wrap > .cc-incart {
	display: block !important;
}

.cc-box:not(.cc-mode-buy) .cc-cart-btn {
	display: none !important;
}

/* Один размер для всех состояний слота; на компьютере высота как у кнопки темы */
.cc-slot,
.product-thumb .button-group .cc-slot {
	width: 160px;
	max-width: 100%;
	height: 34px;
	margin-left: auto;
	margin-right: auto;
}

.cc-added,
.cc-incart {
	padding: 0 6px;
	line-height: 32px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Счетчик: рамка и "-", "+" цветом основной кнопки темы, цифра цветом текста темы, фон как у кнопки темы */
.cc-counter {
	align-items: stretch;
	overflow: hidden;
	border: 1px solid var(--cc-primary-bg);
	border-radius: var(--cc-radius);
	background-color: var(--cc-default-bg);
}

.cc-counter .cc-minus,
.cc-counter .cc-plus {
	flex: 0 0 34px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cc-primary-bg);
	font-size: 18px;
	line-height: 1;
}

.cc-counter .cc-qty {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cc-text);
	text-align: center;
}

/* Ошибка - мелко под слотом, поверх, ничего не сдвигает */
.cc-msg {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	margin-top: 2px;
	line-height: 16px;
	text-align: center;
	white-space: nowrap;
}

.cc-msg:empty {
	display: none;
}

/* Строка "В корзине: N шт." под ценой (только компьютер, без наведения).
 * Отрицательный нижний отступ гасит свою высоту - карточка не меняется. */
.cc-note {
	display: none;
	height: 18px;
	line-height: 18px;
	margin-bottom: -18px;
	text-align: center;
	color: var(--cc-primary-bg);
}

@media (min-width: 1200px) {
	.cc-note.cc-note-on {
		display: block;
	}

	.product-thumb:hover .cc-note {
		visibility: hidden;
	}
}

/* Телефон и планшет: ряд кнопок виден всегда; тема красит его кнопки в серый */
@media (max-width: 1199px) {
	/* Высота ряда - по слоту (36px + отступы ряда темы), чтобы ряд не прыгал при смене значков на слот */
	.product-thumb .button-group .inner {
		flex-wrap: wrap;
		align-items: center;
		min-height: 46px;
	}

	/* Значки - пока товара нет в корзине; дальше на их месте слот */
	.product-thumb .button-group.cc-box:not(.cc-mode-buy) .inner > .btn {
		display: none;
	}

	.product-thumb .button-group .cc-wrap {
		flex: 1 1 100%;
	}

	.product-thumb .button-group .cc-slot {
		width: 50%;
		min-width: 110px;
		height: 36px;
	}

	/* Тележка - такой же значок, как соседние (размеры, отступы, без фона и рамки - из правил темы для ряда),
	 * отличается только цветом: цвет основной кнопки темы */
	.product-thumb .button-group .button-card.cc-slot {
		width: auto;
		min-width: 0;
		height: auto;
		margin: 0;
	}

	.product-thumb .button-group .button-card,
	.product-thumb .button-group .button-card:hover,
	.product-thumb .button-group .button-card:focus,
	.product-thumb .button-group .button-card:active {
		background: transparent;
		color: var(--cc-primary-bg);
	}

	.product-thumb .button-group .cc-added,
	.product-thumb .button-group .cc-incart {
		padding: 0 4px;
		line-height: 34px;
		font-size: 12px;
		border: 1px solid var(--cc-default-border);
		border-radius: var(--cc-radius);
		background-color: var(--cc-default-bg);
		color: var(--cc-default-fg);
	}

	.product-thumb .button-group .cc-counter .cc-minus,
	.product-thumb .button-group .cc-counter .cc-plus {
		flex-basis: 36px;
	}

	/* 16px - чтобы телефон не увеличивал страницу при вводе */
	.product-thumb .button-group .cc-counter .cc-qty {
		font-size: 16px;
	}
}
