/* Mad Muda — 8-bit Retro-Futuristic Panel Styles */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

.mm-panel {
	font-family: 'VT323', monospace;
	color: #00ee44;
	background: rgba(0, 10, 4, 0.75);
	border: 1px solid rgba(0, 238, 68, 0.3);
	border-radius: 6px;
	padding: 16px 20px;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		0 0 15px rgba(0, 238, 68, 0.08),
		inset 0 0 30px rgba(0, 20, 8, 0.4);
	pointer-events: auto;
	overflow: hidden;
	position: relative;

	/* Expand/collapse like Apple home screen */
	transform: scale(1);
	transform-origin: top left;
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
	            opacity 0.25s ease,
	            box-shadow 0.3s ease;
	opacity: 0.85;
}

.mm-panel:hover {
	transform: scale(1.04);
	opacity: 1;
	box-shadow:
		0 0 25px rgba(0, 238, 68, 0.15),
		inset 0 0 30px rgba(0, 20, 8, 0.4);
}

/* Panels in corners need different transform-origins */
.mm-panel[style*="right"] {
	transform-origin: top right;
}
.mm-panel[style*="bottom"][style*="left"] {
	transform-origin: bottom left;
}
.mm-panel[style*="bottom"][style*="right"] {
	transform-origin: bottom right;
}

/* CRT scanline overlay */
.mm-panel::before {
	content: '';
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(
		0deg,
		transparent,
		transparent 2px,
		rgba(0, 0, 0, 0.06) 2px,
		rgba(0, 0, 0, 0.06) 4px
	);
	pointer-events: none;
	z-index: 10;
}

.mm-panel h2, .mm-panel h3 {
	font-family: 'Press Start 2P', cursive;
	font-size: 11px;
	letter-spacing: 1px;
	color: #00ff55;
	text-shadow: 0 0 6px rgba(0, 255, 85, 0.5);
	margin: 0 0 12px 0;
	text-transform: uppercase;
}

.mm-panel .data-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 0;
	border-bottom: 1px solid rgba(0, 238, 68, 0.08);
	font-size: 20px;
	line-height: 1.4;
}

.mm-panel .data-row:last-child {
	border-bottom: none;
}

.mm-panel .label {
	color: rgba(0, 238, 68, 0.6);
	font-size: 18px;
}

.mm-panel .value {
	color: #00ee44;
	text-shadow: 0 0 4px rgba(0, 238, 68, 0.3);
}

.mm-panel .value.positive {
	color: #00ff66;
}

.mm-panel .value.negative {
	color: #ff4444;
	text-shadow: 0 0 4px rgba(255, 68, 68, 0.3);
}

.mm-panel .value.gold {
	color: #f0c040;
	text-shadow: 0 0 4px rgba(240, 192, 64, 0.3);
}

/* Chart container */
.mm-panel .chart-box {
	width: 100%;
	height: 180px;
	background: rgba(0, 5, 2, 0.5);
	border: 1px solid rgba(0, 238, 68, 0.15);
	border-radius: 4px;
	margin: 8px 0;
	overflow: hidden;
}

/* Button */
.mm-btn {
	font-family: 'Press Start 2P', cursive;
	font-size: 10px;
	color: #00ee44;
	background: rgba(0, 238, 68, 0.08);
	border: 1px solid rgba(0, 238, 68, 0.3);
	border-radius: 4px;
	padding: 10px 18px;
	cursor: pointer;
	text-transform: uppercase;
	letter-spacing: 1px;
	transition: all 0.2s;
}

.mm-btn:hover {
	background: rgba(0, 238, 68, 0.15);
	box-shadow: 0 0 12px rgba(0, 238, 68, 0.2);
}

.mm-btn.active {
	background: rgba(0, 238, 68, 0.2);
	color: #00ff66;
	box-shadow: 0 0 15px rgba(0, 238, 68, 0.3);
}

.mm-btn.danger {
	color: #ff4444;
	border-color: rgba(255, 68, 68, 0.3);
}

.mm-btn.danger:hover {
	background: rgba(255, 68, 68, 0.15);
	box-shadow: 0 0 12px rgba(255, 68, 68, 0.2);
}

/* Status indicator */
.mm-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 16px;
}

.mm-status .dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #00ee44;
	box-shadow: 0 0 6px #00ee44;
	animation: pulse-dot 2s ease-in-out infinite;
}

.mm-status .dot.offline {
	background: #ff4444;
	box-shadow: 0 0 6px #ff4444;
	animation: none;
}

@keyframes pulse-dot {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

/* Terminal input */
.mm-input {
	font-family: 'VT323', monospace;
	font-size: 20px;
	color: #00ee44;
	background: rgba(0, 5, 2, 0.6);
	border: 1px solid rgba(0, 238, 68, 0.2);
	border-radius: 4px;
	padding: 8px 12px;
	width: 100%;
	box-sizing: border-box;
	outline: none;
	caret-color: #00ee44;
}

.mm-input:focus {
	border-color: rgba(0, 238, 68, 0.5);
	box-shadow: 0 0 8px rgba(0, 238, 68, 0.15);
}

.mm-input::placeholder {
	color: rgba(0, 238, 68, 0.25);
}

/* Positions table */
.mm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 18px;
}

