/* ZapretCord Extended Styles - МАКСИМАЛЬНАЯ КРАСОТА */

/* ==================== ANIMATIONS ==================== */
@keyframes gradientShift {
	0%, 100% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
}

@keyframes slideUp {
	from { opacity: 0; transform: translateY(30px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
	from { opacity: 0; transform: translateY(-30px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
	from { opacity: 0; transform: translateX(100%); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
	from { opacity: 0; transform: translateX(-100%); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes pulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

@keyframes rotate {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@keyframes shimmer {
	0% { background-position: -1000px 0; }
	100% { background-position: 1000px 0; }
}

@keyframes wave {
	0%, 100% { transform: translateY(0); }
	25% { transform: translateY(-5px); }
	75% { transform: translateY(5px); }
}

@keyframes glow {
	0%, 100% { box-shadow: 0 0 5px var(--brand), 0 0 10px var(--brand); }
	50% { box-shadow: 0 0 20px var(--brand), 0 0 30px var(--brand), 0 0 40px var(--brand); }
}

@keyframes typing {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 1; }
}

/* ==================== ENHANCED AUTH SCREEN ==================== */
.auth-screen {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
	background-size: 400% 400%;
	animation: gradientShift 15s ease infinite;
	position: relative;
	overflow: hidden;
}

.auth-screen::before {
	content: '';
	position: absolute;
	width: 200%;
	height: 200%;
	background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
	background-size: 50px 50px;
	animation: wave 20s linear infinite;
	opacity: 0.3;
}

.auth-container {
	position: relative;
	z-index: 1;
	backdrop-filter: blur(20px);
	background: rgba(31, 41, 55, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-logo svg {
	filter: drop-shadow(0 0 20px rgba(88, 101, 242, 0.5));
	animation: pulse 3s ease-in-out infinite;
}

.auth-form input {
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
}

.auth-form input:focus {
	transform: translateY(-2px);
	box-shadow: 0 8px 16px rgba(88, 101, 242, 0.3);
}

.auth-form input::placeholder {
	transition: all 0.3s ease;
}

.auth-form input:focus::placeholder {
	transform: translateX(10px);
	opacity: 0.5;
}

.btn-primary {
	position: relative;
	overflow: hidden;
}

.btn-primary::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
	transition: left 0.5s ease;
}

.btn-primary:hover::before {
	left: 100%;
}

.btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}

.btn-primary:active {
	transform: translateY(0);
}

/* ==================== LOADING SPINNER ==================== */
.loading-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rotate 0.8s linear infinite;
}

/* ==================== ENHANCED SERVER LIST ==================== */
.server-icon {
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
}

.server-icon::before {
	content: '';
	position: absolute;
	left: -8px;
	top: 50%;
	transform: translateY(-50%);
	width: 4px;
	height: 0;
	background: #fff;
	border-radius: 0 4px 4px 0;
	transition: height 0.3s ease;
}

.server-icon:hover::before {
	height: 20px;
}

.server-icon.active::before {
	height: 40px;
}

.server-icon:hover {
	border-radius: 16px;
	transform: translateX(4px);
}

.server-icon.active {
	border-radius: 16px;
	animation: pulse 2s ease-in-out infinite;
}

/* Unread indicator */
.server-icon .unread-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	background: var(--danger);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	border: 2px solid var(--bg-tertiary);
	animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== ENHANCED CHANNELS ==================== */
.channel-item {
	position: relative;
	transition: all 0.2s ease;
}

.channel-item::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background: var(--brand);
	transform: scaleY(0);
	transition: transform 0.3s ease;
}

.channel-item.active::before {
	transform: scaleY(1);
}

.channel-item:hover {
	transform: translateX(4px);
}

.channel-item .channel-icon-wrapper {
	position: relative;
	display: inline-flex;
}

.channel-item.has-unread::after {
	content: '';
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 8px;
	height: 8px;
	background: var(--danger);
	border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}

/* ==================== MESSAGES ENHANCEMENT ==================== */
.message {
	transition: all 0.2s ease;
	position: relative;
}

.message:hover {
	background: var(--bg-secondary);
	transform: translateX(4px);
}

.message:hover .message-actions {
	opacity: 1;
	transform: translateX(0);
}

.message-actions {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	gap: 4px;
	opacity: 0;
	transform: translateX(10px);
	transition: all 0.3s ease;
}

.message-actions button {
	width: 32px;
	height: 32px;
	padding: 0;
	border-radius: 4px;
	background: var(--bg-tertiary);
	border: none;
	color: var(--text-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.message-actions button:hover {
	background: var(--bg-primary);
	color: var(--text-primary);
	transform: scale(1.1);
}

/* Message typing animation */
.message.typing .message-text {
	display: flex;
	gap: 4px;
	align-items: center;
}

.message.typing .message-text::after {
	content: '...';
	letter-spacing: 2px;
	animation: typing 1.5s ease-in-out infinite;
}

/* ==================== ENHANCED MODALS ==================== */
.modal {
	animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
	from {
		opacity: 0;
		transform: translate(-50%, -48%) scale(0.9);
	}
	to {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
}

.modal-header {
	background: linear-gradient(135deg, var(--brand) 0%, #4752c4 100%);
	color: #fff;
}

.modal-body {
	max-height: 70vh;
	overflow-y: auto;
}

/* ==================== CALL SCREEN ==================== */
.call-screen {
	position: fixed;
	inset: 0;
	background: linear-gradient(135deg, #1a1d29 0%, #2d1b3d 100%);
	z-index: 1000;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	animation: fadeIn 0.3s ease;
}

.call-screen.active {
	display: flex;
}

.call-avatar {
	width: 200px;
	height: 200px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 80px;
	font-weight: 700;
	margin-bottom: 32px;
	animation: pulse 2s ease-in-out infinite;
	box-shadow: 0 0 60px rgba(88, 101, 242, 0.5);
}

.call-info {
	text-align: center;
	margin-bottom: 48px;
}

.call-name {
	font-size: 32px;
	font-weight: 700;
	margin-bottom: 8px;
}

.call-status {
	font-size: 18px;
	color: var(--text-secondary);
}

.call-timer {
	font-size: 24px;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}

.call-controls {
	display: flex;
	gap: 24px;
}

.call-btn {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	position: relative;
}

.call-btn::before {
	content: '';
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	background: inherit;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.call-btn:hover::before {
	opacity: 0.3;
	animation: pulse 1.5s ease-in-out infinite;
}

.call-btn.mute {
	background: var(--bg-secondary);
	color: var(--text-primary);
}

.call-btn.mute.active {
	background: var(--danger);
	color: #fff;
}

.call-btn.hangup {
	background: var(--danger);
	color: #fff;
	animation: pulse 2s ease-in-out infinite;
}

.call-btn.hangup:hover {
	background: #dc2626;
	transform: scale(1.1);
}

.call-btn.deafen {
	background: var(--bg-secondary);
	color: var(--text-primary);
}

.call-btn.deafen.active {
	background: var(--warning);
	color: #fff;
}

/* Incoming call */
.incoming-call {
	position: fixed;
	top: 24px;
	right: 24px;
	background: var(--bg-secondary);
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	z-index: 999;
	min-width: 300px;
	animation: slideInRight 0.4s ease;
}

.incoming-call-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.incoming-call-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	animation: pulse 1.5s ease-in-out infinite;
}

.incoming-call-actions {
	display: flex;
	gap: 8px;
}

.incoming-call-actions button {
	flex: 1;
	padding: 12px;
	border-radius: 8px;
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.incoming-call-actions button.accept {
	background: var(--success);
	color: #fff;
}

.incoming-call-actions button.decline {
	background: var(--danger);
	color: #fff;
}

/* ==================== ENHANCED USER PANEL ==================== */
.user-panel {
	position: relative;
}

.user-panel::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--brand), transparent);
}

.user-avatar {
	position: relative;
	transition: all 0.3s ease;
}

.user-avatar::after {
	content: '';
	position: absolute;
	bottom: -2px;
	right: -2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--online);
	border: 2px solid var(--bg-tertiary);
	animation: pulse 2s ease-in-out infinite;
}

.user-avatar:hover {
	transform: scale(1.1);
	cursor: pointer;
}

/* ==================== ENHANCED EMOJI PICKER ==================== */
.emoji-picker {
	backdrop-filter: blur(20px);
	background: rgba(31, 41, 55, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.emoji-grid span {
	transition: all 0.2s ease;
}

.emoji-grid span:hover {
	background: var(--bg-primary);
	transform: scale(1.3);
	z-index: 10;
}

/* ==================== MEMBERS LIST ENHANCEMENT ==================== */
.member-item {
	position: relative;
}

.member-item::before {
	content: '';
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 0;
	background: var(--brand);
	border-radius: 0 3px 3px 0;
	transition: height 0.3s ease;
}

.member-item:hover::before {
	height: 80%;
}

.member-avatar {
	transition: all 0.3s ease;
}

.member-item:hover .member-avatar {
	transform: scale(1.1);
}

/* ==================== TOOLTIP ==================== */
.tooltip {
	position: absolute;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	z-index: 10000;
	pointer-events: none;
	white-space: nowrap;
	animation: fadeIn 0.2s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip::after {
	content: '';
	position: absolute;
	bottom: -4px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 4px solid var(--bg-tertiary);
}

/* ==================== MOBILE OPTIMIZATIONS ==================== */
@media (max-width: 768px) {
	.app {
		grid-template-columns: 1fr;
	}
	
	.server-list {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		z-index: 100;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
	}
	
	.server-list.mobile-open {
		transform: translateX(0);
	}
	
	.channels-sidebar {
		position: fixed;
		left: 72px;
		top: 0;
		bottom: 0;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		z-index: 99;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
	}
	
	.channels-sidebar.mobile-open {
		transform: translateX(0);
	}
	
	.members-sidebar {
		position: fixed;
		right: 0;
		top: 0;
		bottom: 0;
		transform: translateX(100%);
		transition: transform 0.3s ease;
		z-index: 98;
		box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
	}
	
	.members-sidebar.mobile-open {
		transform: translateX(0);
	}
	
	/* Mobile menu button */
	.mobile-menu-btn {
		position: fixed;
		bottom: 24px;
		right: 24px;
		width: 56px;
		height: 56px;
		border-radius: 50%;
		background: var(--brand);
		color: #fff;
		border: none;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 4px 24px rgba(88, 101, 242, 0.4);
		cursor: pointer;
		z-index: 200;
		animation: pulse 2s ease-in-out infinite;
	}
	
	.mobile-menu-btn:active {
		transform: scale(0.95);
	}
	
	/* Call screen mobile */
	.call-avatar {
		width: 150px;
		height: 150px;
		font-size: 60px;
	}
	
	.call-name {
		font-size: 24px;
	}
	
	.call-status {
		font-size: 16px;
	}
	
	.call-btn {
		width: 56px;
		height: 56px;
	}
	
	.call-controls {
		gap: 16px;
	}
	
	/* Messages mobile */
	.message {
		padding: 12px 8px;
	}
	
	.message-avatar {
		width: 32px;
		height: 32px;
		font-size: 14px;
	}
	
	.message-author {
		font-size: 14px;
	}
	
	.message-text {
		font-size: 14px;
	}
	
	/* Input mobile */
	.message-input-wrapper {
		padding: 8px;
	}
	
	#message-input {
		font-size: 16px; /* Prevents zoom on iOS */
	}
	
	/* Auth mobile */
	.auth-container {
		padding: 24px;
		width: 95vw;
	}
	
	.auth-logo svg {
		width: 60px;
		height: 60px;
	}
	
	/* Modal mobile */
	.modal {
		width: 95vw;
		max-height: 90vh;
	}
	
	.modal-body {
		max-height: 60vh;
	}
	
	/* Incoming call mobile */
	.incoming-call {
		top: 16px;
		right: 16px;
		left: 16px;
		min-width: auto;
	}
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-width: 768px) and (orientation: landscape) {
	.call-avatar {
		width: 100px;
		height: 100px;
		font-size: 40px;
		margin-bottom: 16px;
	}
	
	.call-info {
		margin-bottom: 24px;
	}
	
	.call-name {
		font-size: 20px;
	}
	
	.call-btn {
		width: 48px;
		height: 48px;
	}
}

/* ==================== TABLET ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
	.app {
		grid-template-columns: 72px 240px 1fr;
	}
	
	.channels-sidebar {
		width: 240px;
	}
	
	.members-sidebar {
		width: 200px;
	}
}

/* ==================== LOADING SCREEN ==================== */
.loading-screen {
	position: fixed;
	inset: 0;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	animation: fadeIn 0.3s ease;
}

.loading-logo {
	width: 120px;
	height: 120px;
	margin-bottom: 32px;
	animation: pulse 2s ease-in-out infinite;
}

.loading-text {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 16px;
}

.loading-bar {
	width: 200px;
	height: 4px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 2px;
	overflow: hidden;
}

.loading-bar-fill {
	height: 100%;
	background: #fff;
	animation: shimmer 1.5s ease-in-out infinite;
}

/* ==================== SCROLLBAR CUSTOMIZATION ==================== */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-corner {
	background: transparent;
}

/* ==================== SELECTION ==================== */
::selection {
	background: var(--brand);
	color: #fff;
}

::-moz-selection {
	background: var(--brand);
	color: #fff;
}

/* ==================== ACCESSIBILITY ==================== */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

button:focus-visible {
	outline-offset: 4px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* High contrast mode */
@media (prefers-contrast: high) {
	:root {
		--bg-primary: #000;
		--bg-secondary: #111;
		--bg-tertiary: #000;
		--text-primary: #fff;
		--border: #fff;
	}
}

