/* ==========================================================================
   Claims Wizard — frontend styles
   Compatible with Impreza theme. Uses CSS custom properties inherited from
   the theme where available, falling back to neutral defaults.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Status badges
   -------------------------------------------------------------------------- */

.lcw-badge {
	display: inline-block;
	padding: 0.125rem 0.5625rem;
	border-radius: 3px;
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
	vertical-align: middle;
}

.lcw-badge--permitted  { background: #d4edda; color: #155724; }
.lcw-badge--depends    { background: #fff3cd; color: #856404; }
.lcw-badge--prohibited { background: #f8d7da; color: #721c24; }

/* Quick-answer badges */

.lcw-qa-badge {
	display: inline-block;
	padding: 0.0625rem 0.4375rem;
	border-radius: 2px;
	font-size: 0.72em;
	font-weight: 600;
	white-space: nowrap;
}

.lcw-qa-badge--permitted,
.lcw-qa-badge--essential   { background: #d4edda; color: #155724; }

.lcw-qa-badge--depends,
.lcw-qa-badge--recommended,
.lcw-qa-badge--voluntary   { background: #fff3cd; color: #856404; }

.lcw-qa-badge--prohibited,
.lcw-qa-badge--depends_prohibited { background: #f8d7da; color: #721c24; }

.lcw-qa-badge--not_applicable { background: #e9ecef; color: #555; }


/* --------------------------------------------------------------------------
   Sidebar (available claims)
   -------------------------------------------------------------------------- */

.w-claims-sidebar {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.lcw-sidebar__header {
	margin-bottom: 0.75rem;
}

.lcw-sidebar__title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1em;
	margin: 0;
}

.lcw-sidebar__counter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	padding: 0 0.375rem;
	height: 22px;
	background: var( --color-primary, #4a90d9 );
	color: #fff;
	border-radius: 11px;
	font-size: 0.75em;
	font-weight: 700;
	line-height: 1;
}

/* Search input */

.lcw-sidebar__search-wrap {
	position: relative;
	margin-bottom: 0.625rem;
}

.lcw-sidebar__search {
	width: 100%;
	padding: 0.5rem 2.25rem 0.5rem 0.75rem;
	border: 1px solid var( --color-border, #ddd );
	border-radius: var( --border-radius, 4px );
	font-size: 0.9em;
	background: var( --color-input, #fff );
	color: var( --color-content, #333 );
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.lcw-sidebar__search:focus {
	outline: none;
	border-color: var( --color-primary, #4a90d9 );
	box-shadow: 0 0 0 2px color-mix( in srgb, var( --color-primary, #4a90d9 ) 20%, transparent );
}

.lcw-sidebar__search-icon {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY( -50% );
	width: 16px;
	height: 16px;
	pointer-events: none;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Claims list */

.lcw-sidebar__list-wrap {
	position: relative;
	min-height: 60px;
}

.lcw-sidebar__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 60vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.lcw-sidebar__item {
	border-bottom: 1px solid var( --color-border, #eee );
    margin-bottom: 0;
}

.lcw-sidebar__label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.25rem;
	cursor: pointer;
	transition: background 0.1s;
}

.lcw-sidebar__label:hover {
	background: color-mix( in srgb, var( --color-primary, #4a90d9 ) 6%, transparent );
}

.lcw-sidebar__checkbox {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	accent-color: var( --color-primary, #4a90d9 );
	cursor: pointer;
}

.lcw-sidebar__claim-title {
	flex: 1;
	font-size: 0.875em;
	line-height: 1.4;
}

/* Load more */

.lcw-sidebar__load-more {
	text-align: center;
	padding: 0.5rem 0;
}

.lcw-sidebar__load-more button {
	background: none;
	border: 1px solid var( --color-border, #ccc );
	border-radius: var( --border-radius, 4px );
	padding: 0.3125rem 0.875rem;
	font-size: 0.8em;
	cursor: pointer;
	color: var( --color-primary, #4a90d9 );
	transition: background 0.15s;
}

.lcw-sidebar__load-more button:hover {
	background: color-mix( in srgb, var( --color-primary, #4a90d9 ) 8%, transparent );
}

/* Spinner */

.lcw-sidebar__spinner {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: color-mix( in srgb, white 70%, transparent );
	pointer-events: none;
}

.lcw-sidebar__spinner.is-loading {
	display: flex;
	pointer-events: auto;
}

.lcw-sidebar__spinner[hidden] {
	display: none !important;
	pointer-events: none;
}

.lcw-spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid var( --color-border, #ddd );
	border-top-color: var( --color-primary, #4a90d9 );
	border-radius: 50%;
	animation: lcwSpin 0.7s linear infinite;
}

@keyframes lcwSpin {
	to { transform: rotate( 360deg ); }
}

.lcw-sidebar__no-results,
.lcw-sidebar__preview-msg {
	padding: 1rem;
	text-align: center;
	color: var( --color-meta, #888 );
	font-size: 0.875em;
	margin: 0;
}


/* --------------------------------------------------------------------------
   Selected claims panel
   -------------------------------------------------------------------------- */

.w-claims-selected {
	display: flex;
	flex-direction: column;
}

.lcw-selected__header {
	margin-bottom: 0.75rem;
}

.lcw-selected__title {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	font-size: 1em;
	margin: 0;
}

.lcw-selected__counter {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.8em;
	color: var( --color-meta, #888 );
}

.lcw-selected__empty {
	padding: 1.5rem;
	text-align: center;
	color: var( --color-meta, #888 );
	font-size: 0.9em;
	border: 2px dashed var( --color-border, #ddd );
	border-radius: var( --border-radius, 6px );
	margin: 0;
}


/* --------------------------------------------------------------------------
   Accordion items
   -------------------------------------------------------------------------- */

.lcw-accordion__item {
	border: 1px solid var( --color-border, #ddd );
	border-radius: var( --border-radius, 4px );
	margin-bottom: 0.5rem;
	overflow: hidden;
}

/* Fade-in on insert */
.lcw-accordion__item.is-entering {
	opacity: 0;
	transform: translateY( -6px );
}

.lcw-accordion__item:not( .is-entering ) {
	opacity: 1;
	transform: translateY( 0 );
	transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Fade-out on removal */
.lcw-accordion__item.is-leaving {
	animation: lcwFadeOut 0.3s ease forwards;
}

@keyframes lcwFadeOut {
	to { opacity: 0; transform: translateY( -4px ); max-height: 0; margin-bottom: 0; }
}

.lcw-accordion__header {
	display: flex;
	align-items: center;
	background: var( --color-bg-alt, #f8f9fa );
}

.lcw-accordion__toggle {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.625rem 0.75rem;
	background: none;
	border: none;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: var( --color-heading, inherit );
	transition: background 0.15s;
}

.lcw-accordion__toggle:hover {
	background: color-mix( in srgb, var( --color-primary, #4a90d9 ) 6%, transparent );
}

.lcw-accordion__toggle:focus-visible {
	outline: 2px solid var( --color-primary, #4a90d9 );
	outline-offset: -2px;
}

.lcw-accordion__toggle-title {
	flex: 1;
	font-weight: 600;
	font-size: 0.9em;
}

.lcw-accordion__chevron {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate( 45deg );
	transition: transform 0.2s;
	margin-right: 0.25rem;
    margin-top: -0.25rem;
}

[aria-expanded="true"] .lcw-accordion__chevron {
	transform: rotate( -135deg );
    margin-top: -0.25rem;
}

.lcw-accordion__remove {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.2em;
	line-height: 1;
	color: var( --color-meta, #999 );
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s;
}

.lcw-accordion__remove:hover {
	color: #e53e3e;
}

.lcw-accordion__remove:focus-visible {
	outline: 2px solid var( --color-primary, #4a90d9 );
	border-radius: 2px;
}

/* Accordion body */

.lcw-accordion__content {
	padding: 0.75rem 0.875rem;
	border-top: 1px solid var( --color-border, #ddd );
	font-size: 0.875em;
}

.lcw-accordion__categories {
	margin: 0 0 0.625rem;
	color: var( --color-meta, #777 );
	font-size: 0.85em;
}

.lcw-accordion__table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 0.625rem;
	font-size: 0.875em;
}

.lcw-accordion__table th {
	text-align: left;
	padding: 0.3125rem 0.5rem;
	background: var( --color-bg-alt, #f3f4f6 );
	border: 1px solid var( --color-border, #e2e8f0 );
	font-weight: 600;
	font-size: 0.82em;
}

.lcw-accordion__table td {
	padding: 0.375rem 0.5rem;
	border: 1px solid var( --color-border, #e2e8f0 );
	vertical-align: top;
	line-height: 1.5;
}

.lcw-accordion__footnotes {
	margin-top: 0.5rem;
	padding: 0.5rem 0.625rem;
	background: var( --color-bg-alt, #f9f9f9 );
	border-left: 3px solid var( --color-border, #ccc );
	font-size: 0.82em;
	color: var( --color-meta, #666 );
}

.lcw-selected__preview-msg {
	padding: 1rem;
	text-align: center;
	color: var( --color-meta, #888 );
	font-style: italic;
}


/* --------------------------------------------------------------------------
   Report block
   -------------------------------------------------------------------------- */

.w-claims-report {
	/* intentionally minimal — inherits from Impreza row/column layout */
}

.lcw-report__title {
	font-size: 1em;
	margin: 0 0 1rem;
}

.lcw-report__form {
	display: flex;
	flex-direction: column;
	gap: .75rem;
}

.lcw-report__fields {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem;
}

.lcw-report__field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1 1 12.5rem;
	min-width: 0;
}

.lcw-report__label {
	font-size: 0.875em;
	font-weight: 600;
}

.lcw-report__email-input,
.lcw-report__company-input {
	padding: .5rem .75rem;
	border: 1px solid var( --color-border, #ddd );
	border-radius: var( --border-radius, 4px );
	font: inherit;
	font-size: 0.9em;
	color: var( --color-content, #333 );
	background: var( --color-input, #fff );
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.lcw-report__email-input:focus,
.lcw-report__company-input:focus {
	outline: none;
	border-color: var( --color-primary, #4a90d9 );
	box-shadow: 0 0 0 2px color-mix( in srgb, var( --color-primary, #4a90d9 ) 20%, transparent );
}

.lcw-report__field--consent {
	flex-direction: row;
	align-items: center;
	flex: 1 1 100%;
}

.lcw-report__privacy-checkbox {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin-top: 0.125rem;
	accent-color: var( --color-primary, #4a90d9 );
	cursor: pointer;
}

.lcw-report__consent-label {
	font-size: 0.875em;
	font-weight: 400;
	line-height: 1.4;
	cursor: pointer;
}

.lcw-report__consent-label a {
	color: var( --color-primary, #4a90d9 );
	text-decoration: underline;
}

.lcw-report__consent-label a:hover {
	text-decoration: none;
}

.lcw-report__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .625rem;
}

.lcw-report__email-btn,
.lcw-report__pdf-btn {
	display: inline-flex;
	align-items: center;
	gap: .375rem;
	padding: .5625rem 1.125rem;
	border: none;
	border-radius: var( --border-radius, 4px );
	font: inherit;
	font-size: 0.9em;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s, background 0.15s;
}

.lcw-report__email-btn {
	background: var( --color-primary, #4a90d9 );
	color: #fff;
}

.lcw-report__pdf-btn {
	background: var( --color-bg-alt, #e9ecef );
	color: var( --color-content, #333 );
	border: 1px solid var( --color-border, #ccc );
}

.lcw-report__email-btn:hover { opacity: 0.88; }
.lcw-report__pdf-btn:hover   { background: var( --color-border, #dde ); }

.lcw-report__email-btn:focus-visible,
.lcw-report__pdf-btn:focus-visible {
	outline: 2px solid var( --color-primary, #4a90d9 );
	outline-offset: 2px;
}

.lcw-report__email-btn:disabled,
.lcw-report__pdf-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.lcw-report__status {
	margin-top: 0.625rem;
	padding: 0.625rem 0.875rem;
	border-radius: var( --border-radius, 4px );
	font-size: 0.875em;
}

.lcw-report__status.is-success {
	background: #d4edda;
	color: #155724;
}

.lcw-report__status.is-error {
	background: #f8d7da;
	color: #721c24;
}


/* --------------------------------------------------------------------------
   Responsive — stack sidebar above selected panel on small screens
   -------------------------------------------------------------------------- */

@media ( max-width: 767px ) {

	.lcw-sidebar__list {
		max-height: 40vh;
	}

	.lcw-report__actions {
		flex-direction: column;
	}

	.lcw-report__email-btn,
	.lcw-report__pdf-btn {
		width: 100%;
		justify-content: center;
	}
}


/* --------------------------------------------------------------------------
   Accessibility utilities
   -------------------------------------------------------------------------- */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -0.0625rem;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}
