/**
 * PsychDirect Login Modal
 * 
 * Scoped styles for the custom login modal.
 * Uses Inter font and matches PsychDirect design system.
 */

/* ==========================================================================
   Modal Overlay
   ========================================================================== */

.pd-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, 0.5);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.pd-modal-overlay--visible {
	opacity: 1;
	visibility: visible;
}

.pd-modal-overlay[hidden] {
	display: none;
}

/* ==========================================================================
   Modal Container
   ========================================================================== */

.pd-modal {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 
		0 4px 6px -1px rgba(0, 0, 0, 0.1),
		0 10px 25px -5px rgba(0, 0, 0, 0.15),
		0 25px 50px -12px rgba(0, 0, 0, 0.1);
	transform: translateY(10px) scale(0.98);
	transition: transform 0.2s ease;
}

.pd-modal-overlay--visible .pd-modal {
	transform: translateY(0) scale(1);
}

/* ==========================================================================
   Modal Close Button
   ========================================================================== */

.pd-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #64748b;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.pd-modal__close:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.pd-modal__close:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.pd-modal__header {
	padding: 32px 32px 0;
	text-align: center;
}

.pd-modal__title {
	margin: 0 0 8px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.3;
	color: #0f172a;
}

.pd-modal__subtitle {
	margin: 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.5;
	color: #64748b;
}

/* ==========================================================================
   Alert Messages
   ========================================================================== */

.pd-modal__alert {
	margin: 20px 32px 0;
	padding: 12px 16px;
	border-radius: 10px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
}

.pd-modal__alert[hidden] {
	display: none;
}

.pd-modal__alert--error {
	background: #fef2f2;
	color: #991b1b;
}

.pd-modal__alert--success {
	background: #f0fdf4;
	color: #166534;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.pd-modal__form {
	padding: 24px 32px 32px;
}

/* Form Group */
.pd-form-group {
	margin-bottom: 20px;
}

.pd-form-group:last-of-type {
	margin-bottom: 24px;
}

/* Labels */
.pd-form-label {
	display: block;
	margin-bottom: 6px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	color: #374151;
}

/* Input Wrapper (for password toggle) */
.pd-input-wrapper {
	position: relative;
}

/* Inputs */
.pd-form-input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 16px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 48px;
	color: #0f172a;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.pd-form-input::placeholder {
	color: #94a3b8;
}

.pd-form-input:hover {
	border-color: #cbd5e1;
}

.pd-form-input:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Password input padding for toggle button */
.pd-input-wrapper .pd-form-input {
	padding-right: 48px;
}

/* Error state */
.pd-form-group--error .pd-form-input {
	border-color: #ef4444;
}

.pd-form-group--error .pd-form-input:focus {
	border-color: #ef4444;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Error message */
.pd-form-error {
	display: block;
	margin-top: 6px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: #dc2626;
}

.pd-form-error:empty {
	display: none;
}

/* ==========================================================================
   Password Toggle
   ========================================================================== */

.pd-password-toggle {
	position: absolute;
	top: 50%;
	right: 12px;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: #64748b;
	cursor: pointer;
	transition: color 0.15s ease;
}

.pd-password-toggle:hover {
	color: #0f172a;
}

.pd-password-toggle:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

/* ==========================================================================
   Remember Me / Forgot Password Row
   ========================================================================== */

.pd-form-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

/* Checkbox */
.pd-checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.pd-checkbox {
	width: 18px;
	height: 18px;
	margin: 0;
	border: 1.5px solid #cbd5e1;
	border-radius: 4px;
	background: #ffffff;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pd-checkbox:hover {
	border-color: #94a3b8;
}

.pd-checkbox:checked {
	border-color: #3b82f6;
	background-color: #3b82f6;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-position: center;
	background-repeat: no-repeat;
}

.pd-checkbox:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.pd-checkbox-text {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	color: #374151;
}

/* ==========================================================================
   Links
   ========================================================================== */

.pd-link {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	color: #3b82f6;
	text-decoration: none;
	transition: color 0.15s ease;
}

.pd-link:hover {
	color: #2563eb;
	text-decoration: underline;
}

.pd-link--subtle {
	font-weight: 400;
	color: #64748b;
}

.pd-link--subtle:hover {
	color: #3b82f6;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.pd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 48px;
	padding: 0 24px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.pd-btn:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.pd-btn:active {
	transform: scale(0.98);
}

.pd-btn:disabled {
	cursor: not-allowed;
	opacity: 0.7;
}

/* Primary Button */
.pd-btn--primary {
	background: #3b82f6;
	color: #ffffff;
}

.pd-btn--primary:hover:not(:disabled) {
	background: #2563eb;
}

.pd-btn--primary:active:not(:disabled) {
	background: #1d4ed8;
}

/* Full Width */
.pd-btn--full {
	width: 100%;
}

/* Loading State */
.pd-btn--loading {
	pointer-events: none;
}

.pd-btn__text,
.pd-btn__spinner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.pd-btn__spinner[hidden] {
	display: none;
}

/* Spinner Animation */
.pd-spinner {
	animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* ==========================================================================
   Modal Footer
   ========================================================================== */

.pd-modal__footer {
	margin: 0;
	padding: 20px 32px 28px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
	color: #64748b;
	background: #f8fafc;
	border-top: 1px solid #f1f5f9;
	border-radius: 0 0 16px 16px;
}

/* ==========================================================================
   Header Login Button
   ========================================================================== */

.pd-nav-login-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	padding: 0 16px;
	margin-left: 12px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	color: #3b82f6;
	text-decoration: none;
	background: transparent;
	border: 1.5px solid #3b82f6;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.pd-nav-login-btn:hover {
	background: #3b82f6;
	color: #ffffff;
}

/* Homepage variant (light) */
body.home .site-header--home-overlay .pd-nav-login-btn {
	color: #ffffff;
	border-color: rgba(255, 255, 255, 0.6);
}

body.home .site-header--home-overlay .pd-nav-login-btn:hover {
	background: rgba(255, 255, 255, 0.15);
	border-color: #ffffff;
	color: #ffffff;
}

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

@media (max-width: 480px) {
	.pd-modal-overlay {
		padding: 0;
		align-items: flex-end;
	}

	.pd-modal {
		max-width: 100%;
		max-height: 90vh;
		border-radius: 20px 20px 0 0;
		transform: translateY(20px);
	}

	.pd-modal-overlay--visible .pd-modal {
		transform: translateY(0);
	}

	.pd-modal__header {
		padding: 28px 24px 0;
	}

	.pd-modal__alert {
		margin: 16px 24px 0;
	}

	.pd-modal__form {
		padding: 20px 24px 28px;
	}

	.pd-modal__footer {
		padding: 16px 24px 24px;
	}

	.pd-form-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
}
