/* assets/css/liwi-app.css */

.liwi-app-wrapper {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
	height: 0;
	overflow: hidden;
}

.liwi-app-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

.health-profile-form {
	max-width: 600px;
	margin: 20px auto;
	padding: 20px;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-section {
	margin-bottom: 20px;
}

.form-section label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
}

select,
input[type="text"] {
	width: 100%;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.checkbox-group label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: normal;
}

.submit-button {
	background: #007bff;
	color: white;
	padding: 10px 20px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.submit-button:hover {
	background: #0056b3;
}

.liwi-profile-notice {
	background: #fff3cd;
	border: 1px solid #ffeaa7;
	border-left: 4px solid #f39c12;
	padding: 15px 20px;
	margin: 20px 0;
	border-radius: 4px;
	position: relative;
	z-index: 9999;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.liwi-profile-notice p {
	margin: 0;
	color: #856404;
	font-size: 14px;
	line-height: 1.5;
}

.liwi-profile-notice a {
	color: #856404;
	text-decoration: underline;
	font-weight: bold;
}

.liwi-profile-notice a:hover {
	color: #533f03;
	text-decoration: none;
}

/* Ensure notice appears at top of content */
body.logged-in .liwi-profile-notice {
	position: fixed;
	top: 32px; /* Below WordPress admin bar if present */
	left: 0;
	right: 0;
	margin: 0;
	border-radius: 0;
	text-align: center;
	padding: 10px 20px;
}

@media screen and (max-width: 782px) {
	body.logged-in .liwi-profile-notice {
		top: 46px; /* Adjust for mobile admin bar */
	}
}

/* Remove fixed positioning if admin bar is not present */
body:not(.admin-bar) .liwi-profile-notice {
	position: static !important;
	top: auto !important;
}

/* Health Profile Grid Layout */
.health-profile-container {
	max-width: 1100px;
	margin: 0 auto;
	padding: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue",
		sans-serif;
	display: flex;
	flex-direction: column;
}

.health-profile-iframe-wrapper {
	margin-bottom: 30px;
	border-radius: 8px;
	overflow: hidden;
	height: calc(100vh - 80px);
	max-height: 1400px;
	min-height: 700px;
	width: 100%;
}

.health-profile-iframe-wrapper .liwi-app-wrapper {
	padding-bottom: 0 !important;
	height: 100%;
	position: relative;
	overflow: hidden !important;
}

.health-profile-iframe-wrapper iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: none;
	position: absolute;
	top: 0;
	left: 0;
}

.health-profile-form-wrapper {
	grid-column: span 8;
	background: #fff;
	padding: 2rem;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.health-profile-guide {
	grid-column: span 4;
	background: #f8f9fa;
	padding: 2rem;
	border-radius: 8px;
	position: sticky;
	top: 2rem;
	height: fit-content;
}

.guide-title {
	font-size: 1.5rem;
	margin-bottom: 1rem;
}

.guide-content {
	font-size: 0.875rem;
	line-height: 1.5;
}

.guide-content ul {
	padding-left: 1.5rem;
	margin: 1rem 0;
}

/* Responsive Layout */
@media (max-width: 768px) {
	.health-profile-container {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.health-profile-form-wrapper,
	.health-profile-guide {
		grid-column: 1 / -1;
	}
}

/**
 * LIWI App Integration Styles
 */

/* Iframe Wrapper Styles */
.liwi-iframe-wrapper {
	width: 100%;
	height: 600px;
	border: none;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Main Iframe Styles */
.liwi-app-iframe {
	width: 100%;
	height: 100%;
	border: none;
	background: transparent;
}

/* Health Profile Specific Iframe */
.liwi-health-profile-iframe {
	min-height: 600px;
}

/* Login Required Message */
.liwi-login-required {
	padding: 20px;
	text-align: center;
	background: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	color: #6c757d;
	font-size: 16px;
}

/* Loading Overlay */
.liwi-iframe-wrapper::before {
	content: "Loading LIWI App...";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #6c757d;
	font-size: 16px;
	z-index: 1;
	pointer-events: none;
	background: rgba(248, 249, 250, 0.9);
	padding: 10px 20px;
	border-radius: 4px;
}

.liwi-iframe-wrapper.loaded::before {
	display: none;
}

/* Error States */
.liwi-error {
	padding: 15px;
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
	border-radius: 4px;
	margin: 10px 0;
}

/* Success States */
.liwi-success {
	padding: 15px;
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
	border-radius: 4px;
	margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
	.health-profile-iframe-wrapper {
		height: calc(100vh - 40px);
		min-height: 600px;
		max-height: 1000px;
	}

	.liwi-iframe-wrapper {
		margin: 10px 0;
		border-radius: 4px;
	}

	.liwi-app-iframe {
		min-height: 500px;
	}

	.liwi-health-profile-iframe {
		min-height: 700px;
	}
}

/* BuddyPress Integration */
.buddypress .liwi-iframe-wrapper {
	background: #fff;
	border: 1px solid #ddd;
}

/* Admin Styles */
.liwi-admin-notice {
	padding: 12px;
	border-left: 4px solid #0073aa;
	background: #fff;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* Avatar borders by type code (privacy-preserving) */
.liwi-ut-1 {
	box-shadow: 0 0 0 3px var(--liwi-color-patient, #e74c3c) !important;
	border-radius: 50% !important;
}
.liwi-ut-2 {
	box-shadow: 0 0 0 3px var(--liwi-color-relative, #8e44ad) !important;
	border-radius: 50% !important;
}
.liwi-ut-3 {
	box-shadow: 0 0 0 3px var(--liwi-color-healthcare, #27ae60) !important;
	border-radius: 50% !important;
}
.liwi-ut-4 {
	box-shadow: 0 0 0 3px var(--liwi-color-predisposition, #f39c12) !important;
	border-radius: 50% !important;
}
.liwi-ut-5 {
	box-shadow: 0 0 0 3px var(--liwi-color-other, #3498db) !important;
	border-radius: 50% !important;
}
.liwi-ut-0 {
	box-shadow: 0 0 0 3px var(--liwi-color-not-specified, #bdc3c7) !important;
	border-radius: 50% !important;
}

.liwi-avatar-badge-wrap {
	position: relative;
	display: inline-block;
}

.liwi-avatar-badge-wrap .avatar,
.liwi-avatar-badge-wrap img {
	display: block;
}

.liwi-avatar-badge-wrap::after {
	content: "";
	position: absolute;
	left: var(--liwi-badge-offset-x, -6px);
	bottom: var(--liwi-badge-offset-y, -6px);
	width: var(--liwi-badge-size, 20px);
	height: var(--liwi-badge-size, 20px);
	box-sizing: border-box;
	background-color: var(--liwi-badge-bg, rgba(255, 255, 255, 0.75));
	border: 1px solid var(--liwi-badge-border, rgba(0, 0, 0, 0.08));
	border-radius: 50%;
	background-image: var(--liwi-member-badge-url, none);
	background-size: 70% 70%;
	background-repeat: no-repeat;
	background-position: center;
	z-index: 2;
	pointer-events: none;
}

/* Stacked avatars in activity items (e.g., "X joined group Y"): hide badge */
.activity-group-avatar .group-avatar .liwi-avatar-badge-wrap::after,
.activity .activity-group-avatar .group-avatar .liwi-avatar-badge-wrap::after,
.activity-group-avatar .author-avatar .liwi-avatar-badge-wrap::after,
.activity .activity-group-avatar .author-avatar .liwi-avatar-badge-wrap::after {
	display: none !important;
}

/* In stacked activity avatars, remove LIWI type border to avoid broken rounding */
.activity-group-avatar .group-avatar .liwi-ut-0,
.activity-group-avatar .group-avatar .liwi-ut-1,
.activity-group-avatar .group-avatar .liwi-ut-2,
.activity-group-avatar .group-avatar .liwi-ut-3,
.activity-group-avatar .group-avatar .liwi-ut-4,
.activity-group-avatar .group-avatar .liwi-ut-5,
.activity .activity-group-avatar .group-avatar .liwi-ut-0,
.activity .activity-group-avatar .group-avatar .liwi-ut-1,
.activity .activity-group-avatar .group-avatar .liwi-ut-2,
.activity .activity-group-avatar .group-avatar .liwi-ut-3,
.activity .activity-group-avatar .group-avatar .liwi-ut-4,
.activity .activity-group-avatar .group-avatar .liwi-ut-5,
.activity-group-avatar .author-avatar .liwi-ut-0,
.activity-group-avatar .author-avatar .liwi-ut-1,
.activity-group-avatar .author-avatar .liwi-ut-2,
.activity-group-avatar .author-avatar .liwi-ut-3,
.activity-group-avatar .author-avatar .liwi-ut-4,
.activity-group-avatar .author-avatar .liwi-ut-5,
.activity .activity-group-avatar .author-avatar .liwi-ut-0,
.activity .activity-group-avatar .author-avatar .liwi-ut-1,
.activity .activity-group-avatar .author-avatar .liwi-ut-2,
.activity .activity-group-avatar .author-avatar .liwi-ut-3,
.activity .activity-group-avatar .author-avatar .liwi-ut-4,
.activity .activity-group-avatar .author-avatar .liwi-ut-5 {
	box-shadow: none !important;
}

.liwi-admin-notice.error {
	border-left-color: #dc3232;
}

.liwi-admin-notice.warning {
	border-left-color: #ffb900;
}

.liwi-admin-notice.success {
	border-left-color: #46b450;
}

/** Notice **/
.liwi-survey-notice {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: #fff4e5;
	border-left: 4px solid #ff9800;
	padding: 15px 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	max-width: 400px;
	border-radius: 6px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.liwi-survey-notice-close {
	position: absolute;
	top: 8px;
	right: 8px;
	background: transparent;
	border: none;
	padding: 2px;
	cursor: pointer;
	line-height: 1;
}

.liwi-survey-notice-close svg {
	width: 18px;
	height: 18px;
	color: #666;
	transition: color 0.2s;
}

.liwi-survey-notice-close:hover {
	outline: 1px solid #b2b2b2;
	color: #000;
	background: none;
	color: #b2b2b2;
}

.liwi-survey-notice-content p {
	margin: 0 0 15px 0;
	padding-right: 20px;
	/* Space for close button */
	color: #333;
	font-size: 14px;
	line-height: 1.4;
}

.liwi-survey-notice-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

.liwi-survey-notice-button {
	background: #ff9800;
	color: white;
	padding: 8px 16px;
	text-decoration: none;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 500;
	transition: background-color 0.2s;
}

.liwi-survey-notice-button:hover {
	background: #f57c00;
	color: white;
}

.liwi-survey-notice-dismiss {
	background: none;
	border: none;
	color: #666;
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
}

.liwi-survey-notice-dismiss:hover {
	color: #333;
}

@media (max-width: 480px) {
	.liwi-survey-notice {
		bottom: 10px;
		right: 10px;
		left: 10px;
		max-width: none;
	}
}

/* Never add LIWI user-type borders to group avatars */
.group-avatar-wrap .avatar,
.bb-hp-group-avatar,
.group-activity .group-avatar .avatar,
[data-bb-hp-group] .avatar {
	box-shadow: none !important;
}

.bp-group-home-link[href="?no-survey"] {
	pointer-events: none;
}
