/* Waybar main container */
.waybar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	height: var(--navbar-height);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 0.75rem;
	background: var(--bar-bg);
	border-bottom: 1px solid var(--bar-border);
	font-family: 'JetBrains Mono', 'Fira Code', monospace;
	font-size: 0.8rem;
}

/* Bar sections */
.bar-left,
.bar-center,
.bar-right {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.bar-left {
	flex: 1;
}

.bar-right {
	flex: 1;
	justify-content: flex-end;
}

/* Desktop-only items */
.desktop-only {
	display: flex;
}

.workspaces.desktop-only,
.window-title.desktop-only {
	display: flex;
}

@media (max-width: 768px) {
	.desktop-only,
	.workspaces.desktop-only,
	.window-title.desktop-only {
		display: none !important;
	}

	.bar-left {
		gap: 0.35rem;
	}

	.bar-center {
		display: none;
	}
}

/* Module base style */
.module {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.6rem;
	background: var(--bar-bg-module);
	border-radius: 6px;
	transition: all 0.15s ease;
}

/* Launcher / Logo */
.launcher {
	padding: 0.4rem;
	border-radius: 6px;
}

.launcher:hover {
	background: color-mix(in srgb, var(--bar-primary) 20%, transparent);
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	cursor: pointer;
	transition: all 0.15s ease;
}

.mobile-menu-toggle:hover {
	background: color-mix(in srgb, var(--bar-primary) 20%, transparent);
	border-color: var(--bar-primary);
}

@media (max-width: 768px) {
	.mobile-menu-toggle {
		display: flex;
	}
}

/* Workspaces */
.workspaces {
	gap: 0.15rem;
	background: transparent;
	padding: 0;
}

.workspace {
	display: flex;
	align-items: center;
	gap: 0.20rem;
	padding: 0.35rem 0.4rem;
	color: var(--bar-muted);
	text-decoration: none;
	border-radius: 4px;
	transition: all 0.15s ease;
	font-size: 0.75rem;
}

.workspace:hover {
	color: var(--bar-text);
	background: var(--bar-bg-module);
}

.workspace.active {
	color: var(--bar-primary);
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
}

.workspace.external {
	color: var(--bar-accent);
}

.workspace.external:hover {
	background: color-mix(in srgb, var(--bar-accent) 15%, transparent);
}

.ws-name {
	font-weight: 500;
}

/* Window title */
.window-title {
	color: var(--bar-text);
	font-size: 0.75rem;
}

.title-icon {
	color: var(--bar-primary);
}

.title-text {
	color: var(--bar-muted);
}

/* Clock */
.clock {
	gap: 0.75rem;
}

.time {
	color: var(--bar-text);
	font-weight: 600;
}

.date {
	color: var(--bar-muted);
}

/* Theme selector */
.theme-selector {
	position: relative;
	background: transparent;
	padding: 0;
}

.theme-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	cursor: pointer;
	transition: all 0.15s ease;
}

.theme-trigger:hover {
	background: color-mix(in srgb, var(--bar-primary) 20%, transparent);
	border-color: var(--bar-primary);
}

.theme-dropdown {
	position: absolute;
	top: calc(100% + 0.5rem);
	right: 0;
	min-width: 200px;
	background: var(--bar-bg);
	border: 1px solid var(--bar-border);
	border-radius: 8px;
	padding: 0.5rem;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	z-index: 1001;
}

.dropdown-header {
	padding: 0.25rem 0.5rem;
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bar-muted);
}

.dropdown-divider {
	height: 1px;
	background: var(--bar-border);
	margin: 0.5rem 0;
}

.theme-option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.5rem 0.75rem;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: var(--bar-text);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.8rem;
	text-align: left;
	transition: all 0.15s ease;
}

.theme-option:hover {
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
}

.theme-option.active {
	color: var(--bar-primary);
}

:global(.check) {
	margin-left: auto;
	color: var(--bar-primary);
}

/* Backdrop */
.backdrop {
	position: fixed;
	inset: 0;
	background: transparent;
	z-index: 997;
	border: none;
	cursor: default;
}

/* Mobile menu dropdown */
.mobile-menu {
	position: fixed;
	top: var(--navbar-height);
	left: 0;
	right: 0;
	background: var(--bar-bg);
	border-bottom: 1px solid var(--bar-border);
	z-index: 1000;
	padding: 1rem;
	font-family: 'JetBrains Mono', 'Fira Code', monospace;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	pointer-events: auto;
}

