/**
 * Dresium Photo Source Picker Styles
 *
 * Styles for the mobile photo source picker modal and camera capture interface.
 *
 * RG-WEBDEV 2026-03-15: Created to solve Android 14/15 Chrome camera issue
 *
 * @package Dresium
 * @version 2.0.0
 */

/* ==========================================================================
   Photo Source Picker Modal
   ========================================================================== */

/* RG-WEBDEV 2026-03-15: Use native <dialog> element to appear in browser's top layer
   This ensures the picker appears above all other elements including other dialogs */
.dresium-photo-source-modal {
	/* Force light color scheme to prevent iOS dark mode interference */
	color-scheme: light;
	/* Reset default dialog styles */
	border: none;
	padding: 0;
	background: transparent;
	max-width: none;
	max-height: none;
	width: 100%;
	height: 100%;
	/* Flexbox for bottom-sheet positioning on mobile */
	display: flex;
	align-items: flex-end;
	justify-content: center;
	/* Reset text color for iOS */
	color: #1a1a1a;
}

/* Native ::backdrop pseudo-element for overlay */
.dresium-photo-source-modal::backdrop {
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* Content container - acts as the visible modal card */
.dresium-photo-source-modal__content {
	width: 100%;
	max-width: 400px;
	background: #ffffff;
	background-color: #ffffff;
	border-radius: 20px 20px 0 0;
	padding: 24px 20px;
	padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
	/* iOS Safari fix: force opaque background */
	-webkit-backdrop-filter: none;
}

.dresium-photo-source-modal__title {
	margin: 0 0 20px 0;
	font-size: 18px;
	font-weight: 600;
	color: #1a1a1a;
	text-align: center;
	/* iOS fix: force color */
	-webkit-text-fill-color: #1a1a1a;
}

.dresium-photo-source-modal__options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}

.dresium-photo-source-modal__option {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	padding: 16px;
	background: #f8f9fa;
	background-color: #f8f9fa;
	border: 2px solid transparent;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: left;
	/* iOS fix: explicit colors */
	color: inherit;
	/* iOS: disable default tap highlight to use custom active state */
	-webkit-tap-highlight-color: transparent;
}

.dresium-photo-source-modal__option:hover {
	background: #f0f1f3;
	border-color: #e0e0e0;
}

.dresium-photo-source-modal__option:active,
.dresium-photo-source-modal__option:focus {
	transform: scale(0.98);
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
	background-color: #667eea !important;
}

/* When button is active/pressed, text should be white - iOS needs !important */
.dresium-photo-source-modal__option:active .dresium-photo-source-modal__option-title,
.dresium-photo-source-modal__option:active .dresium-photo-source-modal__option-desc,
.dresium-photo-source-modal__option:focus .dresium-photo-source-modal__option-title,
.dresium-photo-source-modal__option:focus .dresium-photo-source-modal__option-desc {
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
}

.dresium-photo-source-modal__option:active .dresium-photo-source-modal__option-icon,
.dresium-photo-source-modal__option:focus .dresium-photo-source-modal__option-icon {
	background: rgba(255, 255, 255, 0.2) !important;
}

.dresium-photo-source-modal__option:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.dresium-photo-source-modal__option-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 12px;
	color: #fff;
	flex-shrink: 0;
}

.dresium-photo-source-modal__option-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dresium-photo-source-modal__option-title {
	display: block;
	font-size: 16px;
	font-weight: 600;
	color: #1a1a1a;
	/* iOS fix: force color */
	-webkit-text-fill-color: #1a1a1a;
}

.dresium-photo-source-modal__option-desc {
	display: block;
	font-size: 13px;
	color: #666666;
	/* iOS fix: force color */
	-webkit-text-fill-color: #666666;
}

