/**
 * Onboarding Modal Styles
 * 
 * Beautiful modal popup for Auto Form Builder template selection.
 *
 * @package Auto_Form_Builder
 */

/* ============================================
   Modal Overlay & Container
   ============================================ */
.afb-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgb(15 23 42 / 75%);
	backdrop-filter: blur(8px);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.afb-modal-overlay.is-visible {
	opacity: 1;
	visibility: visible;
}

.afb-modal {
	background: #fff;
	border-radius: 24px;
	box-shadow: 
		0 0 0 1px rgb(255 255 255 / 10%),
		0 25px 50px -12px rgb(0 0 0 / 50%),
		0 0 100px rgb(99 102 241 / 15%);
	max-width: 900px;
	width: 100%;
	max-height: 90vh;
	overflow: hidden;
	transform: scale(0.9) translateY(20px);
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
	position: relative;
}

.afb-modal-overlay.is-visible .afb-modal {
	transform: scale(1) translateY(0);
}

/* ============================================
   Modal Header
   ============================================ */
.afb-modal__header {
	position: relative;
	padding: 40px 40px 32px;
	text-align: center;
	background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
	border-bottom: 1px solid rgb(99 102 241 / 10%);
}

.afb-modal__header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 120px;
	height: 4px;
	background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
	border-radius: 0 0 4px 4px;
}

.afb-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 40px;
	height: 40px;
	border: none;
	background: rgb(100 116 139 / 10%);
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	color: #64748b;
}

.afb-modal__close:hover {
	background: rgb(239 68 68 / 10%);
	color: #ef4444;
	transform: rotate(90deg);
}

.afb-modal__close .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.afb-modal__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	border-radius: 20px;
	margin-bottom: 20px;
	box-shadow: 
		0 10px 40px rgb(99 102 241 / 35%),
		inset 0 1px 0 rgb(255 255 255 / 20%);
	animation: afb-float 3s ease-in-out infinite;
}

@keyframes afb-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}

.afb-modal__icon .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	color: #fff;
}

.afb-modal__title {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 28px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 8px;
	letter-spacing: -0.5px;
}

.afb-modal__subtitle {
	font-size: 16px;
	color: #64748b;
	margin: 0;
	line-height: 1.5;
}

/* Welcome badge for first-time users */
.afb-modal__welcome-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
	color: #fff;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 16px;
	box-shadow: 0 4px 15px rgb(16 185 129 / 30%);
}

.afb-modal__welcome-badge .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ============================================
   Modal Body - Template Grid
   ============================================ */
.afb-modal__body {
	padding: 32px 40px;
	max-height: calc(90vh - 280px);
	overflow-y: auto;
	background: #f8fafc;
}

.afb-modal__body::-webkit-scrollbar {
	width: 6px;
}

.afb-modal__body::-webkit-scrollbar-track {
	background: transparent;
}

.afb-modal__body::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

.afb-modal__body::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

.afb-template-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

/* ============================================
   Template Cards
   ============================================ */
.afb-template-card {
	background: #fff;
	border: 2px solid #e2e8f0;
	border-radius: 16px;
	padding: 24px;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}

.afb-template-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.afb-template-card:hover {
	border-color: #6366f1;
	transform: translateY(-4px);
	box-shadow: 
		0 20px 40px rgb(99 102 241 / 15%),
		0 0 0 1px rgb(99 102 241 / 10%);
}

.afb-template-card:hover::before {
	opacity: 1;
}

/* Blank form card - special styling */
.afb-template-card--blank {
	border-style: dashed;
	background: linear-gradient(135deg, #fafbfc 0%, #f1f5f9 100%);
}

.afb-template-card--blank:hover {
	background: #fff;
}

.afb-template-card__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 14px;
	margin-bottom: 16px;
	transition: transform 0.3s ease;
}

.afb-template-card:hover .afb-template-card__icon {
	transform: scale(1.1);
}

/* Icon color variations */
.afb-template-card__icon--blank {
	background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.afb-template-card__icon--contact {
	background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.afb-template-card__icon--feedback {
	background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.afb-template-card__icon--support {
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.afb-template-card__icon--newsletter {
	background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.afb-template-card__icon--event {
	background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.afb-template-card__icon .dashicons {
	font-size: 26px;
	width: 26px;
	height: 26px;
	color: #fff;
}

.afb-template-card__name {
	font-size: 16px;
	font-weight: 600;
	color: #1e293b;
	margin: 0 0 6px;
}

.afb-template-card__desc {
	font-size: 13px;
	color: #64748b;
	margin: 0 0 12px;
	line-height: 1.5;
}

.afb-template-card__meta {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: #6366f1;
	background: rgb(99 102 241 / 8%);
	padding: 4px 10px;
	border-radius: 20px;
	font-weight: 500;
}

.afb-template-card__meta .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

/* Card selected/loading states */
.afb-template-card.is-selected {
	border-color: #6366f1;
	background: rgb(99 102 241 / 3%);
}

.afb-template-card.is-loading {
	pointer-events: none;
}

.afb-template-card.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid #e2e8f0;
	border-top-color: #6366f1;
	border-radius: 50%;
	animation: afb-spin 0.7s linear infinite;
}

.afb-template-card.is-loading > * {
	opacity: 0.3;
}

@keyframes afb-spin {
	to { transform: rotate(360deg); }
}

/* ============================================
   Modal Footer
   ============================================ */
.afb-modal__footer {
	padding: 20px 40px;
	background: #fff;
	border-top: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.afb-modal__footer-text {
	font-size: 13px;
	color: #94a3b8;
	margin: 0;
}

.afb-modal__skip {
	background: none;
	border: none;
	color: #6366f1;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	padding: 10px 20px;
	border-radius: 10px;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 6px;
}

.afb-modal__skip:hover {
	background: rgb(99 102 241 / 8%);
}

.afb-modal__skip .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media screen and (width <= 900px) {
	.afb-template-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media screen and (width <= 600px) {
	.afb-modal {
		border-radius: 20px 20px 0 0;
		max-height: 95vh;
		margin-top: auto;
	}
	
	.afb-modal-overlay {
		align-items: flex-end;
		padding: 0;
	}
	
	.afb-modal-overlay.is-visible .afb-modal {
		transform: scale(1) translateY(0);
	}
	
	.afb-modal__header {
		padding: 32px 24px 24px;
	}
	
	.afb-modal__title {
		font-size: 22px;
	}
	
	.afb-modal__body {
		padding: 24px;
		max-height: calc(95vh - 280px);
	}
	
	.afb-template-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}
	
	.afb-modal__footer {
		padding: 16px 24px;
		flex-direction: column;
		gap: 12px;
	}
}

/* ============================================
   Button to Open Modal (on forms list page)
   ============================================ */
.afb-create-form-btn {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
	border: none !important;
	color: #fff !important;
	padding: 10px 20px !important;
	border-radius: 10px !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
	box-shadow: 0 4px 15px rgb(99 102 241 / 30%) !important;
	text-decoration: none !important;
}

.afb-create-form-btn:hover {
	transform: translateY(-2px) !important;
	box-shadow: 0 8px 25px rgb(99 102 241 / 40%) !important;
	color: #fff !important;
}

.afb-create-form-btn:focus {
	outline: none !important;
	box-shadow: 0 0 0 3px rgb(99 102 241 / 30%), 0 4px 15px rgb(99 102 241 / 30%) !important;
}

.afb-create-form-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* Hide default WP styles on our button */
.page-title-action.afb-create-form-btn {
	margin-left: 8px !important;
}
