/* PriceList Module - Reference Style (загружается последним) */
/* Updated: 2025-12-04 - React optimization support */

/* Переопределяем родительские ограничения для полной ширины таблицы */
/* Убираем max-width у .center */
.content-inner.center:has(.pricelist-container) {
	max-width: none;
	padding: 0;
}

/* Для старых браузеров без :has() - альтернативный вариант */
.content-inner.center .pricelist-container {
	margin-left: calc(-50vw + 50%);
	margin-right: calc(-50vw + 50%);
	width: 100vw;
	max-width: 100vw;
	padding: 20px 30px;
	box-sizing: border-box;
}

/* Переопределяем для column-center ONLY when pricelist is inside */
.content .column-center:has(.pricelist-container) {
	padding: 0;
	width: 100%;
}

.content .column-center .pricelist-container {
	margin: 0;
	padding: 20px 30px;
}

/* Таблица на всю ширину экрана */
.pricelist-table-wrapper {
	overflow-x: auto;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
}

/* Заголовок */
.pricelist-header {
	margin-bottom: 20px;
}

.pricelist-note {
	font-size: 14px;
	color: #666;
	font-style: italic;
	margin: 0 0 15px 0;
}

/* Контент - simple wrapper */
.pricelist-container .pricelist-content {
	width: 100%;
}

/* Main container - flexbox for filters and table */
.pricelist-main {
	display: flex;
	width: 100%;
	gap: 20px;
	align-items: flex-start;
}

/* Фильтры - fixed width 340px */
.pricelist-filters-wrapper {
	flex: 0 0 340px;
	width: 340px;
}

/* Таблица - занимает оставшееся место */
.pricelist-table-area {
	flex: 1;
	min-width: 0;
}

.pricelist-filters {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: 0;
}

/* Фильтры в две колонки */
.pricelist-filters-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	padding: 20px 15px;
	border-bottom: 1px solid #e0e0e0;
}

.pricelist-filter-col {
	display: flex;
	flex-direction: column;
}

.pricelist-filter-group {
	border-bottom: 1px solid #e0e0e0;
	padding: 20px 15px;
}

.pricelist-filter-group:last-child {
	border-bottom: none;
}


.pricelist-filter-label {
	font-weight: 600;
	font-size: 14px;
	color: #333;
	margin-bottom: 12px;
	display: block;
}

.pricelist-filter-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Отключаем автоматическую стилизацию js-selectbox */
.pricelist-custom-styled input[type="checkbox"].-styled,
.pricelist-custom-styled input[type="radio"].-styled {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.pricelist-custom-styled input + label[for] {
	display: none;
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	visibility: hidden;
	pointer-events: none;
}

.pricelist-custom-styled input + label[for]:before,
.pricelist-custom-styled input + label[for]:after {
	display: none;
	content: none;
}

/* Овальные кнопки фильтров - как в референсе */
.pricelist-filter-option {
	position: relative;
	cursor: pointer;
	padding: 0;
	margin: 0;
	display: block;
}

.pricelist-filter-option input[type="radio"],
.pricelist-filter-option input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.pricelist-filter-option span {
	display: block;
	padding: 8px 16px;
	border: 2px solid #ddd;
	border-radius: 20px;
	font-size: 14px;
	text-align: center;
	transition: all 0.2s;
	user-select: none;
	background: #fff;
	color: #333;
}

.pricelist-filter-option:hover span {
	border-color: #999;
}

/* КРАСНЫЙ бордер для выбранных */
.pricelist-filter-option input[type="radio"]:checked + span,
.pricelist-filter-option input[type="checkbox"]:checked + span {
	background-color: #fff;
	border-color: #dc3545;
	border-width: 2px;
	color: #333;
	font-weight: 600;
}

/* Теги списком */
.pricelist-tags-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Теги - с вертикальным скроллом при необходимости */
.pricelist-filter-col .pricelist-tags-list {
	max-height: 490px;
	overflow-y: auto;
}

/* Кнопки фильтров */
.pricelist-filter-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 15px;
	border-top: 1px solid #e0e0e0;
}

.pricelist-btn {
	padding: 12px 20px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	display: inline-block;
	transition: all 0.3s;
}

.pricelist-btn-primary {
	background-color: #0085f2;
	color: white;
}

.pricelist-btn-primary:hover {
	background-color: #0066c0;
}

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

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

.pricelist-btn-sm {
	padding: 8px 14px;
	font-size: 13px;
}


.pricelist-info {
	margin-bottom: 15px;
}

.pricelist-info p {
	margin: 0;
	font-size: 14px;
	color: #666;
}

