/**
 * WordPress Certificate Plugin — Public Styles
 * Modern, clean design with #23525C brand color
 * @package WordPressCertificatePlugin
 */

:root {
	--wcp-primary: #23525C;
	--wcp-primary-hover: #1a3f47;
	--wcp-primary-light: #e8f4f6;
	--wcp-primary-lighter: #f0f9fa;
	--wcp-text: #1e293b;
	--wcp-text-muted: #64748b;
	--wcp-border: #e2e8f0;
	--wcp-success: #059669;
	--wcp-error: #dc2626;
	--wcp-radius: 12px;
}

/* ── Wrapper ──────────────────────────────────────────────────────── */

.wcp-certificate-search {
	max-width: 720px;
	margin: 2em auto;
	padding: 0 16px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	box-sizing: border-box;
}

/* ── Formulário ───────────────────────────────────────────────────── */

.wcp-search-form {
	background: #fff;
	border: 1px solid var(--wcp-border);
	border-radius: var(--wcp-radius);
	padding: 36px 32px;
	box-shadow: 0 4px 24px rgba(35,82,92,0.08);
}

.wcp-form-group label {
	display: block;
	font-size: 16px;
	font-weight: 600;
	color: var(--wcp-text);
	margin-bottom: 14px;
}

.wcp-input-wrapper {
	display: flex;
	gap: 12px;
	align-items: stretch;
}

.wcp-cpf-input {
	flex: 1;
	height: 52px;
	padding: 0 18px;
	font-size: 20px;
	font-weight: 500;
	letter-spacing: 0.06em;
	border: 2px solid var(--wcp-border);
	border-radius: 10px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
	color: var(--wcp-text);
}

.wcp-cpf-input:focus {
	border-color: var(--wcp-primary);
	box-shadow: 0 0 0 4px rgba(35,82,92,0.12);
}

.wcp-cpf-input::placeholder {
	color: #94a3b8;
	letter-spacing: 0.1em;
	font-weight: 400;
}

.wcp-search-button {
	height: 52px;
	padding: 0 32px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	background: var(--wcp-primary);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
	white-space: nowrap;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wcp-search-button:hover {
	background: var(--wcp-primary-hover);
	box-shadow: 0 4px 12px rgba(35,82,92,0.3);
}

.wcp-search-button:active {
	transform: scale(0.97);
}

.wcp-search-button:disabled {
	background: #93b5ba;
	cursor: not-allowed;
	box-shadow: none;
}

.wcp-field-error {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	color: var(--wcp-error);
	min-height: 18px;
}

/* ── Loading ──────────────────────────────────────────────────────── */

.wcp-loading {
	display: none;
	align-items: center;
	gap: 12px;
	padding: 20px 0;
	color: var(--wcp-text-muted);
	font-size: 14px;
}

.wcp-loading.is-visible {
	display: flex;
}

.wcp-spinner {
	display: inline-block;
	width: 22px;
	height: 22px;
	border: 3px solid var(--wcp-border);
	border-top-color: var(--wcp-primary);
	border-radius: 50%;
	animation: wcp-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes wcp-spin {
	to { transform: rotate(360deg); }
}

/* ── Mensagens ────────────────────────────────────────────────────── */

.wcp-message {
	display: none;
	padding: 16px 20px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.5;
	margin-top: 16px;
}

.wcp-message.wcp-message--error,
.wcp-message.wcp-message--info,
.wcp-message.wcp-message--success {
	display: block;
}

.wcp-message--error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
}

.wcp-message--info {
	background: var(--wcp-primary-lighter);
	border: 1px solid #b2d8de;
	color: var(--wcp-primary);
}

.wcp-message--success {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: var(--wcp-success);
}

/* ── Resultados ───────────────────────────────────────────────────── */

.wcp-results-heading {
	font-size: 14px;
	font-weight: 600;
	color: var(--wcp-text-muted);
	margin: 24px 0 16px;
	padding-bottom: 12px;
	border-bottom: 2px solid var(--wcp-border);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.wcp-certificate-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ── Card do certificado ──────────────────────────────────────────── */

.wcp-certificate-item {
	background: #fff;
	border: 1px solid var(--wcp-border);
	border-radius: var(--wcp-radius);
	padding: 24px;
	box-shadow: 0 2px 12px rgba(35,82,92,0.06);
	transition: box-shadow 0.2s, transform 0.15s;
	position: relative;
	overflow: hidden;
}

.wcp-certificate-item::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--wcp-primary);
	border-radius: 4px 0 0 4px;
}

