/**
 * Household income calculator
 *
 * Everything is namespaced under .ic- and scoped to .ic-dialog so it can't
 * leak into the surrounding theme or Gravity Forms' own styles.
 */

.ic-dialog {
	--ic-ink: #1a1d1f;
	--ic-ink-muted: #55605f;
	--ic-ink-faint: #7b8482;
	--ic-line: #dfe3e3;
	--ic-line-strong: #c6cccb;
	--ic-green: #1c6b4d;
	--ic-green-dark: #14523b;
	--ic-green-tint: #f2f8f5;
	--ic-red: #c0392b;
	--ic-focus: #2563eb;
	--ic-radius: 40px;

	width: min(720px, calc(100vw - 2rem));
	max-height: min(calc(100vh - 40px));
	padding: 0;
	border: 0;
	border-radius: var(--ic-radius);
	background: #fff;
	color: var(--ic-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	box-shadow: 0 20px 50px rgba(16, 24, 32, 0.22);
	overflow: hidden;
}

.ic-dialog::backdrop {
	background: rgba(16, 24, 32, 0.5);
}

.ic-dialog[open] {
	display: flex;
	flex-direction: column;
	margin: 20px 20px 20px auto;
	min-height: calc(100dvh - 40px)
}

/* ------------------------------------------------------------------ header */

.ic-dialog__header {
	position: relative;
	/*padding: 2rem 2rem 1.25rem;*/
	padding: 28px 40px 8px 36px;
	border-bottom: 1px solid var(--ic-line);
}

.ic-dialog .ic-title {
	margin: 0 0 6px 0;
	font-weight: 700;
	line-height: 1.25;
}

.ic-dialog .ic-intro {
	margin: 0;
	max-width: 70ch;
	/*color: var(--ic-ink-muted);*/
	/*font-size: 0.9375rem;*/
}

.ic-dialog__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 40px;
	height: 40px;
	display: flex;
    justify-content: center;
    align-items: center;
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: #000000;
	color: #ffffff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.ic-dialog__close:hover {
	background: #f1f3f3;
	color: var(--ic-ink);
}

/* -------------------------------------------------------------------- body */

.ic-dialog__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 8px 20px;
	-webkit-overflow-scrolling: touch;
	background: #f9f9f9;
}

.ic-rows {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* --------------------------------------------------------------------- row */

.ic-dialog .ic-row {
	position: relative;
	margin: 0;
	padding: 12px 16px;
	border: 1px solid var(--ic-line);
	border-radius: 8px;
	background: #fff;
}

.ic-dialog .ic-accordion-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.ic-dialog .ic-accordion-content {

}

.ic-dialog .ic-row__legend {
	float: left; /* keeps the legend on its own line beside the Remove button */
	width: 100%;
	/*margin: 0 0 8px;*/
	padding: 0;
	color: #000000;
	font-size: 0.75rem;
	/*font-weight: 600;*/
	/*letter-spacing: 0.08em;*/
	text-transform: uppercase;
}

.ic-row__edit {
	padding: 6px 12px;
	border: 0;
	border-radius: 3px;
	background: #74C6FF;
	color: #ffffff;
	font-size: 14px;
	font-family: inherit;
	border-radius: 20px;
	cursor: pointer;
}

.ic-row__remove {
	padding: 6px 12px;
	border: 0;
	border-radius: 3px;
	background: var(--ic-red);
	color: #ffffff;
	font-size: 14px;
	font-family: inherit;
	border-radius: 20px;
	cursor: pointer;
}

.ic-row__remove:hover {
	text-decoration: underline;
}

.ic-row__remove[hidden] {
	display: none;
}

.ic-row__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 16px;
	clear: both;
	padding: 12px 0;
}
.ic-row__footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-top: 1px solid var(--ic-line);
	padding: 12px 0 0 0;
}

/* accordion functionality */
.ic-collapse-accordion .ic-accordion-content {
	height: 0;
	overflow: hidden;
}

/* ------------------------------------------------------------------ fields */

.ic-field {
	min-width: 0;
}

