/**
 * Beer Festival Frontend CSS
 * Version: 1.3.0
 */

/* Import Font Awesome для иконок */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */

.bf-participants-wrapper {
	margin: 30px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Заголовок */
.bf-participants-header {
	text-align: center;
	margin-bottom: 40px;
}

.bf-participants-title {
	font-size: clamp(24px, 5vw, 32px);
	margin: 0 0 10px 0;
	color: #1d2327;
	font-weight: 700;
}

.bf-participants-count {
	font-size: 16px;
	color: #646970;
}

.bf-participants-count strong {
	color: #2271b1;
	font-weight: 700;
}

/* ============================================
   СЕТКА УЧАСТНИКОВ
   ============================================ */

.bf-participants-grid {
	display: grid;
	gap: 20px;
	margin-bottom: 30px;
}

/* Колонки */
.bf-grid-auto {
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.bf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.bf-grid-3 { grid-template-columns: repeat(3, 1fr); }
.bf-grid-4 { grid-template-columns: repeat(4, 1fr); }
.bf-grid-5 { grid-template-columns: repeat(5, 1fr); }
.bf-grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ============================================
   КАРТОЧКА УЧАСТНИКА
   ============================================ */

.bf-participant-item {
	position: relative;
	aspect-ratio: 1;
	background: #ffffff;
	border: 2px solid #e1e1e1;
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 0;
	animation: fadeInUp 0.6s ease forwards;
}

.bf-participant-item:hover,
.bf-participant-item:focus {
	transform: translateY(-8px);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
	border-color: #2271b1;
	outline: none;
}

.bf-participant-item:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

.bf-participant-inner {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	position: relative;
}

.bf-participant-logo {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	filter: grayscale(0%);
}

.bf-participant-item:hover .bf-participant-logo {
	transform: scale(1.08);
	filter: grayscale(0%) brightness(1.1);
}

/* Fallback без логотипа */
.bf-participant-no-logo {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	padding: 15px;
}

.bf-participant-initials {
	font-size: 48px;
	font-weight: 900;
	margin-bottom: 12px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.bf-participant-name-fallback {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Город */
.bf-participant-city {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.bf-participant-item:hover .bf-participant-city {
	opacity: 1;
}

.bf-city-icon {
	margin-right: 4px;
}

/* Overlay при наведении */
.bf-participant-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(34, 113, 177, 0.95) 0%, rgba(102, 126, 234, 0.95) 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.bf-participant-item:hover .bf-participant-overlay {
	opacity: 1;
}

.bf-view-details {
	color: white;
	font-weight: 700;
	font-size: 16px;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Стиль списка */
.bf-style-list .bf-participants-grid {
	grid-template-columns: 1fr;
	gap: 15px;
}

.bf-style-list .bf-participant-item {
	aspect-ratio: auto;
	padding: 20px;
}

.bf-style-list .bf-participant-inner {
	flex-direction: row;
	justify-content: flex-start;
	gap: 25px;
}

.bf-style-list .bf-participant-logo {
	max-width: 120px;
	max-height: 120px;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО
   ============================================ */

.bf-brewery-modal {
	display: none;
	position: fixed;
	z-index: 999999;
	inset: 0;
	overflow: auto;
	background: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(5px);
	animation: fadeIn 0.3s ease;
}

.bf-brewery-modal.show {
	display: block;
}

.bf-modal-overlay {
	position: fixed;
	inset: 0;
}

.bf-modal-container {
	position: relative;
	background: #ffffff;
	margin: 3% auto;
	border-radius: 16px;
	width: 90%;
	max-width: 1200px;
	max-height: 90vh;
	overflow: hidden;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
	animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: scale(0.9) translateY(-30px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.bf-modal-close-btn {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 44px;
	height: 44px;
	background: rgba(255, 255, 255, 0.95);
	border: none;
	border-radius: 50%;
	font-size: 28px;
	line-height: 1;
	color: #1d2327;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 10;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bf-modal-close-btn:hover {
	background: #d63638;
	color: white;
	transform: rotate(90deg) scale(1.1);
}

.bf-modal-content-wrapper {
	max-height: 90vh;
	overflow-y: auto;
	padding: 50px 40px;
}

.bf-modal-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 300px;
	color: #646970;
}

.bf-spinner-large {
	width: 60px;
	height: 60px;
	border: 5px solid #f3f3f3;
	border-top: 5px solid #2271b1;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
	margin-bottom: 20px;
}

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

/* Контент модалки */
.bf-brewery-modal-content {
	animation: fadeInContent 0.5s ease 0.2s both;
}

@keyframes fadeInContent {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 1024px) {
	.bf-modal-container {
		width: 95%;
	}
	
	.bf-modal-content-wrapper {
		padding: 40px 30px;
	}
}

@media (max-width: 768px) {
	.bf-participants-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
		gap: 15px;
	}
	
	.bf-participant-inner {
		padding: 15px;
	}
	
	.bf-participant-initials {
		font-size: 36px;
	}
	
	.bf-modal-container {
		width: 100%;
		height: 100%;
		max-height: 100vh;
		margin: 0;
		border-radius: 0;
	}
	
	.bf-modal-content-wrapper {
		padding: 60px 20px 30px;
	}
	
	.bf-modal-close-btn {
		top: 15px;
		right: 15px;
		width: 40px;
		height: 40px;
		font-size: 24px;
	}
}

@media (max-width: 480px) {
	.bf-participants-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 12px;
	}
	
	.bf-participant-inner {
		padding: 10px;
	}
	
	.bf-participant-initials {
		font-size: 28px;
	}
	
	.bf-participant-name-fallback {
		font-size: 12px;
	}
	
	.bf-participants-title {
		font-size: 22px;
	}
	
	.bf-view-details {
		font-size: 14px;
	}
}

/* ============================================
   АНИМАЦИИ ПОЯВЛЕНИЯ
   ============================================ */

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.bf-participant-item:nth-child(1) { animation-delay: 0.05s; }
.bf-participant-item:nth-child(2) { animation-delay: 0.1s; }
.bf-participant-item:nth-child(3) { animation-delay: 0.15s; }
.bf-participant-item:nth-child(4) { animation-delay: 0.2s; }
.bf-participant-item:nth-child(5) { animation-delay: 0.25s; }
.bf-participant-item:nth-child(6) { animation-delay: 0.3s; }
.bf-participant-item:nth-child(7) { animation-delay: 0.35s; }
.bf-participant-item:nth-child(8) { animation-delay: 0.4s; }
.bf-participant-item:nth-child(n+9) { animation-delay: 0.45s; }

/* ============================================
   ACCESSIBILITY
   ============================================ */

.bf-participant-item:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 3px;
}

.bf-modal-close-btn:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

/* Отключение анимаций для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
	
	.bf-participant-item {
		opacity: 1;
		animation: none;
	}
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
	.bf-brewery-modal,
	.bf-participant-overlay,
	.bf-modal-close-btn {
		display: none !important;
	}
	
	.bf-participant-item {
		page-break-inside: avoid;
		border: 1px solid #000;
	}
}