/**
 * RESUSMED Feedback Widget – CSS
 * Isolated with .rmfd- prefix. No external dependencies.
 *
 * @package RMFD
 */

/* ============================================================
   Variables
   ============================================================ */
:root {
	--rmfd-navy:        #0B1F3A;
	--rmfd-navy-light:  #123A63;
	--rmfd-white:       #FFFFFF;
	--rmfd-bg:          #F7F9FC;
	--rmfd-text:        #1A2A3A;
	--rmfd-text-muted:  #5B677A;
	--rmfd-border:      #D9E2EC;
	--rmfd-green:       #1E8E5A;
	--rmfd-red:         #B42318;
	--rmfd-radius:      12px;
	--rmfd-shadow:      0 8px 32px rgba(11, 31, 58, 0.18), 0 2px 8px rgba(11, 31, 58, 0.10);
	--rmfd-trigger-size: 52px;
}

/* ============================================================
   Widget container
   ============================================================ */
.rmfd-widget {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--rmfd-text);
}

/* ============================================================
   Trigger button
   ============================================================ */
.rmfd-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--rmfd-trigger-size);
	height: var(--rmfd-trigger-size);
	min-width: var(--rmfd-trigger-size);
	min-height: var(--rmfd-trigger-size);
	max-width: var(--rmfd-trigger-size);
	max-height: var(--rmfd-trigger-size);
	padding: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rmfd-white);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(11, 31, 58, 0.30);
	transition: transform 0.15s ease, box-shadow 0.2s ease;
	outline: none;
	line-height: 0;
	overflow: visible;
	-webkit-appearance: none;
	appearance: none;
}

.rmfd-trigger:hover {
	background: transparent;
	transform: scale(1.07);
	box-shadow: 0 6px 20px rgba(11, 31, 58, 0.38);
}

.rmfd-trigger-icon {
	display: block;
	width: var(--rmfd-trigger-size);
	height: var(--rmfd-trigger-size);
	max-width: none;
	border-radius: 50%;
	object-fit: contain;
	pointer-events: none;
	user-select: none;
}

.rmfd-trigger:focus-visible {
	outline: 3px solid var(--rmfd-navy-light);
	outline-offset: 3px;
}

/* ============================================================
   Panel
   ============================================================ */
.rmfd-panel {
	position: absolute;
	bottom: calc(var(--rmfd-trigger-size) + 12px);
	right: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	background: var(--rmfd-white);
	border-radius: var(--rmfd-radius);
	box-shadow: var(--rmfd-shadow);
	border: 1px solid var(--rmfd-border);
	overflow: hidden;
	animation: rmfd-slide-in 0.18s ease;
}

@keyframes rmfd-slide-in {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Panel header
   ============================================================ */
.rmfd-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	background: var(--rmfd-navy);
	color: var(--rmfd-white);
}

.rmfd-panel-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.rmfd-close {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: rgba(255,255,255,0.75);
	cursor: pointer;
	padding: 4px;
	border-radius: 6px;
	transition: color 0.15s, background 0.15s;
	line-height: 1;
}

.rmfd-close:hover {
	color: var(--rmfd-white);
	background: rgba(255,255,255,0.12);
}

.rmfd-close:focus-visible {
	outline: 2px solid rgba(255,255,255,0.6);
	outline-offset: 2px;
}

/* ============================================================
   Panel body
   ============================================================ */
.rmfd-panel-body {
	padding: 18px;
	background: var(--rmfd-bg);
}

.rmfd-description {
	margin: 0 0 14px;
	font-size: 13px;
	color: var(--rmfd-text-muted);
	line-height: 1.55;
}

/* ============================================================
   Textarea
   ============================================================ */