.mobile-nav-links {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.mobile-nav-link {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	color: var(--bar-text);
	text-decoration: none;
	border-radius: 6px;
	transition: all 0.15s ease;
	font-size: 0.9rem;
	cursor: pointer;
	position: relative;
	z-index: 1;
}

.mobile-nav-link:hover {
	background: var(--bar-bg-module);
	color: var(--bar-primary);
}

.mobile-nav-link:active {
	transform: scale(0.98);
}

.mobile-nav-link.active {
	color: var(--bar-primary);
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
}

.mobile-nav-link.external {
	color: var(--bar-accent);
}

.mobile-menu-divider {
	height: 1px;
	background: var(--bar-border);
	margin: 1rem 0;
}

.mobile-theme-section {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.mobile-section-header {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bar-muted);
	padding: 0 0.5rem;
}

.mobile-theme-options {
	display: flex;
	gap: 0.5rem;
}

.mobile-theme-btn {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	padding: 0.75rem 0.5rem;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.75rem;
	transition: all 0.15s ease;
	position: relative;
	z-index: 1;
}

.mobile-theme-btn:hover {
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
	border-color: var(--bar-primary);
	color: var(--bar-primary);
}

.mobile-theme-btn:active {
	transform: scale(0.98);
}

.mobile-theme-btn.active {
	color: var(--bar-primary);
	border-color: var(--bar-primary);
	background: color-mix(in srgb, var(--bar-primary) 20%, transparent);
}

.mobile-mode-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.8rem;
	transition: all 0.15s ease;
	width: 100%;
	position: relative;
	z-index: 1;
}

.mobile-mode-btn:hover {
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
	border-color: var(--bar-primary);
	color: var(--bar-primary);
}

.mobile-mode-btn:active {
	transform: scale(0.98);
}

/* Battery styles */
.module.battery {
	background: transparent;
}

.battery-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.25rem 0.5rem;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	cursor: default;
	font-family: inherit;
	font-size: 0.8rem;
	transition: all 0.12s ease;
}

.battery-btn:hover {
	background: color-mix(in srgb, var(--bar-primary) 12%, transparent);
	border-color: var(--bar-primary);
}

.battery-level {
	font-weight: 600;
	color: var(--bar-text);
}

.battery-alert {
	color: var(--bar-warning);
}

/* Low battery visuals */
.battery-btn.low {
	border-color: color-mix(in srgb, var(--bar-warning) 60%, var(--bar-border));
	/* animation: battery-pulse 1.6s infinite ease-in-out; */
	box-shadow: 0 0 0 0 rgba(0,0,0,0);
}

@keyframes battery-pulse {
	0% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
	50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bar-warning) 12%, transparent); }
	100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Charging visuals (green) - overrides low state */
.battery-btn.charging {
    border-color: color-mix(in srgb, var(--bar-success) 60%, var(--bar-border));
    background: color-mix(in srgb, var(--bar-success) 8%, var(--bar-bg-module));
    animation: none;
}

.battery-level.charging {
    color: var(--bar-success);
}

/* Discord status module */
.module.discord-status {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.25rem 0.5rem;
	background: var(--bar-bg-module);
	border: 1px solid var(--bar-border);
	border-radius: 6px;
	color: var(--bar-text);
	font-size: 0.85rem;
}

.discord-status .status-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
	background: var(--bar-muted);
	box-shadow: 0 0 0 2px rgba(0,0,0,0.04) inset;
}

.discord-status .status-dot.online { background: var(--bar-success); }
.discord-status .status-dot.idle { background: var(--bar-warning); }
.discord-status .status-dot.dnd { background: var(--bar-error); }
.discord-status .status-dot.offline { background: var(--bar-muted); opacity: 0.7; }

.discord-status .status-text {
	color: var(--bar-text);
	font-weight: 600;
	font-size: 0.85rem;
}

/* Keep the status on a single line and truncate if too long */
.module.discord-status {
	min-width: 0;
}

.discord-status .status-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: inline-block;
	max-width: 9rem; /* desktop default */
	vertical-align: middle;
}