.ic-dialog .ic-field__label {
	display: block;
	margin-bottom: 0.375rem;
	/*color: var(--ic-ink);*/
	/*font-size: 0.9375rem;*/
	/*font-weight: 600;*/
}

.ic-dialog .ic-field__control {
	width: 100%;
	box-sizing: border-box;
	height: 2.75rem;
	padding: 0 0.75rem;
	border: 2px solid #000000;
	border-radius: 40px;
	background: #fff;
	color: var(--ic-ink);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.4;
}

.ic-dialog .ic-field__control::placeholder {
	color: #a8b0af;
}

.ic-dialog .ic-field__control:hover {
	border-color: var(--ic-ink-faint);
}

/* The amount input carries its own $ prefix. */
.ic-field__money {
	position: relative;
}

.ic-field__prefix {
	position: absolute;
	top: 50%;
	left: 0.75rem;
	transform: translateY(-50%);
	color: var(--ic-ink-faint);
	font-size: 1rem;
	pointer-events: none;
}

.ic-dialog .ic-field__amount {
	padding-left: 1.75rem;
}

/* Native select arrow, drawn rather than relying on the platform's. */
.ic-dialog .ic-field__frequency {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 2.25rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2355605f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 1rem;
}

/* -------------------------------------------------------- per-row subtotal */

.ic-dialog .ic-row__annual {
	margin: 0;
	padding-top: 0;
	color: var(--ic-ink-muted);
	font-size: 0.9375rem;
}

.ic-row__annual-value {
	/*color: var(--ic-ink);*/
	font-weight: 700;
}
.ic-row__footer-value-wrapper {
	display: flex;
  	justify-content: center;
  	align-items: center;
  	width: calc(50% - 8px);
}
.ic-row__annual-value-wrapper {
	padding: 2px;
	background: #ffffff;
	min-width: 84px;
	box-shadow: inset 0 0 10px 2px rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	margin-left: 4px;
	flex-grow: 1;
}
.ic-total-sources-list {
	display: flex;
  	flex-wrap: wrap;
}
.source-badge {
	background: #E6E6E6;
	font-size: 14px;
	border-radius: 4px;
	padding: 2px;
	margin: 0 2px 2px 2px;
}
/* -------------------------------------------------------------- add button */

