@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
	/* Professional Light Theme - Branded */
	--gpt-bg: #f9f9fb;
	/* Very light grey background */
	--gpt-card-bg: #ffffff;
	/* Pure white cards */
	--gpt-text-main: #0b1c2e;
	/* Logo Navy Blue (Text & Headers) */
	--gpt-text-sub: #576574;
	/* Slate Grey Subtext */
	--gpt-accent: #0b1c2e;
	/* Logo Navy Blue (Buttons) */
	--gpt-accent-hover: #1e3750;
	/* Lighter Navy */
	--gpt-danger: #ea2027;
	/* Tech Red */
	--gpt-success: #27ae60;
	/* Enhanced Accessible Green (AA Standard) */
	--gpt-border: #d2d2d7;
	/* Light border */
	--gpt-shadow: 0 4px 20px rgba(11, 28, 46, 0.08);
	/* Shadow tinted with navy */

	/* Legacy Vars mapped to new theme to prevent breaks */
	--gpt-primary: #0b1c2e;
	--gpt-primary-gradient: #0b1c2e;
	--gpt-text-light: #0b1c2e;
}

/* Main Wrapper */
.gpt-wrapper {
	background: var(--gpt-bg);
	color: var(--gpt-text-main);
	padding: 3rem;
	border-radius: 20px;
	font-family: 'Inter', system-ui, sans-serif;
	box-shadow: var(--gpt-shadow);
	max-width: 1000px;
	margin: 2rem auto;
	border: 1px solid rgba(0, 0, 0, 0.05);
	position: relative;
	overflow: visible;
	text-align: center;
	opacity: 0;
	animation: gptFadeIn 0.5s ease-out forwards;
}

@keyframes gptFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Floating Background Emojis - Adjusted for Light Mode */
.gpt-bg-decoration {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 0;
	opacity: 0.06;
	/* Very subtle */
	overflow: hidden;
}

.gpt-float-icon {
	position: absolute;
	font-size: 60px;
	user-select: none;
	filter: grayscale(1);
	/* Black and white emojis */
}

/* Re-use existing float animations */
.gpt-float-icon.icon-1 {
	top: 10%;
	left: 5%;
	animation: float-icon 5s ease-in-out infinite alternate;
}

.gpt-float-icon.icon-2 {
	top: 40%;
	left: 15%;
	font-size: 40px;
	animation: float-icon 4s ease-in-out infinite alternate-reverse;
}

.gpt-float-icon.icon-3 {
	top: 15%;
	left: 25%;
	font-size: 50px;
	animation: float-icon 6s ease-in-out infinite alternate 1s;
}

.gpt-float-icon.icon-4 {
	top: 60%;
	right: 10%;
	font-size: 55px;
	animation: float-icon 5.5s ease-in-out infinite alternate-reverse 0.5s;
}

.gpt-float-icon.icon-5 {
	bottom: 15%;
	left: 40%;
	font-size: 45px;
	animation: float-icon 7s ease-in-out infinite alternate 2s;
}

.gpt-float-icon.icon-6 {
	top: 25%;
	right: 25%;
	font-size: 50px;
	animation: float-icon 6.5s ease-in-out infinite alternate-reverse 1.5s;
}

@keyframes float-icon {
	0% {
		transform: translateY(0) rotate(0deg);
	}

	100% {
		transform: translateY(-20px) rotate(10deg);
	}
}

/* Header */
.gpt-header {
	display: none;
}

/* State Card (The Main Focus) */
.gpt-status-container {
	display: flex;
	justify-content: center;
	width: 100%;
	margin-bottom: 2rem;
	position: relative;
	z-index: 2;
}

.gpt-state-card {
	background: var(--gpt-card-bg);
	padding: 3rem;
	border-radius: 24px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
	/* Soft floating shadow */
	border: 1px solid rgba(0, 0, 0, 0.04);
	max-width: 800px;
	width: 100%;
	transition: all 0.3s ease;
}

.gpt-card-title {
	font-size: 1.4rem;
	font-weight: 600;
	color: var(--gpt-text-main);
	margin: 0 0 1.5rem;
	line-height: 1.4;
}

.gpt-connection-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-bottom: 2rem;
}

.gpt-status-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
}