.mm-table th {
	font-family: 'Press Start 2P', cursive;
	font-size: 8px;
	color: rgba(0, 238, 68, 0.5);
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid rgba(0, 238, 68, 0.15);
	text-transform: uppercase;
}

.mm-table td {
	padding: 5px 8px;
	border-bottom: 1px solid rgba(0, 238, 68, 0.06);
}

/* Scrollbar */
.mm-panel::-webkit-scrollbar {
	width: 4px;
}

.mm-panel::-webkit-scrollbar-track {
	background: transparent;
}

.mm-panel::-webkit-scrollbar-thumb {
	background: rgba(0, 238, 68, 0.2);
	border-radius: 2px;
}

/* ====== Icon System — collapsed/expanded panels ====== */

.mm-icon-wrapper {
	position: absolute;
	pointer-events: auto;
	z-index: 10;
}

.mm-icon-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	padding: 10px;
	border-radius: 12px;
	background: rgba(0, 10, 4, 0.6);
	border: 1px solid rgba(0, 238, 68, 0.2);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	position: relative;
}

.mm-icon-btn::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 12px;
	background: repeating-linear-gradient(
		0deg,
		transparent,
		transparent 2px,
		rgba(0, 0, 0, 0.04) 2px,
		rgba(0, 0, 0, 0.04) 4px
	);
	pointer-events: none;
}

.mm-icon-btn:hover {
	transform: scale(1.15);
	background: rgba(0, 238, 68, 0.1);
	border-color: rgba(0, 238, 68, 0.5);
	box-shadow:
		0 0 20px rgba(0, 238, 68, 0.2),
		0 0 40px rgba(0, 238, 68, 0.08);
}

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

.mm-icon-label {
	font-family: 'Press Start 2P', cursive;
	font-size: 7px;
	color: rgba(0, 238, 68, 0.7);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	text-shadow: 0 0 4px rgba(0, 238, 68, 0.3);
	white-space: nowrap;
}

/* Panel body — expand/collapse animation */
.mm-panel-body {
	opacity: 0;
	transform: scale(0.3);
	transform-origin: center center;
	transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mm-panel-body.open {
	opacity: 1;
	transform: scale(1);
}

/* Close button on expanded panel */
.mm-panel-close {
	position: absolute;
	top: 8px;
	right: 12px;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: 'VT323', monospace;
	font-size: 24px;
	color: rgba(0, 238, 68, 0.4);
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s;
	z-index: 20;
	line-height: 1;
}

.mm-panel-close:hover {
	color: #00ee44;
	background: rgba(0, 238, 68, 0.1);
	text-shadow: 0 0 8px rgba(0, 238, 68, 0.5);
}

/* Pulsing glow on icons to attract attention */
@keyframes icon-pulse {
	0%, 100% {
		box-shadow: 0 0 8px rgba(0, 238, 68, 0.1);
	}
	50% {
		box-shadow: 0 0 16px rgba(0, 238, 68, 0.2), 0 0 30px rgba(0, 238, 68, 0.06);
	}
}

.mm-icon-btn {
	animation: icon-pulse 3s ease-in-out infinite;
}

.mm-icon-btn:hover {
	animation: none;
}

/* Gold icon variant */
.mm-icon-btn.gold .mm-icon-label {
	color: rgba(240, 192, 64, 0.7);
	text-shadow: 0 0 4px rgba(240, 192, 64, 0.3);
}

.mm-icon-btn.gold {
	border-color: rgba(240, 192, 64, 0.2);
}

.mm-icon-btn.gold:hover {
	border-color: rgba(240, 192, 64, 0.5);
	box-shadow: 0 0 20px rgba(240, 192, 64, 0.15);
}

/* ====== Dock Bar — iOS-style bottom nav ====== */

#dock {
	position: fixed;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 100;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 10px 20px 10px;
	background: rgba(0, 8, 4, 0.7);
	border: 1px solid rgba(0, 238, 68, 0.15);
	border-radius: 20px;
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow:
		0 4px 30px rgba(0, 0, 0, 0.4),
		0 0 20px rgba(0, 238, 68, 0.05),
		inset 0 1px 0 rgba(0, 238, 68, 0.08);
}

/* Scanline overlay on dock */
#dock::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 20px;
	background: repeating-linear-gradient(
		0deg,
		transparent,
		transparent 2px,
		rgba(0, 0, 0, 0.03) 2px,
		rgba(0, 0, 0, 0.03) 4px
	);
	pointer-events: none;
}

.dock-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	padding: 4px 12px;
	border-radius: 14px;
	transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
	position: relative;
}

