/**
 * DLA Math CAPTCHA - Frontend Styles
 */

/* Wrapper */
.dla-captcha-field {
	margin: 15px 0;
	padding: 0;
	position: relative;
}

/* Label */
.dla-captcha-label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 14px;
	color: #333;
}

/* Question + Refresh wrapper */
.dla-captcha-question-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
	background: #f7f8fa;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 10px 14px;
}

/* Text question */
.dla-captcha-question {
	font-size: 16px;
	font-weight: 700;
	color: #1a1a2e;
	letter-spacing: 0.5px;
	flex: 1;
}

/* Image question */
.dla-captcha-image {
	display: block;
	flex: 1;
	max-width: 300px;
	height: auto;
	border-radius: 4px;
}

/* Refresh button */
.dla-captcha-refresh {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #ccc;
	border-radius: 50%;
	background: #fff;
	color: #666;
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1;
}

.dla-captcha-refresh:hover {
	background: #f0f0f0;
	border-color: #999;
	color: #333;
}

.dla-captcha-refresh:active {
	transform: scale(0.95);
}

.dla-captcha-refresh.is-loading {
	animation: dla-spin 0.8s linear infinite;
	pointer-events: none;
	opacity: 0.6;
}

.dla-captcha-refresh svg {
	width: 16px;
	height: 16px;
}

/* Input */
.dla-captcha-input {
	display: block;
	width: 100%;
	max-width: 200px;
	padding: 8px 12px;
	font-size: 16px;
	font-weight: 600;
	border: 2px solid #ddd;
	border-radius: 6px;
	background: #fff;
	color: #333;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.dla-captcha-input:focus {
	border-color: #4a90d9;
	outline: none;
	box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.dla-captcha-input::placeholder {
	color: #aaa;
	font-weight: 400;
}

/* Honeypot - extra hiding (in addition to inline styles) */
.dla-captcha-hp {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 0 !important;
	height: 0 !important;
	overflow: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Noscript fallback */
.dla-captcha-noscript {
	font-size: 12px;
	color: #888;
	margin-top: 4px;
}

/* Animation */
@keyframes dla-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ========================
   Context-specific styles
   ======================== */

/* WordPress Login Form */
.login .dla-captcha-field {
	margin: 10px 0 20px;
}

.login .dla-captcha-input {
	max-width: 100%;
	padding: 6px 10px;
}

.login .dla-captcha-question-wrap {
	padding: 8px 12px;
}

/* Comment form */
.comment-form-captcha {
	margin: 15px 0;
}

/* WooCommerce */
.woocommerce .dla-captcha-field {
	margin: 15px 0;
}

/* WPForms */
.wpforms-field .dla-captcha-field {
	margin: 10px 0;
}

/* CF7 */
.wpcf7-form .dla-captcha-field {
	margin: 15px 0;
}

/* ========================
   Responsive
   ======================== */

@media (max-width: 480px) {
	.dla-captcha-question-wrap {
		padding: 8px 10px;
	}

	.dla-captcha-question {
		font-size: 14px;
	}

	.dla-captcha-input {
		max-width: 100%;
		font-size: 16px; /* Prevent iOS zoom */
	}

	.dla-captcha-refresh {
		width: 32px;
		height: 32px;
	}
}

/* ========================
   Dark mode support
   ======================== */

@media (prefers-color-scheme: dark) {
	.dla-captcha-question-wrap {
		background: #2a2a2a;
		border-color: #444;
	}

	.dla-captcha-question {
		color: #e0e0e0;
	}

	.dla-captcha-label {
		color: #ccc;
	}

	.dla-captcha-input {
		background: #1a1a1a;
		border-color: #555;
		color: #e0e0e0;
	}

	.dla-captcha-input:focus {
		border-color: #6ab0ff;
		box-shadow: 0 0 0 3px rgba(106, 176, 255, 0.2);
	}

	.dla-captcha-refresh {
		background: #333;
		border-color: #555;
		color: #aaa;
	}

	.dla-captcha-refresh:hover {
		background: #444;
		color: #fff;
	}
}
