/*
 * Installment calculator styles.
 * Intentionally does not set font-family anywhere — it inherits the
 * theme's typography. Only layout, spacing, and color are defined here.
 * Colors are deliberately kept neutral (black/white-based rgba + currentColor)
 * rather than hardcoded brand hues, so the widget stays visually consistent
 * with whatever theme it's dropped into.
 */

.wis-calculator,
.wis-calculator *,
.wis-calculator *::before,
.wis-calculator *::after {
	box-sizing: border-box;
}

.wis-calculator {
	direction: rtl;
	text-align: right;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
	margin: 1.5em 0;
	width: 100%;
	overflow: hidden;
}

.wis-calculator__section {
	padding: 1.25em;
}

.wis-calculator__body > .wis-calculator__section + .wis-calculator__section {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wis-calculator__section--summary {
	background: rgba(0, 0, 0, 0.025);
}

.wis-calculator__section-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5em;
}

.wis-calculator__title {
	margin: 0 0 0.5em;
	font-size: 1.1em;
	font-weight: 700;
}

.wis-calculator__close-btn {
	display: none;
	align-items: center;
	justify-content: center;
	width: 1.75em;
	height: 1.75em;
	line-height: 1;
	border: none;
	background: transparent;
	color: inherit;
	opacity: 0.6;
	font-size: 1.3em;
	cursor: pointer;
}

.wis-calculator__close-btn:hover {
	opacity: 1;
}

/* Entry-point mode: the calculator is opened via an external "خرید اقساطی"
   button injected next to the theme's add-to-cart buttons (see calculator.js),
   so the internal enable-checkbox is redundant and the close button takes over. */
.wis-calculator--entry-mode .wis-calculator__toggle-label {
	display: none;
}

.wis-calculator--entry-mode .wis-calculator__close-btn {
	display: inline-flex;
}

.wis-installment-entry-btn {
	margin-inline-start: 0.5em;
	background-color: #2e7d32 !important;
	border-color: #2e7d32 !important;
	color: #fff !important;
}

.wis-installment-entry-btn:hover,
.wis-installment-entry-btn:focus {
	background-color: #256428 !important;
	border-color: #256428 !important;
	color: #fff !important;
}