.gpt-status-dot.red {
	background-color: var(--gpt-danger);
	box-shadow: 0 0 0 0 rgba(255, 95, 87, 0.7);
	animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
	0% {
		transform: scale(0.95);
		box-shadow: 0 0 0 0 rgba(255, 95, 87, 0.7);
	}

	70% {
		transform: scale(1);
		box-shadow: 0 0 0 10px rgba(255, 95, 87, 0);
	}

	100% {
		transform: scale(0.95);
		box-shadow: 0 0 0 0 rgba(255, 95, 87, 0);
	}
}

.gpt-status-dot.green {
	background-color: var(--gpt-success);
	box-shadow: 0 0 10px rgba(52, 199, 89, 0.3);
}

.gpt-status-text {
	font-size: 1rem;
	color: var(--gpt-text-sub);
	font-weight: 500;
}

/* Action Buttons (Pills) */
.gpt-action-buttons {
	display: flex;
	justify-content: center;
	gap: 15px;
	margin-bottom: 2rem;
}

.gpt-pill-btn {
	background: var(--gpt-accent);
	color: white;
	padding: 12px 28px;
	border-radius: 50px;
	font-size: 0.95rem;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: default;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: transform 0.2s, background 0.2s;
}

.gpt-pill-btn:hover {
	transform: translateY(-2px);
	background: var(--gpt-accent-hover);
}

.gpt-btn-icon {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.gpt-pill-btn span {
	font-size: 1.2rem;
}

.gpt-helper-text {
	font-size: 0.9rem;
	color: #999;
	margin: 0;
	max-width: 600px;
	margin-left: auto;
	margin-right: auto;
	line-height: 1.6;
}

/* Device Grid & Categories */
.gpt-device-categories {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
	margin-bottom: 4rem;
	position: relative;
	z-index: 1;
}

.gpt-category-section {
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	padding-bottom: 1.5rem;
}

.gpt-category-section:last-child {
	border-bottom: none;
}

.gpt-category-title {
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 1.25rem;
	color: var(--gpt-text-main);
	display: flex;
	align-items: center;
	gap: 10px;
}

.gpt-category-title::before {
	content: '';
	display: block;
	width: 4px;
	height: 18px;
	background: var(--gpt-accent);
	border-radius: 2px;
}

.gpt-device-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1rem;
	opacity: 0.6;
	transition: opacity 0.3s;
}

.gpt-device-grid.active-mode {
	opacity: 1;
}

.gpt-device-card {
	background: #f5f5f7;
	color: var(--gpt-text-sub);
	border-radius: 12px;
	text-align: center;
	transition: all 0.3s ease-out;
	border: 1px solid transparent;
	padding: 1rem;
	display: flex;
	flex-direction: column;
}

.gpt-device-card.active {
	background: #fff;
	border-color: var(--gpt-text-main);
	color: var(--gpt-text-main);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	transform: translateY(-5px);
}

.gpt-card-icon svg {
	fill: #ccc;
	width: 30px;
	height: 30px;
}

.gpt-device-card.active .gpt-card-icon svg {
	fill: var(--gpt-text-main);
}

.gpt-device-card h4 {
	font-size: 0.8rem;
	margin-top: 5px;
	font-weight: 600;
}

.gpt-conn-status {
	font-size: 0.7rem;
	display: block;
}

/* Controller Visualizer - Visibility Toggle */
#gpt-visualizer-box {
	display: none;
	margin-top: 2rem;
}

#gpt-visualizer-box.gpt-visible {
	display: block !important;
	min-height: 400px !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.gpt-visual {
	background: #ffffff;
	border-radius: 24px;
	padding: 1.5rem;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
	border: 1px solid rgba(0, 0, 0, 0.05);
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 400px;
	/* Increased for new SVG */
}

/* Modern SVG Controller Styles */
.gpt-controller-svg {
	width: 100%;
	height: auto;
	max-width: 700px;
	/* Limit size for desktop */
	filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

.gpt-body-shape {
	fill: #2d3436;
	transition: fill 0.3s;
}

.gpt-btn {
	transition: all 0.1s ease;
}

.gpt-btn.active {
	fill: var(--gpt-accent) !important;
	filter: drop-shadow(0 0 5px var(--gpt-accent));
}

.gpt-stick-head {
	cursor: pointer;
	transition: none;
	/* Instant feedback */
}

.gpt-stick circle:first-child {
	fill: #1a1a1a;
	stroke: #333;
}

/* SVG Controller Styles */
.gpt-controller-svg {
	width: 100%;
	max-width: 600px;
	height: auto;
	filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.2));
}

