/**
 * Virtual Conference Modal System - Styles
 *
 * Provides consistent styling for all modal dialogs across the plugin.
 *
 * @package VirtualConference
 * @since 3.0.0
 */

/* Modal Base Styles */
.vcon-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 100000; /* Below WordPress media modal (160000) */
	display: none;
	align-items: center !important;
	justify-content: center !important;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.vcon-modal.vcon-modal-open {
	display: flex !important;
	opacity: 1 !important;
	pointer-events: auto;
}

/* Prevent body scroll when modal is open */
body.vcon-modal-active {
	overflow: hidden;
}

/* Modal Overlay */
.vcon-modal-overlay {
	display: none !important;
}

@keyframes vcon-modal-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Modal Container */
.vcon-modal-container {
	position: relative;
	max-width: 600px;
	max-width: var(--vcon--custom--modal-max-width, 600px);
	width: 90%;
	max-height: 90vh;
	background: #fff !important;
	background: var(--vcon--custom--modal-background, #fff) !important;
	border: 1px solid #e2e8f0;
	border-color: var(--vcon--custom--modal-border-color, #e2e8f0);
	border-radius: 8px;
	border-radius: var(--vcon--custom--modal-border-radius, 8px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	box-shadow: var(--vcon--custom--modal-shadow, 0 10px 40px rgba(0, 0, 0, 0.3));
	overflow: hidden;
	display: flex !important;
	flex-direction: column;
	animation: vcon-modal-slide-up 0.3s ease;
	z-index: 1000;
}

@keyframes vcon-modal-slide-up {
	from {
		transform: translateY(50px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Modal Header */
.vcon-modal-header {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 1.5rem 2rem;
	border-bottom: 1px solid #e0e0e0;
	border-bottom-color: var(--vcon--custom--modal-border-color, #e0e0e0);
	background: #f9f9f9;
	background: var(--vcon--custom--modal-background, #f9f9f9);
	visibility: visible !important;
}

.vcon-modal-title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
	color: #1e1e1e;
	color: var(--vcon--custom--modal-title-color, #1e1e1e);
}

.vcon-modal-close {
	background: none;
	border: none;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #646970;
	color: var(--vcon--custom--modal-text-color, #646970);
	border-radius: 4px;
	border-radius: var(--vcon--custom--button-border-radius, 4px);
	transition: all 0.2s ease;
}

.vcon-modal-close:hover {
	background: #e0e0e0;
	color: #1e1e1e;
}

.vcon-modal-close:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Modal Body */
.vcon-modal-body {
	padding: 2rem !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	flex: 1 !important;
	display: block !important;
	visibility: visible !important;
	box-sizing: border-box;
}

.vcon-modal-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1.5rem;
	color: #646970;
	color: var(--vcon--custom--modal-text-color, #646970);
}

.vcon-modal-icon svg {
	width: 64px;
	height: 64px;
}

.vcon-modal-icon-warning {
	color: #d63638;
	color: var(--vcon--custom--error-color, #d63638);
}

.vcon-modal-message {
	text-align: center;
	font-size: 1rem;
	line-height: 1.6;
	color: #646970;
	color: var(--vcon--custom--modal-text-color, #646970);
	margin: 0 0 1.5rem;
}

.vcon-modal-description {
	font-size: 0.9375rem;
	line-height: 1.6;
	color: #646970;
	color: var(--vcon--custom--modal-text-color, #646970);
	margin: 0 0 1rem;
}

.vcon-modal-description strong {
	color: #1e1e1e;
	color: var(--vcon--custom--modal-title-color, #1e1e1e);
}

.vcon-modal-actions {
	display: flex;
	gap: 1rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 1.5rem;
}

/* Modal Footer */
.vcon-modal-footer {
	padding: 1.5rem 2rem;
	border-top: 1px solid #e0e0e0;
	border-top-color: var(--vcon--custom--modal-border-color, #e0e0e0);
	background: #f9f9f9;
	background: var(--vcon--custom--modal-background, #f9f9f9);
	display: none;
	justify-content: flex-end;
	gap: 1rem;
}

.vcon-modal-footer:not(:empty) {
	display: flex;
}

/* Buttons */
.vcon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 1.5rem;
	border: 1px solid;
	border-radius: 4px;
	border-radius: var(--vcon--custom--button-border-radius, 4px);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.vcon-button-primary {
	background: #2271b1;
	background: var(--vcon--custom--primary-button-color, #2271b1);
	border-color: #2271b1;
	border-color: var(--vcon--custom--primary-button-color, #2271b1);
	color: #fff;
}

.vcon-button-primary:hover {
	background: #135e96;
	background: var(--vcon--custom--primary-button-hover, #135e96);
	border-color: #135e96;
	border-color: var(--vcon--custom--primary-button-hover, #135e96);
	color: #fff;
}

.vcon-button-primary:focus {
	outline: 2px solid #2271b1;
	outline: 2px solid var(--vcon--custom--primary-button-color, #2271b1);
	outline-offset: 2px;
}

.vcon-button-secondary {
	background: #fff;
	background: var(--vcon--custom--modal-background, #fff);
	border-color: #2271b1;
	border-color: var(--vcon--custom--primary-button-color, #2271b1);
	color: #2271b1;
	color: var(--vcon--custom--primary-button-color, #2271b1);
}

.vcon-button-secondary:hover {
	background: #f6f7f7;
	color: #135e96;
	color: var(--vcon--custom--primary-button-hover, #135e96);
	border-color: #135e96;
	border-color: var(--vcon--custom--primary-button-hover, #135e96);
}

.vcon-button-secondary:focus {
	outline: 2px solid #2271b1;
	outline: 2px solid var(--vcon--custom--primary-button-color, #2271b1);
	outline-offset: 2px;
}

.vcon-button-danger {
	background: #d63638;
	background: var(--vcon--custom--error-color, #d63638);
	border-color: #d63638;
	border-color: var(--vcon--custom--error-color, #d63638);
	color: #fff;
}

.vcon-button-danger:hover {
	background: #b32d2e;
	border-color: #b32d2e;
	color: #fff;
}

.vcon-button-danger:focus {
	outline: 2px solid #d63638;
	outline: 2px solid var(--vcon--custom--error-color, #d63638);
	outline-offset: 2px;
}

/* Link Button */
.vcon-link-button {
	background: none;
	border: none;
	color: #2271b1;
	color: var(--vcon--custom--primary-button-color, #2271b1);
	text-decoration: underline;
	cursor: pointer;
	font-size: 0.9375rem;
	padding: 0;
	transition: color 0.2s ease;
}

.vcon-link-button:hover {
	color: #135e96;
	color: var(--vcon--custom--primary-button-hover, #135e96);
}

.vcon-link-button:focus {
	outline: 2px solid #2271b1;
	outline: 2px solid var(--vcon--custom--primary-button-color, #2271b1);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Form Styles within Modals */
.vcon-modal-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	text-align: left;
	box-sizing: border-box;
	width: 100%;
}

.vcon-modal-form *,
.vcon-modal-form *::before,
.vcon-modal-form *::after {
	box-sizing: border-box;
}

.vcon-form-field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	box-sizing: border-box;
	width: 100%;
}

.vcon-modal-body label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
	color: #1e1e1e;
	color: var(--vcon--custom--modal-title-color, #1e1e1e);
	font-size: 0.9375rem;
}

.vcon-modal-body label .required {
	color: #d63638;
	color: var(--vcon--custom--error-color, #d63638);
}

.vcon-modal-body input[type="text"],
.vcon-modal-body input[type="email"],
.vcon-modal-body input[type="password"],
.vcon-modal-body textarea,
.vcon-modal-body select {
	width: 100%;
	max-width: 100%;
	padding: 0.75rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1rem;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.vcon-modal-body input[type="text"]:focus,
.vcon-modal-body input[type="email"]:focus,
.vcon-modal-body input[type="password"]:focus,
.vcon-modal-body textarea:focus,
.vcon-modal-body select:focus {
	outline: none;
	border-color: #2271b1;
	border-color: var(--vcon--custom--primary-button-color, #2271b1);
	box-shadow: 0 0 0 1px #2271b1;
	box-shadow: 0 0 0 1px var(--vcon--custom--primary-button-color, #2271b1);
}

.vcon-modal-body textarea {
	min-height: 100px;
	resize: vertical;
}

.vcon-field-help {
	display: block;
	font-size: 0.8125rem;
	color: #646970;
	color: var(--vcon--custom--modal-text-color, #646970);
	margin-top: 0.25rem;
}

.vcon-modal-form .vcon-modal-actions {
	margin-top: 0.5rem;
}

/* Error Messages */
.vcon-modal-error {
	padding: 0.75rem 1rem;
	background: #fcf0f1;
	border: 1px solid #f0c0c0;
	border-radius: 4px;
	border-radius: var(--vcon--custom--button-border-radius, 4px);
	color: #d63638;
	color: var(--vcon--custom--error-color, #d63638);
	margin-bottom: 1rem;
}

/* Success Messages */
.vcon-modal-success {
	padding: 0.75rem 1rem;
	background: #d4f4dd;
	border: 1px solid #a7e6b4;
	border-radius: 4px;
	border-radius: var(--vcon--custom--button-border-radius, 4px);
	color: #1e4620;
	margin-bottom: 1rem;
}

/* Loading State */
.vcon-modal-loading {
	position: relative;
	pointer-events: none;
	opacity: 0.6;
}

.vcon-modal-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid #2271b1;
	border: 3px solid var(--vcon--custom--primary-button-color, #2271b1);
	border-top-color: transparent;
	border-radius: 50%;
	animation: vcon-modal-spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
	.vcon-modal-container {
		width: 95%;
		max-height: 95vh;
	}

	.vcon-modal-header,
	.vcon-modal-body,
	.vcon-modal-footer {
		padding: 1.25rem 1.5rem;
	}

	.vcon-modal-title {
		font-size: 1.25rem;
	}

	.vcon-modal-actions {
		flex-direction: column;
	}

	.vcon-button {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.vcon-modal-header,
	.vcon-modal-body,
	.vcon-modal-footer {
		padding: 1rem;
	}

	.vcon-modal-title {
		font-size: 1.125rem;
	}

	.vcon-modal-icon svg {
		width: 48px;
		height: 48px;
	}
}

/* Accessibility */
.vcon-modal[aria-hidden="true"] {
	display: none;
}

/* Ensure keyboard focus is visible */
.vcon-modal *:focus {
	outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.vcon-modal-overlay {
		background: rgba(0, 0, 0, 0.9);
	}

	.vcon-modal-container {
		border: 2px solid currentColor;
	}
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
	.vcon-modal,
	.vcon-modal-overlay,
	.vcon-modal-container,
	.vcon-button {
		animation: none;
		transition: none;
	}
}