.wcp-certificate-item:hover {
	box-shadow: 0 6px 24px rgba(35,82,92,0.12);
	transform: translateY(-2px);
}

.wcp-cert-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.wcp-course-name {
	font-size: 18px;
	font-weight: 700;
	color: var(--wcp-text);
	line-height: 1.3;
}

.wcp-cert-badge {
	flex-shrink: 0;
	padding: 4px 10px;
	background: var(--wcp-primary-light);
	color: var(--wcp-primary);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-radius: 20px;
}

.wcp-cert-details {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px;
	margin-bottom: 18px;
}

.wcp-detail-item {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wcp-detail-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--wcp-text-muted);
}

.wcp-detail-value {
	font-size: 14px;
	font-weight: 500;
	color: var(--wcp-text);
}

.wcp-cert-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

/* ── Botão download ───────────────────────────────────────────────── */

.wcp-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	font-size: 14px;
	font-weight: 700;
	color: #fff !important;
	background: var(--wcp-primary);
	border: none;
	border-radius: 8px;
	text-decoration: none !important;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.wcp-download-btn:hover {
	background: var(--wcp-primary-hover);
	color: #fff !important;
	box-shadow: 0 4px 12px rgba(35,82,92,0.3);
}

.wcp-download-btn:active {
	transform: scale(0.97);
}

.wcp-download-btn:disabled,
.wcp-download-btn.wcp-loading-btn {
	opacity: 0.6;
	cursor: not-allowed;
	pointer-events: none;
	box-shadow: none;
}

.wcp-download-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
	flex-shrink: 0;
}

/* ── Spinner no botão ─────────────────────────────────────────────── */

.wcp-btn-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wcp-spin 0.7s linear infinite;
}

/* ── Erro inline ──────────────────────────────────────────────────── */

.wcp-cert-error {
	margin-top: 12px;
	font-size: 12px;
	color: var(--wcp-error);
	background: #fef2f2;
	border-radius: 6px;
	padding: 8px 12px;
	border: 1px solid #fecaca;
}

/* ── Notificações Públicas ─────────────────────────────────────────── */

@keyframes wcp-notification-fade-in {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wcp-public-notification {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 18px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.5;
	margin-top: 16px;
	animation: wcp-notification-fade-in 0.3s ease-out;
}

.wcp-public-notification__icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}

.wcp-public-notification__message {
	flex: 1;
	font-weight: 500;
}

/* Success: check icon, green color, light green background */
/* Text #166534 on #ecfdf5 → contrast ~7.5:1 ✓ */
.wcp-public-notification--success {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #166534;
}

.wcp-public-notification--success .wcp-public-notification__icon {
	color: #15803d;
}

/* Error: X icon, red color, light red background */
/* Text #991b1b on #fef2f2 → contrast ~7.0:1 ✓ */
.wcp-public-notification--error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.wcp-public-notification--error .wcp-public-notification__icon {
	color: #b91c1c;
}

/* Info: "i" icon, blue color, light blue background */
/* Text #1e40af on #eff6ff → contrast ~7.8:1 ✓ */
.wcp-public-notification--info {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.wcp-public-notification--info .wcp-public-notification__icon {
	color: #1d4ed8;
}

/* ── Responsivo ───────────────────────────────────────────────────── */

@media ( max-width: 540px ) {
	.wcp-search-form {
		padding: 24px 18px;
	}

	.wcp-input-wrapper {
		flex-direction: column;
	}

	.wcp-search-button {
		width: 100%;
		height: 48px;
	}

	.wcp-certificate-item {
		padding: 18px;
	}

	.wcp-cert-header {
		flex-direction: column;
		gap: 8px;
	}

	.wcp-cert-details {
		grid-template-columns: 1fr 1fr;
	}

	.wcp-cert-footer {
		justify-content: stretch;
	}

	.wcp-download-btn {
		width: 100%;
		justify-content: center;
	}
}
