/**
 * 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
 * RG-WEBDEV 2026-03-15: High specificity selectors to override theme reset.css
 *
 * @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 */
dialog.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 */
dialog.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 */
dialog.dresium-photo-source-modal .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;
}

dialog.dresium-photo-source-modal .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;
}

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

/* High specificity to override theme reset.css button styles */
dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option {
	display: flex !important;
	align-items: center !important;
	gap: 16px !important;
	width: 100% !important;
	padding: 16px !important;
	background: #f8f9fa !important;
	background-color: #f8f9fa !important;
	border: 2px solid transparent !important;
	border-radius: 12px !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	text-align: left !important;
	outline: unset !important;
	/* iOS fix: explicit colors */
	color: inherit !important;
	/* iOS: disable default tap highlight to use custom active state */
	-webkit-tap-highlight-color: transparent !important;
	/* Override reset.css */
	-webkit-appearance: none !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	white-space: normal !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	user-select: none !important;
}

dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:hover {
	background: #f0f1f3 !important;
	border-color: #e0e0e0 !important;
}

dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:active { 
/* dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.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 */
dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:active .dresium-photo-source-modal__option-title,
dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:active .dresium-photo-source-modal__option-desc,
dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:focus .dresium-photo-source-modal__option-title,
dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:focus .dresium-photo-source-modal__option-desc {
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
}

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

dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:disabled {
	opacity: 0.5;
	cursor: not-allowed !important;
}

dialog.dresium-photo-source-modal .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;
}

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

dialog.dresium-photo-source-modal .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;
}

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

/* Cancel button - high specificity to override reset.css */
dialog.dresium-photo-source-modal button.dresium-photo-source-modal__cancel {
	width: 100% !important;
	padding: 14px !important;
	background: transparent !important;
	border: none !important;
	border-radius: 12px !important;
	font-size: 16px !important;
	font-weight: 500 !important;
	color: #666666 !important;
	cursor: pointer !important;
	transition: background 0.2s ease !important;
	/* iOS fix: force color */
	-webkit-text-fill-color: #666666 !important;
	/* Override reset.css */
	-webkit-appearance: none !important;
	text-align: center !important;
}

dialog.dresium-photo-source-modal button.dresium-photo-source-modal__cancel:hover {
	background: #f0f1f3 !important;
}

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

/* RG-WEBDEV 2026-03-15: Use native <dialog> element to appear in browser's top layer */
dialog.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 */
dialog.dresium-camera-modal::backdrop {
	background: #000;
}

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

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

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

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

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

/* Camera Controls */
dialog.dresium-camera-modal .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%);
}

/* Camera buttons - high specificity to override reset.css */
dialog.dresium-camera-modal button.dresium-camera-modal__btn {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: transparent !important;
	border: none !important;
	color: #fff !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	padding: 0 !important;
	/* Override reset.css */
	-webkit-appearance: none !important;
}

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

dialog.dresium-camera-modal button.dresium-camera-modal__btn--cancel:hover,
dialog.dresium-camera-modal button.dresium-camera-modal__btn--switch:hover {
	background: rgba(255, 255, 255, 0.3) !important;
}

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

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

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

/* Preview Controls */
dialog.dresium-camera-modal .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%);
}

dialog.dresium-camera-modal button.dresium-camera-modal__btn--retake,
dialog.dresium-camera-modal button.dresium-camera-modal__btn--use {
	padding: 14px 28px !important;
	border-radius: 25px !important;
	font-size: 16px !important;
	font-weight: 600 !important;
	border: none !important;
	/* Override reset.css */
	-webkit-appearance: none !important;
}

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

dialog.dresium-camera-modal button.dresium-camera-modal__btn--retake:hover {
	background: rgba(255, 255, 255, 0.3) !important;
}

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

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

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

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

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

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

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

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

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

	dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option {
		background: #2a2a2a !important;
		background-color: #2a2a2a !important;
	}

	dialog.dresium-photo-source-modal .dresium-photo-source-modal__options button.dresium-photo-source-modal__option:hover {
		background: #333333 !important;
		background-color: #333333 !important;
		border-color: #444444 !important;
	}

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

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

	dialog.dresium-photo-source-modal button.dresium-photo-source-modal__cancel {
		color: #aaaaaa !important;
		-webkit-text-fill-color: #aaaaaa !important;
	}

	dialog.dresium-photo-source-modal button.dresium-photo-source-modal__cancel:hover {
		background: #2a2a2a !important;
		background-color: #2a2a2a !important;
	}
}