.dock-item:hover {
	background: rgba(0, 238, 68, 0.06);
}

.dock-icon {
	position: relative;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-icon-canvas {
	width: 48px;
	height: 48px;
	image-rendering: auto;
	transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
	filter: brightness(0.6) saturate(0.5);
}

.dock-glow {
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(0,238,68,0.15) 0%, transparent 70%);
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}

.dock-label {
	font-family: 'Press Start 2P', cursive;
	font-size: 6px;
	color: rgba(0, 238, 68, 0.3);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: 4px;
	transition: all 0.4s ease;
	white-space: nowrap;
}

/* === Active state — expanded === */

.dock-item.active {
	background: rgba(0, 238, 68, 0.08);
	padding: 6px 16px;
}

.dock-item.active .dock-icon {
	width: 56px;
	height: 56px;
}

.dock-item.active .dock-icon-canvas {
	width: 56px;
	height: 56px;
	filter: brightness(1) saturate(1);
}

.dock-item.active .dock-glow {
	opacity: 1;
}

.dock-item.active .dock-label {
	color: #00ee44;
	font-size: 7px;
	text-shadow: 0 0 6px rgba(0, 238, 68, 0.5);
	margin-top: 6px;
}

/* Active indicator dot */
.dock-item.active::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 50%;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: #00ee44;
	box-shadow: 0 0 6px #00ee44;
}

/* === Hover on inactive === */

.dock-item:not(.active):hover .dock-icon-canvas {
	filter: brightness(0.85) saturate(0.8);
	transform: scale(1.1);
}

.dock-item:not(.active):hover .dock-label {
	color: rgba(0, 238, 68, 0.6);
}

.dock-item:not(.active):hover .dock-glow {
	opacity: 0.4;
}

/* === Compressed bounce on deactivate === */

.dock-item:not(.active) .dock-icon {
	width: 40px;
	height: 40px;
}

.dock-item:not(.active) .dock-icon-canvas {
	width: 40px;
	height: 40px;
}

/* Ticker strip */
.mm-ticker {
	font-family: 'VT323', monospace;
	font-size: 18px;
	white-space: nowrap;
	overflow: hidden;
	color: #00ee44;
	padding: 4px 0;
}

.mm-ticker .ticker-inner {
	display: inline-block;
	animation: scroll-ticker 30s linear infinite;
}

@keyframes scroll-ticker {
	0% { transform: translateX(100%); }
	100% { transform: translateX(-100%); }
}

/* ====== Mobile Responsive ====== */

@media (max-width: 768px) {
	#dock {
		gap: 4px;
		padding: 8px 14px;
		border-radius: 16px;
		bottom: 8px;
	}

	.dock-item {
		padding: 4px 8px;
	}

	.dock-item.active .dock-icon {
		width: 48px;
		height: 48px;
	}

	.dock-item.active .dock-icon-canvas {
		width: 48px;
		height: 48px;
	}

	.dock-item:not(.active) .dock-icon {
		width: 32px;
		height: 32px;
	}

	.dock-item:not(.active) .dock-icon-canvas {
		width: 32px;
		height: 32px;
	}

	.dock-label {
		font-size: 5px;
	}

	.dock-item.active .dock-label {
		font-size: 6px;
	}

	.mm-panel {
		padding: 12px 14px;
	}

	.mm-panel h2, .mm-panel h3 {
		font-size: 9px;
		margin-bottom: 8px;
	}

	.mm-panel .data-row {
		font-size: 16px;
		padding: 3px 0;
	}

	.mm-panel .label {
		font-size: 14px;
	}

	.mm-btn {
		font-size: 8px;
		padding: 8px 12px;
	}

	.mm-input {
		font-size: 16px;
		padding: 6px 10px;
	}

	.mm-table {
		font-size: 14px;
	}

	.mm-table th {
		font-size: 7px;
		padding: 4px 6px;
	}

	.mm-table td {
		padding: 4px 6px;
	}

	.mm-icon-btn {
		padding: 8px;
		border-radius: 10px;
	}

	.mm-icon-label {
		font-size: 6px;
	}
}

@media (max-width: 480px) {
	#dock {
		gap: 2px;
		padding: 6px 10px;
		border-radius: 14px;
	}

	.dock-item.active .dock-icon,
	.dock-item.active .dock-icon-canvas {
		width: 40px;
		height: 40px;
	}

	.dock-item:not(.active) .dock-icon,
	.dock-item:not(.active) .dock-icon-canvas {
		width: 28px;
		height: 28px;
	}

	.mm-panel {
		padding: 10px 12px;
		max-width: calc(100vw - 24px);
	}

	.mm-panel h2, .mm-panel h3 {
		font-size: 8px;
	}

	.mm-panel .data-row {
		font-size: 14px;
	}

	.mm-panel .label {
		font-size: 12px;
	}

	.mm-panel .chart-box {
		height: 120px;
	}
}
