/* Universal Panel Styles */

.hp-panel-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(15, 23, 42, 0.4);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 999998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.hp-panel-overlay.is-active {
	opacity: 1;
	visibility: visible;
}

.hp-panel {
	position: fixed;
	top: 0;
	right: 0;
	transform: translateX(100%);
	width: 100%;
	max-width: 480px;
	height: 100vh;
	background: #ffffff;
	z-index: 999999;
	box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-sizing: border-box;
}

.hp-panel *,
.hp-panel *::before,
.hp-panel *::after {
	box-sizing: border-box;
}

.hp-panel.is-active {
	transform: translateX(0);
}

/* Header */
.hp-panel__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 32px;
	border-bottom: 1px solid #e2e8f0;
	background: #f8fafc;
	flex-shrink: 0;
}

.hp-panel__profile {
	display: flex;
	align-items: center;
	gap: 16px;
}

.hp-panel__avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hp-panel__profile-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hp-panel__name {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #0f172a;
	display: flex;
	align-items: center;
	gap: 6px;
}

.hp-panel__verified {
	color: var(--h-color-primary, #3b82f6);
}

.hp-panel__role {
	margin: 0;
	font-size: 13px;
	color: #64748b;
}

.hp-panel__close {
	background: transparent;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
	border-radius: 4px;
}

.hp-panel__close:hover {
	color: #0f172a;
	background: #e2e8f0;
}

/* Body */
.hp-panel__body {
	flex: 1;
	overflow-y: auto;
	padding: 32px;
}

.hp-panel__intro {
	margin-bottom: 32px;
}

.hp-panel__intro h2 {
	font-size: 24px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 8px;
	letter-spacing: -0.5px;
}

.hp-panel__intro p {
	font-size: 15px;
	color: #64748b;
	margin: 0;
	line-height: 1.5;
}

/* Form Styles */
.hp-panel-form {
	display: flex;
	flex-direction: column;
}

.hp-form-group {
	margin-bottom: 24px;
}

.hp-form-group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 8px;
}

.hp-input {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 15px;
	color: #0f172a;
	transition: all 0.2s;
	background: #fff;
	box-sizing: border-box;
}

.hp-input:focus {
	outline: none;
	border-color: var(--h-color-primary, #3b82f6);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.hp-textarea {
	resize: vertical;
	min-height: 120px;
}

/* Progress Bar */
.hp-panel-progress {
	height: 4px;
	background: #e2e8f0;
	border-radius: 2px;
	margin-bottom: 32px;
	overflow: hidden;
	flex-shrink: 0;
}

.hp-panel-progress__bar {
	height: 100%;
	background: var(--h-color-primary, #3b82f6);
	transition: width 0.3s ease;
}

/* Steps */
.hp-panel-step {
	display: none;
	animation: hpFadeInRight 0.3s ease forwards;
}

.hp-panel-step.hp-panel-step--active {
	display: block;
}

@keyframes hpFadeInRight {
	from { opacity: 0; transform: translateX(20px); }
	to { opacity: 1; transform: translateX(0); }
}

/* Radio Cards */
.hp-radio-cards {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.hp-radio-card {
	position: relative;
	cursor: pointer;
}

.hp-radio-card input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.hp-radio-card__content {
	display: block;
	padding: 14px 16px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #475569;
	transition: all 0.2s;
}

.hp-radio-card:hover .hp-radio-card__content {
	border-color: #cbd5e1;
	background: #f8fafc;
}

.hp-radio-card input:checked + .hp-radio-card__content {
	border-color: var(--h-color-primary, #3b82f6);
	background: rgba(59, 130, 246, 0.05);
	color: var(--h-color-primary, #3b82f6);
}

/* Buttons */
.hp-form-actions {
	margin-top: 32px;
}

.hp-form-actions--split {
	display: flex;
	justify-content: space-between;
	gap: 16px;
}

.hp-form-actions .hp-btn {
	width: 100%;
	padding: 14px;
	font-size: 15px;
}

.hp-form-actions--split .hp-btn {
	width: auto;
	flex: 1;
}

.hp-btn--primary {
	background: var(--h-color-primary, #3b82f6);
	color: #fff;
	border: none;
}
.hp-btn--primary:hover {
	filter: brightness(0.9);
}

.hp-btn--secondary {
	background: #f1f5f9;
	color: #475569;
	border: none;
}
.hp-btn--secondary:hover {
	background: #e2e8f0;
	color: #0f172a;
}

/* Consent & Summary */
.hp-form-summary p {
	font-size: 15px;
	color: #334155;
	background: #f8fafc;
	padding: 16px;
	border-radius: 8px;
	margin-bottom: 24px;
	border: 1px solid #e2e8f0;
}

.hp-checkbox-group {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.hp-checkbox-group input {
	margin-top: 4px;
}

.hp-consent-label {
	font-size: 13px !important;
	color: #64748b !important;
	font-weight: 400 !important;
	line-height: 1.5;
}

.hp-consent-label a {
	color: var(--h-color-primary, #3b82f6);
	text-decoration: underline;
}

/* Success State */
.hp-panel-success {
	text-align: center;
	padding-top: 40px;
}

.hp-panel-success__icon {
	color: #10b981;
	margin-bottom: 24px;
}

.hp-panel-success h2 {
	font-size: 24px;
	color: #0f172a;
	margin-bottom: 12px;
}

.hp-panel-success p {
	color: #64748b;
	margin-bottom: 32px;
	line-height: 1.6;
}

/* Utility */
.hp-form-error {
	margin-top: 16px;
	padding: 12px;
	background: #fef2f2;
	color: #b91c1c;
	border-radius: 6px;
	font-size: 13px;
	text-align: center;
}

.hp-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255,255,255,0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: hp-spin 1s ease-in-out infinite;
	margin: 0 auto;
}

@keyframes hp-spin {
	to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive & Safe Area Adjustments
   ========================================================================== */

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
	.hp-panel {
		max-width: 540px;
	}
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
	.hp-panel {
		right: auto !important;
		left: 0 !important;
		max-width: 100vw !important;
		width: 100vw !important;
		/* Use dynamic viewport height if supported to fix mobile browser bar jumps */
		height: 100dvh; 
		height: -webkit-fill-available; 
	}
	
	.hp-panel__header {
		padding: calc(env(safe-area-inset-top, 0px) + 20px) 24px 20px 24px;
		position: sticky;
		top: 0;
		z-index: 10;
		box-shadow: 0 2px 10px rgba(0,0,0,0.05);
	}
	
	.hp-panel__body {
		padding: 24px 24px calc(env(safe-area-inset-bottom, 0px) + 24px) 24px;
	}
	
	.hp-panel__intro h2 {
		font-size: 20px;
	}
	
	.hp-panel__profile {
		gap: 12px;
	}
	
	.hp-panel__avatar {
		width: 40px;
		height: 40px;
	}
	
	.hp-panel__name {
		font-size: 15px;
	}
	
	.hp-panel__role {
		font-size: 12px;
	}
	
	.hp-form-actions--split {
		flex-direction: column-reverse;
		gap: 12px;
	}
	
	.hp-form-actions--split .hp-btn {
		width: 100%;
	}
}
