/**
 * Фронтенд стили
 */

/* Основной контейнер */
.smi-invoice-builder {
	display: grid;
	grid-template-columns: 1fr 400px;
	gap: 30px;
	margin: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue",
		sans-serif;
}

@media (max-width: 1024px) {
	.smi-invoice-builder {
		grid-template-columns: 1fr;
	}
}

/* Сетка товаров */
.smi-products-grid h2 {
	font-size: 24px;
	margin-bottom: 20px;
	color: #333;
}

/* Фильтр по категориям */
.smi-category-filter {
	margin-bottom: 25px;
	padding: 15px;
	background: #f9f9f9;
	border-radius: 8px;
	border: 1px solid #e0e0e0;
	display: flex;
	align-items: center;
	gap: 15px;
}

.smi-category-filter label {
	font-size: 14px;
	font-weight: 600;
	color: #333;
	white-space: nowrap;
}

.smi-category-dropdown {
	flex: 1;
	padding: 8px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 5px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.3s ease;
}

.smi-category-dropdown:focus {
	outline: none;
	border-color: #f2af36;
}

@media (max-width: 768px) {
	.smi-category-filter {
		flex-direction: column;
		align-items: stretch;
	}
}

.smi-products-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
}

@media (max-width: 768px) {
	.smi-products-list {
		grid-template-columns: 1fr;
	}
}

/* Карточка товара */
.smi-product-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 15px;
	transition: all 0.3s ease;
	display: flex;
	flex-direction: column;
}

.smi-product-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.smi-product-card.smi-in-invoice {
	border-color: #4caf50;
	background: #f1f8f4;
}

.smi-product-image {
	width: 100%;
	height: 200px;
	overflow: hidden;
	border-radius: 6px;
	margin-bottom: 15px;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.smi-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.smi-product-image.smi-no-image {
	background: #f5f5f5;
}

.smi-product-image.smi-no-image .dashicons {
	font-size: 60px;
	color: #ccc;
	width: 60px;
	height: 60px;
}

.smi-product-info {
	flex: 1;
	margin-bottom: 15px;
}

.smi-product-name {
	font-size: 18px;
	font-weight: 600;
	color: #333;
	margin: 0 0 10px 0;
}

.smi-product-price {
	font-size: 20px;
	font-weight: 700;
	color: #f2af36;
	margin: 0;
}

.smi-currency {
	font-size: 16px;
	color: #666;
}

/* Действия с товаром */
.smi-product-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.smi-product-quantity-wrapper {
	display: flex;
	align-items: center;
	gap: 10px;
}

.smi-product-quantity-wrapper label {
	font-size: 13px;
	color: #666;
	font-weight: 500;
}

.smi-product-quantity {
	width: 70px;
	padding: 6px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-align: center;
	font-size: 14px;
}

.smi-product-quantity:focus {
	outline: none;
	border-color: #f2af36;
} /* Кнопки */
.smi-btn {
	display: inline-block;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: all 0.3s ease;
	text-decoration: none;
}

.smi-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.smi-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.smi-add-to-invoice {
	width: 100%;
	background: #f2af36 !important;
	color: #fff !important;
}

.smi-add-to-invoice:hover {
	background: #1976d2 !important;
}

.smi-product-card.smi-in-invoice .smi-add-to-invoice {
	background: #4caf50 !important;
	cursor: default;
	pointer-events: none;
}

.smi-product-card.smi-in-invoice .smi-add-to-invoice::after {
	content: " ✓";
}

.smi-btn-primary {
	width: 100%;
	background: #4caf50;
	color: #fff;
	font-size: 16px;
	padding: 12px 20px;
}

.smi-btn-primary:hover {
	background: #45a049;
}

.smi-btn-secondary {
	background: #f5f5f5;
	color: #666;
	border: 1px solid #ddd;
}

.smi-btn-secondary:hover {
	background: #e0e0e0;
}

.smi-btn-icon {
	background: #fff;
	border: 1px solid #ddd;
	padding: 6px;
	cursor: pointer;
	color: #999;
	transition: all 0.2s ease;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
}

.smi-btn-icon:hover {
	background: #fee;
	border-color: #fcc;
	color: #f44336;
	transform: scale(1.05);
}

.smi-btn-icon:active {
	transform: scale(0.95);
}

.smi-btn-icon .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

/* Панель счета */
.smi-invoice-panel {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px;
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
}

@media (max-width: 1024px) {
	.smi-invoice-panel {
		position: static;
		max-height: none;
	}
}

.smi-invoice-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 2px solid #f0f0f0;
}