.rmfd-textarea {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1.5px solid var(--rmfd-border);
	border-radius: 8px;
	background: var(--rmfd-white);
	color: var(--rmfd-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	resize: vertical;
	min-height: 110px;
	transition: border-color 0.15s;
	outline: none;
}

.rmfd-textarea:focus {
	border-color: var(--rmfd-navy-light);
	box-shadow: 0 0 0 3px rgba(18, 58, 99, 0.12);
}

.rmfd-textarea::placeholder {
	color: #9AAABB;
}

/* ============================================================
   Privacy note
   ============================================================ */
.rmfd-privacy-note {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 8px 0 14px;
	font-size: 11.5px;
	color: var(--rmfd-text-muted);
}

.rmfd-privacy-note svg {
	flex-shrink: 0;
	color: var(--rmfd-navy-light);
}

/* ============================================================
   Submit button
   ============================================================ */
.rmfd-submit-btn {
	display: block;
	width: 100%;
	padding: 11px 16px;
	background: var(--rmfd-navy);
	color: var(--rmfd-white);
	border: none;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
	letter-spacing: 0.02em;
}

.rmfd-submit-btn:hover {
	background: var(--rmfd-navy-light);
}

.rmfd-submit-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.rmfd-submit-btn:focus-visible {
	outline: 3px solid var(--rmfd-navy-light);
	outline-offset: 2px;
}

/* ============================================================
   Success state
   ============================================================ */
.rmfd-success {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 24px 16px;
	text-align: center;
	color: var(--rmfd-green);
}

.rmfd-success svg {
	color: var(--rmfd-green);
}

.rmfd-success p {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--rmfd-text);
}

/* ============================================================
   Error state
   ============================================================ */
.rmfd-error {
	margin-top: 10px;
	padding: 10px 12px;
	background: #FEF3F2;
	border: 1px solid #FECDCA;
	border-radius: 7px;
	color: var(--rmfd-red);
	font-size: 13px;
	line-height: 1.4;
}

/* ============================================================
   Responsive
   ============================================================ */
@media ( max-width: 480px ) {
	.rmfd-widget {
		bottom: 16px;
		right: 12px;
	}

	.rmfd-panel {
		width: calc(100vw - 24px);
		right: -12px;
		bottom: calc(var(--rmfd-trigger-size) + 10px);
	}
}


/* ============================================================
   Mobile / theme conflict hardening
   ============================================================
   Some mobile themes/builders apply broad rules to fixed widgets or
   buttons/images in the footer. These scoped overrides keep the RESUSMED
   feedback trigger visible on Android/iOS and preserve the 52 x 52 px size.
*/
body #rmfd-widget.rmfd-widget {
	position: fixed !important;
	right: calc(24px + env(safe-area-inset-right, 0px)) !important;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
	left: auto !important;
	top: auto !important;
	z-index: 2147483000 !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	transform: none !important;
	contain: layout style;
}

body #rmfd-widget.rmfd-widget #rmfd-trigger.rmfd-trigger {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: var(--rmfd-trigger-size) !important;
	height: var(--rmfd-trigger-size) !important;
	min-width: var(--rmfd-trigger-size) !important;
	min-height: var(--rmfd-trigger-size) !important;
	max-width: var(--rmfd-trigger-size) !important;
	max-height: var(--rmfd-trigger-size) !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	overflow: visible !important;
}

body #rmfd-widget.rmfd-widget #rmfd-trigger .rmfd-trigger-icon {
	display: block !important;
	width: var(--rmfd-trigger-size) !important;
	height: var(--rmfd-trigger-size) !important;
	min-width: var(--rmfd-trigger-size) !important;
	min-height: var(--rmfd-trigger-size) !important;
	max-width: var(--rmfd-trigger-size) !important;
	max-height: var(--rmfd-trigger-size) !important;
	margin: 0 !important;
	padding: 0 !important;
	visibility: visible !important;
	opacity: 1 !important;
}

@media ( max-width: 782px ) {
	body #rmfd-widget.rmfd-widget {
		right: calc(14px + env(safe-area-inset-right, 0px)) !important;
		bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
	}

	body #rmfd-widget.rmfd-widget .rmfd-panel {
		position: absolute !important;
		width: calc(100vw - 28px) !important;
		max-width: calc(100vw - 28px) !important;
		right: calc(-1 * (14px + env(safe-area-inset-right, 0px))) !important;
		bottom: calc(var(--rmfd-trigger-size) + 12px) !important;
	}
}