@media (max-width: 768px) {
	/* tighter max width on mobile to keep everything on one line */
	.discord-status .status-text {
		max-width: 6rem;
	}
	.module.discord-status {
		padding: 0.2rem 0.45rem;
	}
}

/* Discord status button */
.discord-status-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0;
	background: transparent;
	border: none;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.discord-status-btn:hover {
	opacity: 0.85;
}

/* Discord Popover */
.module.discord-status {
	position: relative;
}

.discord-popover {
	position: absolute;
	top: calc(100% + 0.5rem);
	right: -0.5rem;
	width: 320px;
	background: var(--bar-bg);
	border: 1px solid var(--bar-border);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
	z-index: 1002;
	overflow: hidden;
}

.popover-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem;
	background: color-mix(in srgb, var(--bar-primary) 8%, var(--bar-bg));
}

.popover-avatar {
	position: relative;
	flex-shrink: 0;
	color: var(--bar-muted);
	width: 48px;
	height: 48px;
}

.popover-avatar .avatar-img {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
}

.popover-status-dot {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 3px solid color-mix(in srgb, var(--bar-primary) 8%, var(--bar-bg));
	background: var(--bar-muted);
}

.popover-status-dot.online { background: var(--bar-success); }
.popover-status-dot.idle { background: var(--bar-warning); }
.popover-status-dot.dnd { background: var(--bar-error); }
.popover-status-dot.offline { background: var(--bar-muted); opacity: 0.7; }

.popover-user-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.popover-name-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.popover-username {
	font-weight: 700;
	font-size: 1rem;
	color: var(--bar-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.popover-name-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.popover-username {
	font-weight: 700;
	font-size: 1rem;
	color: var(--bar-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: calc(100% - 92px);
}

.popover-clan-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 20px;
	padding: 0 0.35rem;
	background: color-mix(in srgb, var(--bar-primary) 15%, transparent);
	border: 1px solid color-mix(in srgb, var(--bar-primary) 30%, transparent);
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--bar-primary);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	line-height: 1;
	flex-shrink: 0;
}

/* .popover-clan-badge {
	width: 36px;
	height: 20px;
	object-fit: contain;
	border-radius: 4px;
	flex-shrink: 0;
	background: transparent;
	border: none;
	box-shadow: none;
} */

.popover-clan-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 22px; /* slightly taller to match larger text */
	padding: 0 0.6rem;
	background: color-mix(in srgb, var(--bar-primary) 12%, transparent);
	border-radius: 4px;
	font-size: 0.9rem; /* a bit larger than the badge */
	font-weight: 700;
	color: var(--bar-primary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	line-height: 1;
	flex-shrink: 0;
	margin-left: 0.25rem;
}

.popover-clan-badge {
	width: 15px; /* slightly smaller than tag text */
	height: 15px;
	object-fit: contain;
	border-radius: 4px;
	flex-shrink: 0;
	background: transparent;
	border: none;
	box-shadow: none;
	margin-right: 0.35rem;
}

/* Activities section */
.popover-activities {
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.activity-card {
	background: var(--bar-bg-module);
	border-radius: 8px;
	padding: 0.75rem;
}

.activity-type-label {
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bar-muted);
	margin-bottom: 0.5rem;
	font-weight: 600;
}

.activity-content {
	display: flex;
	gap: 0.75rem;
}

.activity-images {
	position: relative;
	flex-shrink: 0;
	width: 60px;
	height: 60px;
}

.activity-large-image {
	width: 60px;
	height: 60px;
	border-radius: 8px;
	object-fit: cover;
}

.activity-small-image {
	position: absolute;
	bottom: -4px;
	right: -4px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 3px solid var(--bar-bg-module);
	object-fit: cover;
}

.activity-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
	justify-content: center;
}

.activity-name {
	font-weight: 600;
	font-size: 0.85rem;
	color: var(--bar-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.activity-details {
	font-size: 0.75rem;
	color: var(--bar-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* No activity state */
.popover-no-activity {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 1.5rem;
	color: var(--bar-muted);
	font-size: 0.8rem;
}

/* Mobile adjustments for popover */
@media (max-width: 768px) {
	.discord-popover {
		position: fixed;
		top: var(--navbar-height);
		right: 0.5rem;
		left: 0.5rem;
		width: auto;
	}
}