.ic-dialog .ic-add {
	display: block;
	width: 100%;
	margin-top: 1rem;
	padding: 12px 16px;
	border: 1px dashed #000000;
	border-radius: 8px;
	background: transparent;
	color: #000000;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

.ic-dialog .ic-add:hover {
	border-color: var(--ic-green);
	background: var(--ic-green-tint);
}

/* ------------------------------------------------------------------- total */

.ic-total {
	/*margin-top: 1.5rem;*/
	padding: 16px;
	border: 1px solid var(--ic-line);
	border-radius: 8px;
	width: 100%;
	/*background: var(--ic-green-tint);*/
	display: grid;
  	grid-template-columns: repeat(2, minmax(0, 1fr));
  	gap: 8px 16px;
}

.ic-dialog .ic-total__label {
	margin: 0 0 0.5rem;
	/*color: var(--ic-green);*/
	font-size: 0.75rem;
	/*font-weight: 700;*/
	/*letter-spacing: 0.08em;*/
	text-transform: uppercase;
}
.ic-total-computed-value {
	padding: 8px;
	background: #ffffff;
	/*min-width: 84px;*/
	box-shadow: inset 0 0 10px 2px rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	margin-left: 4px;
}

.ic-dialog .ic-total__value {
	margin: 0;
	color: var(--ic-ink);
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.ic-dialog .ic-total__hint {
	margin: 0.5rem 0 0;
	color: var(--ic-ink-muted);
	font-size: 0.9375rem;
}

.ic-total__hint[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ footer */

.ic-dialog__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 12px 20px;
	border-top: 1px solid var(--ic-line);
	/*background: #fafbfb;*/
}

.ic-dialog .ic-btn {
	padding: 0.6875rem 1.25rem;
	border-radius: 40px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	width: calc(50% - 9px);
}

.ic-dialog .ic-btn--primary {
	border: 1px solid #74C6FF;
	background: #74C6FF;
	color: #fff;
}

.ic-dialog .ic-btn--primary:hover:not(:disabled) {
	border-color: var(--ic-green-dark);
	background: var(--ic-green-dark);
}

.ic-dialog .ic-btn--primary:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.ic-dialog .ic-btn--ghost {
	border: 1px solid var(--ic-line-strong);
	background: #fff;
	color: var(--ic-ink);
}

.ic-dialog .ic-btn--ghost:hover {
	border-color: var(--ic-ink-faint);
}

/* ----------------------------------------------------------- form trigger */

.ic-trigger {
	display: inline-block;
	margin-top: 0.5rem;
	padding: 0;
	border: 0;
	background: none;
	color: #1c6b4d;
	font-family: inherit;
	font-size: 0.9375rem;
	text-decoration: underline;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

.ic-trigger:hover {
	color: #14523b;
}

/* ------------------------------------------------------------------ focus */

.ic-dialog :focus-visible,
.ic-trigger:focus-visible {
	outline: 2px solid var(--ic-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ utils */

.ic-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

@keyframes colorChange {
  0% {
    background-color: #ffffff;
  }
  25% {
    background-color: #33909e;
  }
  100% {
    background-color: #ffffff;
  }
}
.gform-theme--framework .calc-option-selected {
	animation: colorChange 3s alternate;
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 640px) {
	.ic-dialog {
		width: calc(100vw - 40px);
		max-width: calc(100vw - 40px);
		max-height: calc(100dvh - 40px);
		height: calc(100dvh - 40px);
		margin: 0;
		border-radius: 25px;
	}

	.ic-dialog__header {
		padding: 1.5rem 1.25rem 1rem;
	}

	.ic-dialog__body {
		padding: 1.25rem 1.25rem 2rem;
	}

	.ic-dialog__footer {
		padding: 1rem 1.25rem;
	}

	.ic-dialog .ic-row {
		padding: 1.25rem 1rem;
	}

	.ic-row__remove {
		right: 1rem;
	}

	.ic-row__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.ic-dialog .ic-btn {
		flex: 1 1 auto;
	}

	.ic-dialog .ic-total__value {
		font-size: 2rem;
	}
}
@media screen and (max-width: 479px) {
	.ic-dialog {
    	width: calc(100vw - 20px);
    	max-width: calc(100vw - 20px);
    	max-height: calc(100dvh - 20px);
    	height: calc(100dvh - 20px);
	}
	.ic-dialog[open] {
		display: flex;
		flex-direction: column;
		margin: 10px 10px 10px auto;
		min-height: calc(100dvh - 20px)
	}
	.ic-dialog__header {
    	padding: 20px 20px 10px 20px;
  	}
  	.ic-dialog__body {
		padding: 10px;
  	}
  	.ic-dialog .ic-row {
    	padding: 10px 12px;
  	}
  	.ic-dialog .ic-field__label {
		font-size: 14px;
  	}
  	.ic-dialog .ic-row__annual {
  		font-size: 14px;
  	}
  	.ic-row__footer-value-wrapper {
		flex-direction: column;
		justify-content: flex-start;
		align-items: flex-start;
  	}
  	.ic-row__annual-value-wrapper {
  		width: 100%;
  	}
  	.ic-dialog .ic-add {
  		font-size: 14px;
  		line-height: 1.2;
  		padding: 10px;
  	}
  	.ic-total {
		grid-template-columns: minmax(0, 1fr);
  	}
  	.ic-dialog__footer {
		padding: 10px;
  	}
  	.ic-total {
  		padding: 10px;
  	}
  	.ic-dialog .ic-total__value {
		font-size: 20px;
  	}
  	.ic-dialog .ic-btn {
		font-size: 14px;
		padding: 10px 14px;
		line-height: 1;
  	}
}

/* Stop iOS Safari zooming when an input is focused. */
@media (max-width: 640px) and (-webkit-min-device-pixel-ratio: 0) {
	.ic-dialog .ic-field__control {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ic-dialog * {
		scroll-behavior: auto !important;
	}
}
