/**
 * Premium Percent Calculator Styling.
 *
 * @package FanmoozTools
 */

/* ==========================================================================
   1. Base Shell & Theme Tokens
   ========================================================================== */
.fmz-entry .fmz-tool-shell,
.fmz-tool-shell {
	--fmz-primary-color: var(--fmz-accent, #3e5898);
	--fmz-primary-gradient: linear-gradient(135deg, var(--fmz-accent, #3e5898) 0%, #5373c4 100%);
	--fmz-success-color: #10b981;
	--fmz-success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
	--fmz-danger-color: #ef4444;
	--fmz-danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
	
	--fmz-card-bg-light: #ffffff;
	--fmz-bg-surface: #f8fafc;
	--fmz-text-dark: #1e293b;
	--fmz-text-muted-dark: #64748b;
	--fmz-border-light: #e2e8f0;
	--fmz-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
	--fmz-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
	--fmz-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
	--fmz-radius-lg: 16px;
	--fmz-radius-md: 12px;
	--fmz-radius-sm: 8px;

	width: 100%;
	max-width: 1000px;
	margin: 16px auto 48px;
	color: var(--fmz-text-dark);
	font-family: var(--fmz-font-family, 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
	font-size: 15px;
	line-height: 1.6;
	letter-spacing: -0.01em;
}

.fmz-tool-shell *,
.fmz-tool-shell *::before,
.fmz-tool-shell *::after {
	box-sizing: border-box;
}

.fmz-entry .fmz-tool-shell p,
.fmz-tool-shell p {
	margin: 0;
	padding: 0;
}

.fmz-entry .fmz-tool-shell h2,
.fmz-entry .fmz-tool-shell h3,
.fmz-tool-shell h2,
.fmz-tool-shell h3 {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: inherit;
	line-height: 1.35;
	font-weight: 700;
}

/* ==========================================================================
   2. Tabbed Navigation (Segmented Control)
   ========================================================================== */
.fmz-tool-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 24px;
	padding: 6px;
	background: var(--fmz-bg-surface);
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-lg);
}

.fmz-tool-tabs button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 1;
	min-width: 140px;
	min-height: 46px;
	padding: 10px 16px;
	border: 0;
	border-radius: var(--fmz-radius-md);
	background: transparent;
	color: var(--fmz-text-muted-dark);
	font: inherit;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fmz-tool-tabs button:hover {
	color: var(--fmz-text-dark);
	background: rgba(0, 0, 0, 0.03);
}

.fmz-tool-tabs button.is-active {
	background: var(--fmz-card-bg-light);
	color: var(--fmz-primary-color);
	box-shadow: var(--fmz-shadow-sm), 0 0 0 1px rgba(62, 88, 152, 0.05);
	font-weight: 700;
}

.fmz-tab-icon {
	flex-shrink: 0;
	opacity: 0.7;
	transition: transform 0.2s ease;
}

.fmz-tool-tabs button.is-active .fmz-tab-icon {
	color: var(--fmz-primary-color);
	opacity: 1;
	transform: scale(1.05);
}

/* ==========================================================================
   3. Main Panel Layout & Cards
   ========================================================================== */
.fmz-tool-panel {
	display: grid;
	grid-template-columns: 1.25fr 1fr;
	gap: 24px;
	margin-bottom: 24px;
}

.fmz-tool-card {
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-lg);
	background: var(--fmz-card-bg-light);
	box-shadow: var(--fmz-shadow-md);
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fmz-percent-form {
	padding: 32px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.fmz-tool-card__head {
	margin-bottom: 24px;
}

.fmz-tool-card__head h3 {
	color: var(--fmz-text-dark);
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.fmz-tool-card__head p {
	margin-top: 8px;
	color: var(--fmz-text-muted-dark);
	font-size: 14.5px;
}

/* ==========================================================================
   4. Input Fields & Presets
   ========================================================================== */
.fmz-field-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
	margin-bottom: 24px;
}

.fmz-field-wrapper {
	position: relative;
}

.fmz-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	color: var(--fmz-text-dark);
	font-size: 13.5px;
	font-weight: 700;
}

.fmz-field input {
	width: 100%;
	height: 52px;
	padding: 0 16px;
	border: 1.5px solid #cbd5e1;
	border-radius: var(--fmz-radius-md);
	background: var(--fmz-card-bg-light);
	color: var(--fmz-text-dark);
	font-family: inherit;
	font-weight: 700;
	font-size: 18px;
	transition: all 0.2s ease;
}

/* Hide Spin Buttons */
.fmz-field input::-webkit-outer-spin-button,
.fmz-field input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.fmz-field input[type=number] {
	-moz-appearance: textfield;
}

.fmz-field input:focus {
	outline: none;
	border-color: var(--fmz-primary-color);
	box-shadow: 0 0 0 4px rgba(62, 88, 152, 0.12);
}

.fmz-field__unit {
	position: relative;
	display: block;
}

.fmz-field__unit input {
	padding-right: 48px;
}

.fmz-field__unit span {
	position: absolute;
	top: 50%;
	right: 16px;
	transform: translateY(-50%);
	color: var(--fmz-text-muted-dark);
	font-weight: 800;
	font-size: 16px;
}

.fmz-preset-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.fmz-tool-shell[data-percent-mode="change"] .fmz-preset-row {
	display: none;
}

.fmz-preset-row button {
	flex: 1 1 calc(25% - 8px);
	min-width: 60px;
	height: 38px;
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-sm);
	background: var(--fmz-bg-surface);
	color: var(--fmz-text-dark);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.fmz-preset-row button:hover {
	border-color: #cbd5e1;
	background: #f1f5f9;
}

.fmz-preset-row button.is-active {
	border-color: var(--fmz-primary-color);
	background: rgba(62, 88, 152, 0.06);
	color: var(--fmz-primary-color);
	font-weight: 700;
}

/* ==========================================================================
   5. Hero Result Card
   ========================================================================== */
.fmz-result-card {
	display: flex;
	flex-direction: column;
	padding: 32px;
	background: linear-gradient(135deg, #f8faff 0%, #f1f4ff 100%);
	border: 1px solid rgba(62, 88, 152, 0.12);
	position: relative;
}

.fmz-result-card__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	color: var(--fmz-primary-color);
	font-size: 14px;
	font-weight: 800;
}

.fmz-btn-reset {
	padding: 6px 12px;
	border: 1px solid rgba(62, 88, 152, 0.15);
	border-radius: var(--fmz-radius-sm);
	background: var(--fmz-card-bg-light);
	color: var(--fmz-primary-color);
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
}

.fmz-btn-reset:hover {
	background: var(--fmz-primary-color);
	color: #fff;
	border-color: var(--fmz-primary-color);
}

.fmz-result-card__content {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	justify-content: center;
}

.fmz-result-card__label {
	color: var(--fmz-text-muted-dark);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.fmz-result-value-container {
	display: flex;
	align-items: baseline;
	gap: 16px;
	margin-top: 4px;
	flex-wrap: wrap;
}

.fmz-result-card__value {
	display: block;
	color: var(--fmz-primary-color);
	font-size: 52px;
	font-weight: 900;
	line-height: 1.1;
	word-break: break-all;
	letter-spacing: -0.03em;
}

.fmz-btn-copy {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	border: 1px solid #cbd5e1;
	border-radius: var(--fmz-radius-sm);
	background: var(--fmz-card-bg-light);
	color: var(--fmz-text-muted-dark);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: none;
}

.fmz-btn-copy:hover {
	border-color: #94a3b8;
	color: var(--fmz-text-dark);
	background: #f8fafc;
}

.fmz-result-text {
	margin-top: 12px;
	color: var(--fmz-text-dark);
	font-weight: 600;
	font-size: 15px;
}

.fmz-formula-wrapper {
	margin-top: 16px;
}

.fmz-result-card code {
	display: inline-block;
	max-width: 100%;
	padding: 8px 12px;
	border-radius: var(--fmz-radius-sm);
	background: rgba(62, 88, 152, 0.06);
	color: var(--fmz-primary-color);
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
	font-size: 13.5px;
	font-weight: 700;
	white-space: normal;
	border: 1px solid rgba(62, 88, 152, 0.08);
}

/* ==========================================================================
   6. Visual Feedback Indicator Widget
   ========================================================================== */
.fmz-visual-indicator {
	margin: 8px 0 24px;
	min-height: 90px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.65);
	border: 1px solid rgba(62, 88, 152, 0.06);
	border-radius: var(--fmz-radius-md);
	padding: 16px;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

/* Mode: Progress Bar (of, of_inverted) */
.fmz-visual-progress {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fmz-visual-progress__track {
	width: 100%;
	height: 10px;
	background: #e2e8f0;
	border-radius: 9999px;
	overflow: hidden;
}

.fmz-visual-progress__fill {
	height: 100%;
	background: var(--fmz-primary-gradient);
	border-radius: 9999px;
	transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	width: 0%;
}

.fmz-visual-progress__labels {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 12px;
	color: var(--fmz-text-muted-dark);
	font-weight: 600;
}

.fmz-visual-progress__badge {
	background: var(--fmz-primary-color);
	color: #fff;
	padding: 2px 8px;
	border-radius: 9999px;
	font-size: 11px;
	font-weight: 800;
}

/* Mode: Price Tag (discount) */
.fmz-visual-price {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	width: 100%;
}

.fmz-visual-price__tag {
	display: flex;
	flex-direction: column;
	padding: 10px 16px;
	border-radius: var(--fmz-radius-sm);
	font-size: 13px;
	min-width: 100px;
	box-shadow: var(--fmz-shadow-sm);
}

.fmz-visual-price__tag--original {
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	color: var(--fmz-text-muted-dark);
}

.fmz-visual-price__tag--original .fmz-price-val {
	text-decoration: line-through;
	font-size: 16px;
	font-weight: 700;
}

.fmz-visual-price__tag--discounted {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #15803d;
	position: relative;
}

.fmz-visual-price__tag--discounted .fmz-price-val {
	font-size: 18px;
	font-weight: 800;
}

.fmz-price-label {
	font-size: 11px;
	font-weight: 700;
	color: inherit;
	opacity: 0.85;
	margin-bottom: 2px;
}

.fmz-price-badge {
	position: absolute;
	top: -10px;
	right: -8px;
	background: var(--fmz-danger-color);
	color: white;
	font-size: 10px;
	font-weight: 800;
	padding: 1px 6px;
	border-radius: 9999px;
	box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.fmz-visual-price__arrow {
	color: var(--fmz-text-muted-dark);
	display: flex;
	align-items: center;
}

/* Mode: Trend (increase, decrease, change) */
.fmz-visual-trend {
	width: 100%;
}

.fmz-visual-trend__grid {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: flex-end;
	gap: 12px;
	height: 90px;
}

.fmz-visual-trend__col {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	justify-content: flex-end;
}

.fmz-visual-trend__col--divider {
	justify-content: center;
	height: 100%;
}

.fmz-trend-label {
	font-size: 11px;
	font-weight: 700;
	color: var(--fmz-text-muted-dark);
	margin-bottom: 4px;
}

.fmz-visual-trend__bar {
	width: 100%;
	max-width: 90px;
	border-radius: 6px 6px 0 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 800;
	transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
	position: relative;
}

.fmz-visual-trend__bar--before {
	background: #cbd5e1;
	color: #475569;
}

.fmz-visual-trend__bar--after {
	background: var(--fmz-primary-color);
	color: #fff;
}

.fmz-visual-trend__bar span {
	position: absolute;
	bottom: 6px;
	font-size: 11px;
	white-space: nowrap;
	padding: 0 4px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fmz-visual-trend__bar--before span {
	text-shadow: none;
}

.fmz-trend-badge {
	background: var(--fmz-success-color);
	color: white;
	font-size: 12px;
	font-weight: 800;
	padding: 4px 10px;
	border-radius: 9999px;
	box-shadow: 0 3px 6px rgba(16, 185, 129, 0.2);
	white-space: nowrap;
}

.fmz-trend-badge.is-decrease {
	background: var(--fmz-danger-color);
	box-shadow: 0 3px 6px rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   7. Copy Notification Toast
   ========================================================================== */
.fmz-toast {
	position: absolute;
	bottom: 24px;
	left: 50%;
	transform: translate(-50%, 10px);
	background: #1e293b;
	color: #ffffff;
	padding: 8px 16px;
	border-radius: var(--fmz-radius-sm);
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 10;
}

.fmz-toast.is-show {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ==========================================================================
   8. Examples Grid & Explanations Grid
   ========================================================================== */
.fmz-tool-card--compact {
	padding: 24px 32px;
	margin-top: 24px;
}

.fmz-tool-card--compact h3 {
	color: var(--fmz-text-dark);
	font-size: 17px;
	font-weight: 800;
	margin-bottom: 16px;
}

.fmz-chip-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.fmz-chip-grid button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 38px;
	padding: 0 14px;
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-sm);
	background: var(--fmz-bg-surface);
	color: var(--fmz-text-dark);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.fmz-chip-grid button:hover {
	border-color: var(--fmz-primary-color);
	background: rgba(62, 88, 152, 0.05);
	color: var(--fmz-primary-color);
}

.fmz-chip-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 4px;
	font-size: 10px;
	font-weight: 800;
	color: white;
}

.fmz-chip-tag--discount { background: var(--fmz-danger-color); }
.fmz-chip-tag--increase { background: var(--fmz-success-color); }
.fmz-chip-tag--of { background: var(--fmz-primary-color); }
.fmz-chip-tag--decrease { background: #f59e0b; }
.fmz-chip-tag--change { background: #6366f1; }

.fmz-explain-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.fmz-explain-item {
	min-width: 0;
	padding: 20px;
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-md);
	background: #f8fafc;
	transition: transform 0.2s ease;
}

.fmz-explain-item:hover {
	transform: translateY(-2px);
}

.fmz-explain-item--increase {
	background: #f0fdf4;
	border-color: #dcfce7;
}

.fmz-explain-item--decrease {
	background: #fff7ed;
	border-color: #ffedd5;
}

.fmz-explain-item strong {
	display: block;
	color: var(--fmz-text-dark);
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 8px;
}

.fmz-explain-item--increase strong {
	color: #15803d;
}

.fmz-explain-item--decrease strong {
	color: #c2410c;
}

.fmz-explain-item p {
	color: var(--fmz-text-muted-dark);
	font-size: 13.5px;
	line-height: 1.5;
	margin-bottom: 12px !important;
}

.fmz-explain-item code {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.04);
	color: #475569;
	font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
	font-size: 12px;
	font-weight: 600;
}

/* ==========================================================================
   9. Miscellaneous & Utility Styles
   ========================================================================== */
.fmz-tool-notice {
	padding: 16px;
	border: 1px solid var(--fmz-border-light);
	border-radius: var(--fmz-radius-md);
	background: #fef2f2;
	color: var(--fmz-danger-color);
	font-weight: 600;
	margin: 16px 0;
}

/* ==========================================================================
   10. Responsive Design (Media Queries)
   ========================================================================== */
@media (max-width: 900px) {
	.fmz-tool-panel {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.fmz-tool-tabs button {
		flex: 1 1 calc(50% - 6px);
		min-width: 120px;
	}

	.fmz-percent-form {
		padding: 24px;
	}

	.fmz-result-card {
		padding: 24px;
	}
}

@media (max-width: 768px) {
	.fmz-explain-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.fmz-chip-grid {
		justify-content: flex-start;
	}
}

@media (max-width: 560px) {
	.fmz-tool-shell {
		margin: 8px auto 24px;
	}

	.fmz-tool-tabs button {
		flex: 1 1 100%;
		font-size: 13.5px;
	}

	.fmz-field-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.fmz-preset-row button {
		flex: 1 1 calc(50% - 8px);
	}

	.fmz-result-card__value {
		font-size: 40px;
	}

	.fmz-visual-trend__bar span {
		font-size: 9px;
	}
}
