/* ZapretCord Styles - Modern Discord-like UI */

:root {
	--bg-primary: #36393f;
	--bg-secondary: #2f3136;
	--bg-tertiary: #202225;
	--bg-overlay: rgba(0, 0, 0, 0.85);
	--text-primary: #ffffff;
	--text-secondary: #b9bbbe;
	--text-muted: #72767d;
	--text-link: #00b0f4;
	--brand: #5865f2;
	--brand-hover: #4752c4;
	--danger: #ed4245;
	--danger-hover: #c03537;
	--success: #3ba55d;
	--warning: #faa81a;
	--online: #43b581;
	--idle: #faa61a;
	--dnd: #f04747;
	--offline: #747f8d;
	--border: rgba(255, 255, 255, 0.06);
	--shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
	--radius: 8px;
	--radius-sm: 4px;
	--transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	overflow: hidden;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	background: var(--bg-primary);
	color: var(--text-primary);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ==================== UTILITIES ==================== */
.hidden { display: none !important; }

/* ==================== AUTH SCREEN ==================== */
.auth-screen {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	animation: gradientShift 15s ease infinite;
	background-size: 400% 400%;
}

@keyframes gradientShift {
	0%, 100% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
}

.auth-container {
	background: var(--bg-secondary);
	border-radius: var(--radius);
	padding: 48px;
	width: 480px;
	max-width: 90vw;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	animation: slideUp 0.5s ease;
}

@keyframes slideUp {
	from { opacity: 0; transform: translateY(20px); }
	to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
	display: flex;
	justify-content: center;
	margin-bottom: 24px;
	animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

.auth-container h1 {
	font-size: 28px;
	font-weight: 700;
	text-align: center;
	margin-bottom: 8px;
}

.auth-subtitle {
	text-align: center;
	color: var(--text-secondary);
	margin-bottom: 32px;
}

.auth-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
}

.auth-tab {
	flex: 1;
	padding: 12px;
	background: transparent;
	border: none;
	color: var(--text-secondary);
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}

.auth-tab.active {
	background: var(--brand);
	color: var(--text-primary);
}

.auth-tab:hover:not(.active) {
	background: var(--bg-primary);
}

.auth-form {
	display: none;
	flex-direction: column;
	gap: 16px;
}

.auth-form.active {
	display: flex;
}

input[type="text"],
input[type="password"],
textarea,
select {
	width: 100%;
	padding: 12px 16px;
	background: var(--bg-tertiary);
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	color: var(--text-primary);
	font-size: 16px;
	font-family: inherit;
	outline: none;
	transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
	border-color: var(--brand);
}

.btn-primary,
.btn-secondary,
.btn-danger {
	padding: 12px 24px;
	border: none;
	border-radius: var(--radius-sm);
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition);
	font-family: inherit;
}

.btn-primary {
	background: var(--brand);
	color: var(--text-primary);
}

.btn-primary:hover {
	background: var(--brand-hover);
}

.btn-secondary {
	background: var(--bg-primary);
	color: var(--text-secondary);
}

.btn-secondary:hover {
	background: var(--bg-tertiary);
	color: var(--text-primary);
}

.btn-danger {
	background: var(--danger);
	color: var(--text-primary);
}

.btn-danger:hover {
	background: var(--danger-hover);
}

/* ==================== APP LAYOUT ==================== */
.app {
	display: grid;
	grid-template-columns: 72px minmax(240px, 280px) 1fr;
	height: 100vh;
	overflow: hidden;
}

/* ==================== SERVER LIST ==================== */
.server-list {
	background: var(--bg-tertiary);
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 12px 0;
	gap: 8px;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: none;
}

.server-list::-webkit-scrollbar {
	display: none;
}

.server-icon {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--bg-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	position: relative;
	transition: var(--transition);
	color: var(--text-secondary);
}

.server-icon:hover {
	border-radius: 16px;
	background: var(--brand);
	color: var(--text-primary);
}

.server-icon.active {
	border-radius: 16px;
	background: var(--brand);
	color: var(--text-primary);
}

.server-icon.home-icon {
	background: var(--bg-secondary);
}

.server-icon.add-server {
	background: transparent;
	border: 2px dashed var(--border);
	color: var(--success);
}

.server-icon.add-server:hover {
	border-color: var(--success);
	background: var(--success);
	color: var(--text-primary);
}

.server-divider {
	width: 32px;
	height: 2px;
	background: var(--border);
	border-radius: 1px;
	margin: 4px 0;
}

/* ==================== CHANNELS SIDEBAR ==================== */
.channels-sidebar {
	background: var(--bg-secondary);
	display: flex;
	flex-direction: column;
}