.pricelist-info strong {
	color: #333;
	font-weight: 600;
}

.pricelist-table {
	width: 100%;
	border-collapse: collapse;
	background: white;
}

.pricelist-table thead {
	background-color: #f9f9f9;
	border-bottom: 2px solid #e0e0e0;
}

.pricelist-table th {
	padding: 15px 12px;
	text-align: left;
	font-weight: 600;
	font-size: 14px;
	color: #333;
	border-bottom: 2px solid #e0e0e0;
}

.pricelist-th-photo {
	width: 10%;
}

.pricelist-th-name {
	width: 25%;
}

.pricelist-th-genre {
	width: 45%;
}

.pricelist-th-price {
	width: 20%;
	text-align: right;
	white-space: nowrap;
}

.pricelist-artist-row {
	border-bottom: 1px solid #f0f0f0;
	transition: background-color 0.2s;
}

.pricelist-artist-row:hover {
	background-color: #fafafa;
}

.pricelist-artist-row:last-child {
	border-bottom: none;
}

.pricelist-table td {
	padding: 15px 12px;
	vertical-align: middle;
	font-size: 14px;
	color: #333;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* Ячейка с фото - flex для центрирования */
.pricelist-table td:first-child {
	text-align: center;
}

.pricelist-table td:last-child {
	text-align: right;
	white-space: nowrap;
}

/* Изображения артистов - СТРОГО квадратные */
.pricelist-artist-image {
	width: 80px;
	height: 80px;
	max-width: 80px;
	max-height: 80px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
	margin: 0 auto;
	flex-shrink: 0;
}

.pricelist-no-image {
	width: 80px;
	height: 80px;
	max-width: 80px;
	max-height: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #f5f5f5;
	border-radius: 4px;
	color: #999;
	font-size: 11px;
	text-align: center;
	line-height: 1.2;
	margin: 0 auto;
	flex-shrink: 0;
}

/* Имена артистов - ссылки */
.pricelist-artist-link {
	color: #333;
	text-decoration: none;
	transition: color 0.2s;
	display: inline-block;
}

.pricelist-artist-link:hover {
	color: #0085f2;
	text-decoration: none;
}

.pricelist-artist-link strong {
	font-weight: 600;
	font-size: 17px;
}

.pricelist-table td strong {
	font-weight: 600;
	color: #333;
	font-size: 15px;
}

/* Цены */
.pricelist-table td:last-child strong {
	font-weight: 600;
	color: #333;
	white-space: nowrap;
}

/* Двухстрочный гонорар - по умолчанию скрыт перенос */
.price-text br {
	display: none;
}

/* Жанры - по умолчанию показываем все */
.genre-full {
	display: inline;
}

.genre-mobile {
	display: none;
}

/* Пустое состояние */
.pricelist-empty {
	text-align: center;
	padding: 40px 20px;
	color: #999;
}

.pricelist-empty p {
	margin: 5px 0;
	font-size: 14px;
}

/* Пагинация */
.pricelist-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.pricelist-pagination-info {
	padding: 8px 14px;
	font-size: 14px;
	color: #666;
	font-weight: 500;
}

/* Адаптивность */
@media (max-width: 992px) {
	/* На планшетах - фильтры сверху */
	.pricelist-main {
		flex-direction: column;
	}
	
	.pricelist-filters-wrapper {
		flex: none;
		width: 100%;
		margin-bottom: 20px;
	}
	
	.pricelist-table-area {
		width: 100%;
	}
	
	/* Колонки таблицы */
	.pricelist-th-photo {
		width: 12%;
	}
	
	.pricelist-th-name {
		width: 28%;
	}
	
	.pricelist-th-genre {
		width: 40%;
	}
	
	.pricelist-th-price {
		width: 20%;
	}
	
	.pricelist-artist-image,
	.pricelist-no-image {
		width: 70px;
		height: 70px;
		max-width: 70px;
		max-height: 70px;
	}
}

@media (max-width: 768px) {
	.content-inner.center .pricelist-container {
		margin-left: -10px;
		margin-right: -10px;
		width: calc(100% + 20px);
		padding: 10px;
	}
	
	.pricelist-table-wrapper {
		overflow-x: visible;
	}

	.pricelist-artist-image,
	.pricelist-no-image {
		width: 80px;
		height: 80px;
		max-width: 80px;
		max-height: 80px;
	}
	
	/* В мобильной - только первый жанр */
	.genre-full {
		display: none;
	}
	
	.genre-mobile {
		display: inline;
	}

	.pricelist-table {
		font-size: 12px;
		table-layout: fixed;
		width: 100%;
	}

	.pricelist-table th,
	.pricelist-table td {
		padding: 8px 4px;
		word-break: break-word;
	}
	
	/* Убираем min-width для мобильных */
	.pricelist-th-photo {
		width: 12%;
	}
	
	.pricelist-th-name {
		width: 28%;
	}
	
	.pricelist-th-genre {
		width: 40%;
	}
	
	.pricelist-th-price {
		width: 20%;
		font-size: 12px;
	}

	.pricelist-filter-label {
		font-size: 13px;
	}

	.pricelist-filter-option span {
		font-size: 13px;
		padding: 6px 12px;
	}
	
	.pricelist-artist-link strong {
		font-size: 15px;
	}
}

@media (max-width: 480px) {
	.content-inner.center .pricelist-container {
		margin-left: -5px;
		margin-right: -5px;
		width: calc(100% + 10px);
		padding: 8px 5px;
	}
	
	.pricelist-table-wrapper {
		overflow-x: visible;
	}

	.pricelist-artist-image,
	.pricelist-no-image {
		width: 60px;
		height: 60px;
		max-width: 60px;
		max-height: 60px;
	}

	.pricelist-table {
		font-size: 11px;
		table-layout: fixed;
		width: 100%;
	}

	.pricelist-table th,
	.pricelist-table td {
		padding: 6px 3px;
		word-break: break-word;
		overflow-wrap: break-word;
	}
	
	/* Процентные ширины для маленьких экранов */
	.pricelist-th-photo {
		width: 15%;
	}
	
	.pricelist-th-name {
		width: 50%;
	}
	
	.pricelist-th-genre {
		width: 15%;
	}
	
	.pricelist-th-price {
		width: 20%;
		font-size: 11px;
	}
	
	/* Показываем перенос строки в цене */
	.price-text br {
		display: block;
	}
	
	.pricelist-table td:last-child strong {
		line-height: 1.3;
		white-space: normal;
	}

	.pricelist-filter-option span {
		padding: 5px 8px;
		font-size: 11px;
	}
	
	.pricelist-artist-link strong {
		font-size: 14px;
	}
}

/* Чекбоксы для выбора артистов */
.pricelist-th-checkbox {
	width: 150px;
	text-align: center;
}

.pricelist-td-checkbox {
	text-align: center;
	width: 150px;
}

.pricelist-checkbox-label {
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	gap: 6px;
	padding: 4px 8px;
	border-radius: 4px;
	transition: background-color 0.2s;
}

.pricelist-checkbox-label:hover {
	background-color: #f5f5f5;
}

.pricelist-artist-checkbox {
	margin: 0;
	cursor: pointer;
}

.pricelist-checkbox-text {
	font-size: 12px;
	color: #666;
	user-select: none;
}

.pricelist-select-all {
	cursor: pointer;
	width: 18px;
	height: 18px;
}

/* Кнопки действий */
.pricelist-actions {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
	padding: 10px;
	background: #f9f9f9;
	border-radius: 4px;
}

.pricelist-th-actions {
	width: 150px;
	text-align: center;
}

.pricelist-td-actions {
	text-align: center;
	width: 150px;
}

.pricelist-btn-price {
	padding: 6px 12px;
	font-size: 12px;
}

/* Pop-up форма для заявки */
.pricelist-request-dialog .splash-inner {
	max-width: 600px;
	width: 90%;
	padding: 0;
}

/* Hide specific fields when form is opened from PriceList */
.pricelist-form-mode .budget-range-field {
	display: none !important;
}

.pricelist-form-mode .field .categories {
	display: none !important;
}

.pricelist-form-mode .field:has(.categories) {
	display: none !important;
}

.pricelist-form-mode .tags-field {
	display: none !important;
}

.pricelist-request-popup {
	padding: 30px;
	background: #fff;
	border-radius: 8px;
	position: relative;
}

.pricelist-request-close {
	position: absolute;
	top: 15px;
	right: 15px;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	color: #999;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
	z-index: 10;
}

.pricelist-request-close:hover {
	color: #333;
}

.pricelist-request-close:focus {
	outline: none;
	color: #333;
}

.pricelist-request-popup h3 {
	margin: 0 0 10px 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.pricelist-request-note {
	margin: 0 0 20px 0;
	font-size: 14px;
	color: #666;
}

.pricelist-form-field-wrapper {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
}

.pricelist-form-field {
	margin-bottom: 15px;
	flex: 1;
}

.pricelist-form-field:last-child {
	margin-bottom: 0;
}

.pricelist-form-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 500;
	color: #333;
}

.pricelist-form-label i {
	color: #dc3545;
}

.pricelist-form-field input[type="text"],
.pricelist-form-field input[type="email"],
.pricelist-form-field select,
.pricelist-form-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	font-family: inherit;
	box-sizing: border-box;
	transition: border-color 0.2s;
}