.wis-installment-entry-btn.is-active {
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.wis-installment-entry-btn.is-disabled,
.wis-installment-entry-btn:disabled {
	background-color: #9e9e9e !important;
	border-color: #9e9e9e !important;
	cursor: not-allowed;
	opacity: 0.85;
}

.wis-installment-entry-hint {
	display: block;
	width: 100%;
	margin: 0.5em 0 0;
	font-size: 0.85em;
	color: #c0392b;
}

.wis-calculator__toggle-label {
	display: flex;
	align-items: center;
	gap: 0.5em;
	font-weight: 600;
	cursor: pointer;
}

.wis-calculator__section-label {
	display: block;
	margin-bottom: 0.6em;
	font-weight: 600;
}

.wis-calculator__down-payment-label {
	margin: 0 0 0.4em;
	font-size: 1.05em;
}

.wis-calculator__down-payment-explainer {
	margin: 0 0 0.75em;
	font-size: 0.85em;
	opacity: 0.75;
}

.wis-calculator__months-select {
	width: 100%;
	max-width: 220px;
	padding: 0.5em 0.7em;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	box-sizing: border-box;
}

.wis-calculator__months-stepper {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.wis-calculator__month-btn {
	flex: 1 1 auto;
	min-width: 4.5em;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2em;
	padding: 0.6em 0.4em;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	font-size: 0.85em;
	line-height: 1.3;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wis-calculator__month-btn:hover {
	border-color: #2e7d32;
	background: rgba(46, 125, 50, 0.08);
}

.wis-calculator__month-btn.is-active {
	border-color: #2e7d32;
	border-width: 2px;
	background: #2e7d32;
	color: #fff;
	font-weight: 700;
}

.wis-calculator__month-btn.is-active .wis-calculator__month-btn-rate {
	opacity: 0.9;
}

.wis-calculator__month-btn-label {
	font-weight: 600;
}

.wis-calculator__month-btn-rate {
	opacity: 0.7;
	font-size: 0.9em;
}

.wis-calculator__presets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin-top: 0.6em;
}

.wis-calculator__preset-btn {
	flex: 1 1 auto;
	min-width: 3.5em;
	padding: 0.4em 0.5em;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	font-size: 0.85em;
	line-height: 1.4;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wis-calculator__preset-btn:hover {
	border-color: #2e7d32;
	background: rgba(46, 125, 50, 0.08);
}

.wis-calculator__preset-btn.is-active {
	border-color: #2e7d32;
	border-width: 2px;
	background: #2e7d32;
	color: #fff;
	font-weight: 700;
}

.wis-calculator__preset-btn--custom {
	flex-basis: 100%;
}

.wis-calculator__hint {
	margin: 0.5em 0 0;
	font-size: 0.85em;
	opacity: 0.7;
}

.wis-calculator__hero {
	text-align: center;
	padding-bottom: 1em;
}

.wis-calculator__hero-label {
	display: block;
	font-size: 0.85em;
	opacity: 0.7;
	margin-bottom: 0.3em;
}

.wis-calculator__hero-value {
	display: block;
	font-size: 1.7em;
	font-weight: 700;
	line-height: 1.2;
}

.wis-calculator__summary-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.9em 1em;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	padding-top: 1em;
}

.wis-calculator__summary-item {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
}

.wis-calculator__summary-label {
	font-size: 0.8em;
	opacity: 0.7;
}

.wis-calculator__summary-value {
	font-weight: 600;
}

.wis-calculator__cash-notice {
	margin: 0;
	padding: 0.9em 1em;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.05);
	font-weight: 700;
	text-align: center;
}

.wis-calculator__variation-notice {
	margin: 0 0 1em;
	padding: 0.6em 0.8em;
	font-size: 0.85em;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.04);
	opacity: 0.85;
}

.wis-calculator__error {
	margin: 0;
	color: #c0392b;
}

.wis-calculator.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/*
 * Custom down-payment amount modal (built in JS, appended to <body> so it
 * isn't clipped by .wis-calculator's overflow:hidden).
 */
.wis-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 1em;
}

.wis-modal {
	direction: rtl;
	text-align: right;
	background: #fff;
	color: #1a1a1a;
	border-radius: 10px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	max-width: 360px;
	width: 100%;
	padding: 1.5em;
	position: relative;
	box-sizing: border-box;
}

.wis-modal *,
.wis-modal *::before,
.wis-modal *::after {
	box-sizing: border-box;
}

.wis-modal__close {
	position: absolute;
	top: 0.75em;
	left: 0.75em;
	width: 1.75em;
	height: 1.75em;
	border: none;
	background: transparent;
	font-size: 1.3em;
	line-height: 1;
	cursor: pointer;
	opacity: 0.6;
}

.wis-modal__close:hover {
	opacity: 1;
}

.wis-modal__title {
	margin: 0 0 0.75em;
	font-size: 1.05em;
	font-weight: 700;
	padding-inline-end: 1.5em;
}

.wis-modal__note {
	margin: 0 0 0.5em;
	font-size: 0.85em;
	opacity: 0.75;
}

.wis-modal__note--min {
	font-weight: 600;
	opacity: 1;
}

.wis-modal__input {
	width: 100%;
	padding: 0.6em 0.7em;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 6px;
	font-size: 1em;
	margin-top: 0.5em;
}

.wis-modal__error {
	margin: 0.6em 0 0;
	font-size: 0.85em;
	color: #c0392b;
}

.wis-modal__actions {
	display: flex;
	gap: 0.6em;
	margin-top: 1.25em;
}

.wis-modal__confirm {
	flex: 1 1 auto;
	background-color: #2e7d32;
	border-color: #2e7d32;
	color: #fff;
}

.wis-modal__confirm:hover {
	background-color: #256428;
	border-color: #256428;
}

.wis-modal__cancel {
	flex: 0 0 auto;
	padding: 0.5em 1em;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