.gpt-body-shape {
	fill: #2d3436;
	stroke: #1d1d1f;
	stroke-width: 3px;
	transition: fill 0.3s;
}

/* Base button styles for SVG */
.gpt-btn {
	cursor: pointer;
	transition: fill 0.1s, transform 0.1s;
	/* Reset legacy overrides if any */
	position: static !important;
	box-shadow: none !important;
	background: transparent !important;
}

/* Active State (Pressed) */
.gpt-btn.active {
	fill: var(--gpt-success) !important;
	/* Brand Green */
	filter: drop-shadow(0 0 15px rgba(68, 189, 50, 0.5));
	transform: scale(0.95);
	transform-origin: center;
}

/* Sticks */
.gpt-stick-head {
	transition: transform 0.05s linear;
}

/* Data Panel - Light Mode */
.gpt-data-panel {
	background: var(--gpt-card-bg);
	padding: 2rem;
	border-radius: 16px;
	color: var(--gpt-text-main);
	height: fit-content;
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
	border: 1px solid rgba(0, 0, 0, 0.05);
	margin-top: 2rem;
}

.gpt-info-row {
	border-bottom: 1px solid #f0f0f0;
	margin-bottom: 1.2rem;
	padding-bottom: 0.8rem;
}

/* -------------------------------------------------------------
   New Features Styles (Popup, Slider, Vibration)
------------------------------------------------------------- */

/* Drift Header Status */
.gpt-drift-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
}

.gpt-drift-status {
	font-size: 0.85rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 4px;
	background: #eef1f5;
	color: var(--gpt-text-sub);
}

.gpt-drift-status.bad {
	background: #ffebeb;
	color: var(--gpt-danger);
}

/* Range Slider */
.gpt-drift-settings {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px dashed #eee;
}

.gpt-drift-settings label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.9rem;
	margin-bottom: 0.8rem;
	color: var(--gpt-text-sub);
}

.gpt-drift-settings label small {
	color: #bbb;
	font-size: 0.75rem;
}

.gpt-range-slider {
	width: 100%;
	height: 6px;
	background: #e0e0e0;
	border-radius: 3px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	/* Fix: Added appearance property */
	cursor: pointer;
}

/* Threshold Slider Customization */
input[type=range].gpt-range-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--gpt-accent);
	cursor: pointer;
	transition: background 0.2s;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.gpt-range-slider::-webkit-slider-thumb:hover {
	background: var(--gpt-accent-hover);
}

/* Vibration Buttons Grid */
.gpt-vibe-buttons {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 10px;
}

.gpt-button.vibe-btn {
	padding: 10px 0;
	font-size: 0.9rem;
	background: #fff;
	color: var(--gpt-text-main);
	border: 1px solid #dcdcdc;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 500;
	transition: all 0.2s;
	/* Reset default button styles if any */
	line-height: normal;
}

.gpt-button.vibe-btn:hover {
	background: #f7f9fc;
	border-color: var(--gpt-accent);
	color: var(--gpt-accent);
	transform: translateY(-2px);
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.gpt-button.vibe-btn:active {
	transform: scale(0.98);
}

.gpt-button.vibe-btn.vibrating {
	animation: vibe-pulse 0.2s infinite;
	background: var(--gpt-accent);
	color: white;
	border-color: var(--gpt-accent);
}

@keyframes vibe-pulse {
	0% {
		transform: translate(1px, 1px) rotate(0deg);
	}

	10% {
		transform: translate(-1px, -2px) rotate(-1deg);
	}

	20% {
		transform: translate(-3px, 0px) rotate(1deg);
	}

	30% {
		transform: translate(3px, 2px) rotate(0deg);
	}

	40% {
		transform: translate(1px, -1px) rotate(1deg);
	}

	50% {
		transform: translate(-1px, 2px) rotate(-1deg);
	}

	60% {
		transform: translate(-3px, 1px) rotate(0deg);
	}

	70% {
		transform: translate(3px, 1px) rotate(-1deg);
	}

	80% {
		transform: translate(-1px, -1px) rotate(1deg);
	}

	90% {
		transform: translate(1px, 2px) rotate(0deg);
	}

	100% {
		transform: translate(1px, -2px) rotate(-1deg);
	}
}

/* Button Tester Grid */
.gpt-button-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
	gap: 8px;
	margin-top: 15px;
}