.pricelist-form-field input[type="text"]:focus,
.pricelist-form-field input[type="email"]:focus,
.pricelist-form-field select:focus,
.pricelist-form-field textarea:focus {
	outline: none;
	border-color: #0085f2;
}

.pricelist-form-field textarea {
	resize: vertical;
	min-height: 80px;
}

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

.pricelist-form-actions .pricelist-btn {
	flex: 1;
}

/* Адаптивность для pop-up */
@media (max-width: 768px) {
	.pricelist-form-field-wrapper {
		flex-direction: column;
		gap: 0;
	}
	
	.pricelist-request-popup {
		padding: 20px;
	}
	
	.pricelist-form-actions {
		flex-direction: column;
	}
	
	.pricelist-form-actions .pricelist-btn {
		width: 100%;
	}
}

/* Адаптивность для чекбоксов */
@media (max-width: 768px) {
	.pricelist-th-checkbox,
	.pricelist-td-checkbox {
		width: 80px;
	}
	
	.pricelist-checkbox-text {
		display: none;
	}
	
	.pricelist-th-actions,
	.pricelist-td-actions {
		width: 100px;
	}
	
	.pricelist-btn-price {
		padding: 4px 8px;
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.pricelist-th-checkbox,
	.pricelist-td-checkbox {
		width: 40px;
	}
	
	.pricelist-th-actions,
	.pricelist-td-actions {
		width: 60px;
	}
	
	.pricelist-actions {
		flex-direction: column;
	}
	
	.pricelist-actions .pricelist-btn {
		width: 100%;
	}
}

/* ============================================ */
/* React Performance Optimizations             */
/* Added: 2025-12-04                           */
/* ============================================ */

/* Enable CSS containment for better rendering performance */
.pricelist-artist-row {
	contain: layout style paint;
	content-visibility: auto;
}

/* Optimize image rendering with GPU acceleration */
.pricelist-artist-image {
	contain: layout style paint;
	will-change: auto;
	transform: translateZ(0);
	backface-visibility: hidden;
}

/* Smooth image loading transition */
.pricelist-artist-image.loading {
	opacity: 0.6;
	filter: blur(4px);
	transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Loading state animations */
.pricelist-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	text-align: center;
	animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.pricelist-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid rgba(255, 99, 71, 0.2);
	border-top-color: #ff6347;
	border-radius: 50%;
	animation: pricelist-spin 0.8s linear infinite;
	margin-bottom: 15px;
}

@keyframes pricelist-spin {
	to { transform: rotate(360deg); }
}

.pricelist-loading p {
	font-size: 16px;
	color: #666;
	margin: 0;
}

/* Error state styling */
.pricelist-error {
	padding: 30px 20px;
	text-align: center;
	background: #fff3f3;
	border: 1px solid #ffcccc;
	border-radius: 8px;
	margin: 20px 0;
	animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.pricelist-error p {
	color: #cc0000;
	font-size: 16px;
	margin: 0 0 15px 0;
}

/* Disabled state during loading */
.pricelist-filter-option input:disabled + span {
	opacity: 0.5;
	cursor: not-allowed;
	user-select: none;
}

button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	pointer-events: none;
}

/* Optimize table rendering */
.pricelist-table {
	contain: layout;
}

.pricelist-table tbody {
	contain: layout style;
}

/* Smooth transitions for interactive elements */
.pricelist-filters input,
.pricelist-pagination button {
	transition: all 0.2s ease;
}

/* Optimize scrolling performance */
.pricelist-table-wrapper {
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #ccc #f5f5f5;
}

.pricelist-table-wrapper::-webkit-scrollbar {
	height: 8px;
}

.pricelist-table-wrapper::-webkit-scrollbar-track {
	background: #f5f5f5;
}

.pricelist-table-wrapper::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 4px;
}

.pricelist-table-wrapper::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* Reduce layout shift */
.pricelist-table-area {
	position: relative;
	min-height: 400px;
}

/* Improve paint performance with GPU acceleration */
.pricelist-artist-row:hover {
	transform: translateZ(0);
}

/* Optimize font rendering */
.pricelist-container,
.pricelist-react-container {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* Performance hints for pagination */
.pricelist-pagination button {
	backface-visibility: hidden;
	transform: translateZ(0);
}

/* React root element optimization */
#pricelist-root {
	contain: layout style;
	isolation: isolate;
}