.server-header {
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	border-bottom: 1px solid var(--border);
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition);
}

.server-header:hover {
	background: var(--bg-primary);
}

.dropdown-btn {
	background: transparent;
	border: none;
	color: var(--text-secondary);
	cursor: pointer;
	font-size: 12px;
}

.channels-container {
	flex: 1;
	overflow-y: auto;
	padding: 16px 8px;
}

.channel-category {
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--text-muted);
	letter-spacing: 0.5px;
}

.channel-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	color: var(--text-secondary);
	font-weight: 500;
	transition: var(--transition);
}

.channel-item:hover {
	background: var(--bg-primary);
	color: var(--text-primary);
}

.channel-item.active {
	background: var(--bg-primary);
	color: var(--text-primary);
}

.channel-item svg {
	flex-shrink: 0;
	opacity: 0.6;
}

/* ==================== USER PANEL ==================== */
.user-panel {
	height: 52px;
	background: var(--bg-tertiary);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 8px;
}

.user-info {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.user-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
	background-size: cover;
	background-position: center;
}

.user-details {
	flex: 1;
	min-width: 0;
}

.user-name {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.user-status {
	font-size: 12px;
	color: var(--text-muted);
}

.user-actions {
	display: flex;
	gap: 4px;
}

.icon-btn {
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	background: transparent;
	border: none;
	color: var(--text-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--transition);
}

.icon-btn:hover {
	background: var(--bg-primary);
	color: var(--text-primary);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
	display: flex;
	flex-direction: column;
	background: var(--bg-primary);
}

.content-header {
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	z-index: 1;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.channel-icon {
	color: var(--text-muted);
}

.content-header h2 {
	font-size: 16px;
	font-weight: 700;
}

.header-right {
	display: flex;
	gap: 8px;
}

.content-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
}

.messages-container {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==================== MESSAGES ==================== */
.message {
	display: flex;
	gap: 12px;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
	transition: var(--transition);
	animation: messageIn 0.3s ease;
}

@keyframes messageIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.message:hover {
	background: var(--bg-secondary);
}

.message-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	background-size: cover;
	background-position: center;
}

.message-content {
	flex: 1;
	min-width: 0;
}

.message-header {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 4px;
}

.message-author {
	font-weight: 600;
	font-size: 16px;
}

.message-time {
	font-size: 12px;
	color: var(--text-muted);
}

.message-text {
	color: var(--text-secondary);
	word-wrap: break-word;
}

.message.me .message-text {
	color: var(--text-primary);
}

.message-attachment {
	margin-top: 8px;
	max-width: 400px;
}

.message-attachment img {
	max-width: 100%;
	border-radius: var(--radius-sm);
}

.message-attachment a {
	color: var(--text-link);
	text-decoration: none;
}

.message-attachment a:hover {
	text-decoration: underline;
}

.message-reactions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 8px;
}

.reaction {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 6px;
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	border-radius: 12px;
	font-size: 12px;
	cursor: pointer;
	transition: var(--transition);
}

.reaction:hover {
	background: var(--bg-secondary);
	border-color: var(--brand);
}

.reaction.active {
	background: rgba(88, 101, 242, 0.2);
	border-color: var(--brand);
}

/* ==================== MESSAGE INPUT ==================== */
.message-input-container {
	padding: 16px;
	border-top: 1px solid var(--border);
}

.typing-indicator {
	padding: 4px 12px;
	font-size: 13px;
	color: var(--text-muted);
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.typing-indicator span::after {
	content: '...';
	animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
	0%, 20% { content: '.'; }
	40% { content: '..'; }
	60%, 100% { content: '...'; }
}

.message-input-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--bg-tertiary);
	border-radius: var(--radius);
	padding: 8px 12px;
}

#message-input {
	flex: 1;
	background: transparent;
	border: none;
	padding: 4px 0;
}

/* ==================== MEMBERS SIDEBAR ==================== */
.members-sidebar {
	width: 240px;
	background: var(--bg-secondary);
	border-left: 1px solid var(--border);
	display: flex;
	flex-direction: column;
}

.members-header {
	height: 48px;
	display: flex;
	align-items: center;
	padding: 0 16px;
	border-bottom: 1px solid var(--border);
	font-weight: 700;
	font-size: 12px;
	text-transform: uppercase;
	color: var(--text-muted);
}

.members-list {
	flex: 1;
	overflow-y: auto;
	padding: 16px 8px;
}

.member-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 8px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: var(--transition);
}

.member-item:hover {
	background: var(--bg-primary);
}

.member-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	flex-shrink: 0;
	position: relative;
}

.member-status {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--offline);
	border: 2px solid var(--bg-secondary);
	position: absolute;
	bottom: -2px;
	right: -2px;
}

