/**
 * Modal Profile Overlay — Collabable.ai
 *
 * @since 1.4.0
 * @updated 5.9.7 — Close X button, avatar/name fix, compact layout for modal
 */

/* ---------------------------------------------------------------
 * Body scroll lock
 * ------------------------------------------------------------- */
body.collabable-modal-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------
 * Overlay container
 * ------------------------------------------------------------- */
.collabable-modal {
	position: fixed;
	inset: 0;
	z-index: 100000; /* Above WP admin bar (99999) */
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 20px;
	overflow-y: auto;
}

.collabable-modal.is-open {
	display: flex;
}

/* ---------------------------------------------------------------
 * Backdrop
 * ------------------------------------------------------------- */
.collabable-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	animation: collabable-modal-fadeIn 0.2s ease-out;
	cursor: pointer;
}

/* ---------------------------------------------------------------
 * Wrapper (the visible card)
 * ------------------------------------------------------------- */
.collabable-modal__wrapper {
	position: relative;
	width: 100%;
	max-width: 900px;
	padding-top: 0;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
	z-index: 1;
	animation: collabable-modal-slideUp 0.3s ease-out;
	margin: auto;
}

/* ---------------------------------------------------------------
 * Close X button (top-right, above cover image)
 * ------------------------------------------------------------- */
.collabable-modal__close-x,
.collabable-modal__close-x:focus,
.collabable-modal__close-x:active {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45) !important;
	background-color: rgba(0, 0, 0, 0.45) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 50%;
	box-shadow: none !important;
	outline: none;
	cursor: pointer;
	z-index: 12;
	transition: background 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.collabable-modal__close-x:hover {
	background: rgba(0, 0, 0, 0.7) !important;
}

.collabable-modal__close-x svg {
	pointer-events: none;
}

/* ---------------------------------------------------------------
 * Share button (next to close button)
 * ------------------------------------------------------------- */
.collabable-modal__share,
.collabable-modal__share:focus,
.collabable-modal__share:active {
	position: absolute;
	top: 10px;
	right: 54px;
	width: 36px;
	height: 36px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45) !important;
	background-color: rgba(0, 0, 0, 0.45) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 50%;
	box-shadow: none !important;
	outline: none;
	cursor: pointer;
	z-index: 12;
	transition: background 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.collabable-modal__share:hover {
	background: rgba(0, 0, 0, 0.7) !important;
}

.collabable-modal__share svg {
	pointer-events: none;
}

/* "Copied!" tooltip after clipboard copy */
.collabable-modal__share.is-copied::after {
	content: 'Copied!';
	position: absolute;
	right: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 6px;
	white-space: nowrap;
	animation: collabable-modal-fadeIn 0.15s ease-out;
}

/* ---------------------------------------------------------------
 * Body / content area
 * ------------------------------------------------------------- */
.collabable-modal__body {
	padding: 0;
	min-height: 300px;
}

/* Hide the back button inside the modal (we have the X instead) */
.collabable-modal__body .collabable-single-profile__back-bar {
	display: none;
}

/* Profile content inside modal: rounded top corners */
.collabable-modal__body .collabable-single-profile {
	border-radius: 16px;
	overflow: hidden;
}

/* Cover image: full-width, no side/top margins inside modal */
.collabable-modal__body .collabable-single-profile__cover-section {
	margin-left: 0;
	margin-right: 0;
	margin-top: 0;
	margin-bottom: 24px;
	width: 100%;
}

/* ---------------------------------------------------------------
 * Avatar & Name fix — prevent avatar from covering name
 * ------------------------------------------------------------- */

/* Smaller avatar in modal context */
.collabable-modal__body .collabable-single-profile__avatar-overlay {
	bottom: -80px;
}

.collabable-modal__body .collabable-single-profile__avatar-overlay .collabable-single-profile__avatar,
.collabable-modal__body .collabable-single-profile__avatar-overlay .collabable-single-profile__avatar--placeholder {
	width: 140px;
	height: 140px;
}

/* Reduce left-col top padding to match smaller avatar */
.collabable-modal__body .collabable-single-profile__left-col {
	padding-top: 70px;
}

/* Override full-page padding-left to match smaller modal avatar (140px + 32px left) */
.collabable-modal__body .collabable-single-profile__right-header {
	padding-left: 180px;
	padding-top: 0;
}

/* ---------------------------------------------------------------
 * Compact spacing for blocks inside modal
 * ------------------------------------------------------------- */

/* Podcast block: stack vertically in modal (no side-by-side with cover) */
.collabable-modal__body .collabable-single-profile__podcast-inner {
	flex-direction: column;
	align-items: stretch;
}

.collabable-modal__body .collabable-single-profile__podcast-cover {
	width: 100%;
	height: 180px;
	border-radius: 10px;
}

/* Tighter padding on role blocks */
.collabable-modal__body .collabable-single-profile__role-blocks--grid {
	gap: 1rem;
}

/* Reduce padding inside individual blocks in modal */
.collabable-modal__body .collabable-single-profile__podcast,
.collabable-modal__body .collabable-single-profile__host-interview,
.collabable-modal__body .collabable-single-profile__host-seeking,
.collabable-modal__body .collabable-single-profile__host-workflow,
.collabable-modal__body .collabable-single-profile__guest-expertise,
.collabable-modal__body .collabable-single-profile__guest-portfolio,
.collabable-modal__body .collabable-single-profile__guest-logistics,
.collabable-modal__body .collabable-single-profile__guest-seeking {
	padding: 1rem;
	margin-top: 0;
}

/* ---------------------------------------------------------------
 * Loading state
 * ------------------------------------------------------------- */
.collabable-modal__loader {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 80px 20px;
	color: #666;
	font-size: 14px;
}

.collabable-modal__spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e0e0e0;
	border-top-color: #CF0000;
	border-radius: 50%;
	animation: collabable-modal-spin 0.7s linear infinite;
}

/* ---------------------------------------------------------------
 * Error state
 * ------------------------------------------------------------- */
.collabable-modal__error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 80px 20px;
	color: #666;
	text-align: center;
}

.collabable-modal__error p {
	margin: 0;
	font-size: 15px;
}

.collabable-modal__close-btn {
	padding: 8px 24px;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	color: #333;
	cursor: pointer;
	font-size: 14px;
	transition: background 0.15s;
}

.collabable-modal__close-btn:hover {
	background: #f5f5f5;
}

/* ---------------------------------------------------------------
 * Animations
 * ------------------------------------------------------------- */
@keyframes collabable-modal-fadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes collabable-modal-slideUp {
	from {
		opacity: 0;
		transform: translateY(30px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

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

/* ---------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------- */
@media (max-width: 768px) {
	.collabable-modal {
		padding: 0;
	}

	.collabable-modal__wrapper {
		max-width: 100%;
		min-height: 100vh;
		border-radius: 0;
	}

	.collabable-modal__body .collabable-single-profile {
		border-radius: 0;
	}

	.collabable-modal__close-x {
		top: 12px;
		right: 12px;
	}

	.collabable-modal__share {
		top: 12px;
		right: 56px;
	}
}

@media (max-width: 480px) {
	.collabable-modal__close-x {
		width: 32px;
		height: 32px;
	}

	.collabable-modal__close-x svg {
		width: 18px;
		height: 18px;
	}

	.collabable-modal__share {
		width: 32px;
		height: 32px;
		right: 50px;
	}

	.collabable-modal__share svg {
		width: 18px;
		height: 18px;
	}
}
