/* Sidebar de câmeras deslizante à esquerda */
#cameras-sidebar {
	position: fixed;
	top: 20px;
	left: 20px;
	width: 300px;
	transform: translateX(calc(-100% - 20px));
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	max-height: calc(100dvh - 40px);
}
#cameras-sidebar.open {
	transform: translateX(0);
}

@media (max-width: 900px) {
	#cameras-sidebar {
		width: 100vw;
		left: 0;
		top: 0;
		height: 100dvh;
		border-radius: 0;
		max-width: 100vw;
		backdrop-filter: blur(6px);
	}
}

/* Ajuste da camera-view quando sidebar aberta */
.camera-view {
	transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-open .camera-view {
	margin-left: 320px;
}
@media (max-width: 900px) {
	.sidebar-open .camera-view {
		margin-left: 0;
	}
}
/* Estilos customizados do painel PTZ e botões */
body {
	font-family: "Inter", sans-serif;
	background-color: #f7f9fb;
}
#joystick-container {
	width: 250px;
	height: 250px;
	position: relative;
	background-color: #ffffff1a;
	border: 4px solid white;
	border-radius: 50%;
	cursor: grab;
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15),
		inset 0 0 15px rgba(255, 255, 255, 0.7);
	touch-action: none;
}
#joystick-knob {
	width: 50px;
	height: 50px;
	position: absolute;
	top: 100px;
	left: 100px;
	background-color: #e2e8f0;
	border-radius: 50%;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3),
		inset 0 0 5px rgba(255, 255, 255, 0.5);
	transition: background-color 0.1s;
	pointer-events: none;
	z-index: 10;
}
#joystick-container.knob-active {
	background-color: #ffffff33 !important;
}

.zoom-button,
.preset-button {
	transition: all 0.1s;
	min-height: 2.5rem;
}
.zoom-button:active,
.preset-button:active {
	transform: scale(0.95);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
#ptz-controller-panel {
	position: fixed;
	top: 20px;
	right: 20px;
	max-height: calc(100dvh - 40px);
	transform: translateX(calc(100% + 20px));
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	width: 420px;
}
#ptz-controller-panel.open {
	transform: translateX(0);
}
@media (max-width: 900px) {
	#ptz-controller-panel {
		width: 100%;
		backdrop-filter: blur(6px);
	}
}
iframe {
	background: transparent;
}

.camera-btn {
	position: relative;
	overflow: hidden;
}

.camera-btn:not(.active)::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	width: 0;
	height: 3px;
	background: #fff;
	border-radius: 2px;
	transform: translateX(-50%);
	opacity: 0;
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.camera-btn:not(.active):hover::after {
	width: 100%;
	opacity: 1;
}

/* Accordions */
.accordion-header[aria-expanded="true"] .icon-chevron {
	transform: rotate(180deg);
}
/* A transição de max-height é controlada via inline JS ajustando max-height dinâmica */

/* Accordion visual unificado */
.accordion {
	border-radius: 0.875rem; /* 14px */
	background: #ffffff1a;
	box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.45),
		inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.accordion + .accordion {
	margin-top: 0.75rem;
}

.accordion-header {
	background: transparent !important;
	border: none;
	border-radius: 0.875rem; /* irá ajustar dinamicamente quando aberto */
	position: relative;
}
.accordion-header:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.accordion-header[aria-expanded="true"] {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.accordion-panel {
	background: transparent;
	border-bottom-left-radius: 0.875rem;
	border-bottom-right-radius: 0.875rem;
	/* max-height animado via JS */
}

.accordion-panel.open {
	margin-bottom: 1rem;
}

/* Conteúdo interno herda cor; remover fundos individuais antigos se existirem */
.accordion-panel .cam-configs,
.accordion-panel .presets,
.accordion-panel .status-logs {
	background: transparent !important;
	box-shadow: none !important;
	padding-left: 1rem;
	padding-right: 1rem;
}

/* Ajuste de espaçamento vertical para primeira e última criança */
.accordion-panel .cam-configs > *:first-child,
.accordion-panel .presets > *:first-child,
.accordion-panel .status-logs > *:first-child {
	margin-top: 0.5rem;
}
.accordion-panel .cam-configs > *:last-child,
.accordion-panel .presets > *:last-child,
.accordion-panel .status-logs > *:last-child {
	margin-bottom: 0.5rem;
}