.member-status.online { background: var(--online); }
.member-status.idle { background: var(--idle); }
.member-status.dnd { background: var(--dnd); }

.member-name {
	font-size: 14px;
	font-weight: 500;
}

/* ==================== FRIENDS VIEW ==================== */
.friend-card {
	background: var(--bg-secondary);
	border-radius: var(--radius);
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
	transition: var(--transition);
}

.friend-card:hover {
	background: var(--bg-tertiary);
}

.friend-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	flex-shrink: 0;
	background-size: cover;
	background-position: center;
}

.friend-info {
	flex: 1;
}

.friend-name {
	font-weight: 600;
	font-size: 16px;
}

.friend-status {
	font-size: 13px;
	color: var(--text-muted);
}

.friend-actions {
	display: flex;
	gap: 8px;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: var(--bg-overlay);
	z-index: 100;
	animation: fadeIn 0.2s ease;
}

.modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: var(--bg-secondary);
	border-radius: var(--radius);
	width: 440px;
	max-width: 90vw;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
	z-index: 101;
	animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
	from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
	to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
}

.modal-header h3 {
	font-size: 20px;
	font-weight: 700;
}

.modal-close {
	background: transparent;
	border: none;
	color: var(--text-muted);
	font-size: 28px;
	cursor: pointer;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}

.modal-close:hover {
	background: var(--bg-primary);
	color: var(--text-primary);
}

.modal-body {
	padding: 20px;
}

.modal-footer {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	padding: 16px 20px;
	border-top: 1px solid var(--border);
}

.settings-body {
	max-height: 60vh;
	overflow-y: auto;
}

.settings-section {
	margin-bottom: 24px;
}

.settings-section h4 {
	margin-bottom: 12px;
	font-size: 14px;
	text-transform: uppercase;
	color: var(--text-muted);
	font-weight: 700;
}

.avatar-upload {
	display: flex;
	align-items: center;
	gap: 16px;
}

.avatar-preview {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--success));
	background-size: cover;
	background-position: center;
}

/* ==================== CONTEXT MENU ==================== */
.context-menu {
	position: fixed;
	background: var(--bg-tertiary);
	border-radius: var(--radius-sm);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	min-width: 180px;
	z-index: 1000;
	animation: fadeIn 0.15s ease;
}

.context-item {
	padding: 8px 12px;
	cursor: pointer;
	font-size: 14px;
	transition: var(--transition);
}

.context-item:hover {
	background: var(--brand);
	color: var(--text-primary);
}

.context-item:first-child {
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.context-item:last-child {
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ==================== EMOJI PICKER ==================== */
.emoji-picker {
	position: absolute;
	bottom: 100%;
	right: 0;
	margin-bottom: 8px;
	background: var(--bg-tertiary);
	border-radius: var(--radius);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	width: 320px;
	max-height: 320px;
	overflow-y: auto;
	z-index: 50;
	animation: fadeIn 0.2s ease;
}

.emoji-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
	gap: 4px;
	padding: 12px;
}

.emoji-grid span {
	font-size: 24px;
	cursor: pointer;
	text-align: center;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}

.emoji-grid span:hover {
	background: var(--bg-primary);
	transform: scale(1.2);
}

/* ==================== NOTIFICATION TOAST ==================== */
.notification-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--bg-secondary);
	border-left: 4px solid var(--brand);
	border-radius: var(--radius);
	padding: 16px 20px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	max-width: 320px;
	z-index: 200;
	animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
	from { opacity: 0; transform: translateX(100%); }
	to { opacity: 1; transform: translateX(0); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
	.app {
		grid-template-columns: 72px 240px 1fr;
	}
	
	.members-sidebar {
		position: absolute;
		right: 0;
		top: 0;
		bottom: 0;
		z-index: 10;
		box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
	}
}

@media (max-width: 768px) {
	.app {
		grid-template-columns: 1fr;
	}
	
	.server-list {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		z-index: 20;
		box-shadow: 4px 0 16px rgba(0, 0, 0, 0.4);
		transform: translateX(-100%);
		transition: transform 0.3s ease;
	}
	
	.server-list.mobile-open {
		transform: translateX(0);
	}
	
	.channels-sidebar {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		z-index: 15;
		box-shadow: 4px 0 16px rgba(0, 0, 0, 0.4);
		transform: translateX(-100%);
		transition: transform 0.3s ease;
	}
	
	.channels-sidebar.mobile-open {
		transform: translateX(0);
	}
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
	width: 12px;
}

::-webkit-scrollbar-track {
	background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
	background: var(--bg-primary);
	border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--text-muted);
}