.dresium-photo-source-modal__cancel {
	width: 100%;
	padding: 14px;
	background: transparent;
	border: none;
	border-radius: 12px;
	font-size: 16px;
	font-weight: 500;
	color: #666666;
	cursor: pointer;
	transition: background 0.2s ease;
	/* iOS fix: force color */
	-webkit-text-fill-color: #666666;
}

.dresium-photo-source-modal__cancel:hover {
	background: #f0f1f3;
}

/* ==========================================================================
   Camera Capture Modal
   ========================================================================== */

/* RG-WEBDEV 2026-03-15: Use native <dialog> element to appear in browser's top layer */
.dresium-camera-modal {
	/* Reset default dialog styles */
	border: none;
	padding: 0;
	margin: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	background: #000;
}

/* Hide default backdrop since camera is fullscreen */
.dresium-camera-modal::backdrop {
	background: #000;
}

.dresium-camera-modal__container {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.dresium-camera-modal__video {
	flex: 1;
	width: 100%;
	object-fit: cover;
	background: #000;
}

.dresium-camera-modal__canvas {
	display: none;
}

.dresium-camera-modal__preview {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
}

.dresium-camera-modal__preview-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Camera Controls */
.dresium-camera-modal__controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding: 20px;
	padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
	background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.dresium-camera-modal__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	transition: all 0.2s ease;
	padding: 0;
}

.dresium-camera-modal__btn--cancel,
.dresium-camera-modal__btn--switch {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
}

.dresium-camera-modal__btn--cancel:hover,
.dresium-camera-modal__btn--switch:hover {
	background: rgba(255, 255, 255, 0.3);
}

.dresium-camera-modal__btn--capture {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: #fff;
	position: relative;
}

.dresium-camera-modal__btn--capture:active {
	transform: scale(0.95);
}

.dresium-camera-modal__capture-ring {
	position: absolute;
	top: 4px;
	left: 4px;
	right: 4px;
	bottom: 4px;
	border: 3px solid #000;
	border-radius: 50%;
}

/* Preview Controls */
.dresium-camera-modal__preview-controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 20px;
	padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
	background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.dresium-camera-modal__btn--retake,
.dresium-camera-modal__btn--use {
	padding: 14px 28px;
	border-radius: 25px;
	font-size: 16px;
	font-weight: 600;
}

.dresium-camera-modal__btn--retake {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

.dresium-camera-modal__btn--retake:hover {
	background: rgba(255, 255, 255, 0.3);
}

.dresium-camera-modal__btn--use {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
}

.dresium-camera-modal__btn--use:hover {
	filter: brightness(1.1);
}

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

@media (min-width: 768px) {
	.dresium-photo-source-modal {
		align-items: center;
	}

	.dresium-photo-source-modal__content {
		border-radius: 20px;
		max-width: 420px;
	}
}

/* ==========================================================================
   Dark Mode Support (if parent has dark theme)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	.dresium-photo-source-modal {
		color-scheme: dark;
		color: #ffffff;
	}

	.dresium-photo-source-modal__content {
		background: #1a1a1a;
		background-color: #1a1a1a;
	}

	.dresium-photo-source-modal__title {
		color: #ffffff;
		-webkit-text-fill-color: #ffffff;
	}

	.dresium-photo-source-modal__option {
		background: #2a2a2a;
		background-color: #2a2a2a;
	}

	.dresium-photo-source-modal__option:hover {
		background: #333333;
		background-color: #333333;
		border-color: #444444;
	}

	.dresium-photo-source-modal__option-title {
		color: #ffffff;
		-webkit-text-fill-color: #ffffff;
	}

	.dresium-photo-source-modal__option-desc {
		color: #aaaaaa;
		-webkit-text-fill-color: #aaaaaa;
	}

	.dresium-photo-source-modal__cancel {
		color: #aaaaaa;
		-webkit-text-fill-color: #aaaaaa;
	}

	.dresium-photo-source-modal__cancel:hover {
		background: #2a2a2a;
		background-color: #2a2a2a;
	}
}