.gpt-btn-indicator {
	background: rgba(0, 0, 0, 0.05);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 8px 0;
	text-align: center;
	font-size: 0.75rem;
	font-weight: 600;
	color: #2d3436;
	transition: all 0.2s ease;
	opacity: 0.6;
}

.gpt-btn-indicator.active {
	background: #4cd137;
	color: white;
	border-color: #4cd137;
	opacity: 1;
	transform: scale(1.1);
	box-shadow: 0 4px 10px rgba(76, 209, 55, 0.3);
}

/* Dynamic Discovery View */
.gpt-discovery-view {
	text-align: center;
	margin: 2rem 0;
	transition: all 0.5s ease;
}

.gpt-section-title {
	font-size: 1.6rem;
	font-weight: 800;
	color: var(--gpt-text-main);
	margin-bottom: 2.5rem;
	letter-spacing: -0.5px;
	position: relative;
	display: inline-block;
}

.gpt-section-title::after {
	content: '';
	position: absolute;
	bottom: -10px;
	left: 50%;
	transform: translateX(-50%);
	width: 40px;
	height: 4px;
	background: var(--gpt-accent);
	border-radius: 2px;
}

.gpt-category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 1.5rem;
}

.gpt-cat-item {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.05);
	border-radius: 20px;
	padding: 1.5rem 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.8rem;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.gpt-cat-item:hover {
	transform: translateY(-8px);
	border-color: var(--gpt-accent);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.gpt-cat-icon {
	font-size: 2.22rem;
	filter: grayscale(0.2);
	transition: filter 0.3s;
}

.gpt-cat-item:hover .gpt-cat-icon {
	filter: grayscale(0);
}

.gpt-cat-item span {
	font-weight: 600;
	color: var(--gpt-text-sub);
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Dynamic State Transitions */
.gpt-wrapper.is-connected #gpt-discovery-view {
	display: none;
}

.gpt-wrapper.is-connected .gpt-active-pool {
	display: block !important;
	margin-bottom: 2rem;
	animation: gptSlideIn 0.5s ease-out;
}

/* Reveal only the category section we need */
.gpt-active-pool .gpt-category-section.is-visible {
	display: block !important;
}

@keyframes gptSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Category Specific Styles in Active Mode */
.gpt-active-pool .gpt-device-card {
	max-width: 300px;
	margin: 0 auto;
}

@keyframes gptPulse {
	0% {
		box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
	}

	70% {
		box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
	}

	100% {
		box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
	}
}

@keyframes gptBreathe {

	0%,
	100% {
		opacity: 0.6;
		transform: scale(1);
	}

	50% {
		opacity: 1;
		transform: scale(1.1);
	}
}

/* Enhanced SVG Buttons */
.gpt-btn {
	transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.gpt-btn.active {
	fill: var(--gpt-success) !important;
	filter: drop-shadow(0 0 8px var(--gpt-success));
	transform: scale(0.95) translateY(2px);
}

/* Enhanced Sticks with Glow */
.gpt-stick-head {
	transition: transform 0.05s linear;
}

.gpt-stick-active .gpt-stick-head {
	filter: drop-shadow(0 0 12px var(--gpt-success));
}

.gpt-stick-active .gpt-stick-base {
	stroke: var(--gpt-success);
	stroke-width: 2px;
	opacity: 0.8;
}

/* Status Breathing */
.gpt-status-dot.red {
	animation: gptBreathe 2s infinite ease-in-out;
}

.gpt-status-dot.green {
	animation: gptPulse 2s infinite;
}

/* Pulse for active card */
.gpt-device-card.active {
	border-color: var(--gpt-success);
	background: rgba(39, 174, 96, 0.05);
	box-shadow: 0 8px 32px rgba(39, 174, 96, 0.15);
	animation: gptCardSoftPulse 3s infinite ease-in-out;
}

@keyframes gptCardSoftPulse {

	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.02);
	}
}