.smi-invoice-header h2 {
	font-size: 20px;
	margin: 0;
	color: #333;
}

/* Поля проекта */
.smi-project-fields {
	margin-bottom: 20px;
	padding: 15px;
	background: #f9f9f9;
	border-radius: 6px;
	border: 1px solid #e0e0e0;
}

.smi-project-fields h3 {
	font-size: 16px;
	margin: 0 0 15px 0;
	color: #333;
	font-weight: 600;
}

.smi-field-group {
	margin-bottom: 12px;
}

.smi-field-group:last-child {
	margin-bottom: 0;
}

.smi-field-group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #555;
	margin-bottom: 6px;
}

.smi-project-input {
	width: 100%;
	padding: 8px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	transition: border-color 0.3s ease;
}

.smi-project-input:focus {
	outline: none;
	border-color: #f2af36;
	background: #fff;
}

.smi-invoice-items {
	flex: 1;
	overflow-y: auto;
	margin-bottom: 20px;
	min-height: 200px;
}

.smi-empty-message {
	text-align: center;
	color: #999;
	padding: 40px 20px;
	font-size: 14px;
}

.smi-invoice-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.smi-invoice-item {
	display: flex;
	flex-direction: column;
	padding: 15px;
	background: #f9f9f9;
	border-radius: 6px;
	transition: background 0.3s ease;
	gap: 12px;
	border: 1px solid #e8e8e8;
}

.smi-invoice-item:hover {
	background: #f5f5f5;
	border-color: #d0d0d0;
}

.smi-invoice-item-info {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.smi-invoice-item-name {
	font-weight: 600;
	color: #333;
	font-size: 15px;
	line-height: 1.4;
}

.smi-invoice-item-details {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #666;
	font-size: 13px;
	line-height: 1.5;
}

.smi-invoice-item-details > div {
	display: flex;
	align-items: center;
	gap: 5px;
}

.smi-invoice-item-details strong {
	color: #f2af36;
	font-size: 14px;
}

.smi-invoice-item-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding-top: 8px;
	border-top: 1px solid #e0e0e0;
}

/* Управление количеством */
.smi-quantity-control {
	display: flex;
	align-items: center;
	gap: 4px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 4px;
}

.smi-qty-btn {
	width: 28px;
	height: 28px;
	border: none;
	background: #f5f5f5;
	color: #666;
	cursor: pointer;
	font-size: 18px;
	font-weight: bold;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: all 0.2s ease;
	border-radius: 4px;
}

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

.smi-qty-btn:active {
	transform: scale(0.95);
}

.smi-invoice-quantity {
	width: 45px;
	border: none;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	padding: 4px 2px;
	background: transparent;
}

.smi-invoice-quantity:focus {
	outline: none;
	background: #f9f9f9;
	border-radius: 3px;
}
.smi-invoice-footer {
	border-top: 2px solid #f0f0f0;
	padding-top: 15px;
}

.smi-invoice-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	font-size: 18px;
	font-weight: 700;
}

.smi-total-label {
	color: #333;
}

.smi-total-amount {
	color: #4caf50;
}

/* Уведомления */
.smi-notification {
	position: fixed;
	top: 20px;
	right: 20px;
	padding: 15px 20px;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 10000;
	min-width: 250px;
	animation: slideIn 0.3s ease;
}

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

.smi-notification.smi-success {
	background: #4caf50;
	color: #fff;
}

.smi-notification.smi-error {
	background: #f44336;
	color: #fff;
}

.smi-notification-text {
	font-size: 14px;
	font-weight: 500;
}

/* Загрузчик */
.smi-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

.smi-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #f2af36;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Сообщение "нет товаров" */
.smi-no-products {
	text-align: center;
	padding: 40px;
	color: #999;
	font-size: 16px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
	.smi-invoice-item {
		padding: 12px;
	}

	.smi-invoice-item-name {
		font-size: 14px;
	}

	.smi-invoice-item-details {
		font-size: 12px;
	}

	.smi-invoice-item-controls {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.smi-quantity-control {
		justify-content: center;
	}

	.smi-btn-icon {
		width: 100%;
		height: 38px;
	}
}
