.charge-layout {
	position: relative;
	min-height: 100vh;
}

.charge-page {
	width: 100%;
	padding: 0;
	min-height: inherit;

	&__test-banner {
		padding: 10px 16px;
		background: #dc2626;
		color: #ffffff;
		font-size: 0.875rem;
		font-weight: 600;
		text-align: center;
		border-bottom: 1px solid #b91c1c;
	}

	&__card {
		border-radius: 0;
		overflow: hidden;
		min-height: inherit;
	}

	&__header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 10px;
		background: var(--bg-head);
		color: var(--text-normal);

		h1 {
			font-size: 1.125rem;
			font-weight: 700;
			margin: 0;
		}
	}

	&__close {
		width: 32px;
		height: 32px;
		background: transparent;
		font-size: 1.25rem;
		cursor: pointer;

		&:hover {
			background: var(--bg-subtle);
			color: var(--text-primary);
		}
	}

	&__body {
		padding: 16px 20px 24px;
	}

	&__label {
		font-size: 0.8125rem;
		font-weight: 600;
		color: var(--text-secondary);
		margin-bottom: 10px;
		display: block;
	}

	&__amount-input {
		width: 100%;
		padding: 6px 14px;
		border: 1px solid var(--border-default);
		border-radius: 8px;
		font-size: 1.125rem;
		font-weight: 600;
		outline: none;
		text-align: right;
		background: var(--bg-page);
		color: var(--fg-default);

		&:focus {
			border-color: #3b82f6;
			box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
		}
	}

	&__quick-btns {
		display: flex;
		gap: 6px;
		margin-top: 8px;
	}

	&__quick-btn {
		flex: 1;
		padding: 8px 0;
		border: 1px solid var(--border-default);
		border-radius: 8px;
		font-size: 0.75rem;
		font-weight: 500;
		background: var(--bg-page, #fff);
		color: var(--fg-default);
		cursor: pointer;
		transition: all 0.15s;

		&:hover {
			background: var(--bg-subtle);
			border-color: #3b82f6;
			color: #bb1a98;
		}
	}

	&__method-section {
		margin-top: 16px;
	}

	&__method-grid {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 6px;
		margin-top: 8px;

		@media (max-width: 600px) {
			grid-template-columns: repeat(3, 1fr);
		}

		@media (max-width: 360px) {
			grid-template-columns: repeat(2, 1fr);
		}
	}

	&__method-btn {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 4px;
		padding: 10px 4px;
		border: 1px solid var(--border-default);
		border-radius: 8px;
		font-size: 0.6875rem;
		font-weight: 500;
		background: var(--bg-page);
		color: var(--fg-default);
		cursor: pointer;
		transition: all 0.15s;

		&:hover:not(&--active):not(&--disabled) {
			background: var(--bg-subtle);
		}

		&--active {
			border-color: #3b82f6;
			background: rgba(59, 130, 246, 0.08);
			color: #3b82f6;
			font-weight: 600;
		}

		&--disabled {
			opacity: 0.4;
			filter: grayscale(0.6);
			cursor: not-allowed;
			pointer-events: none;
			background: var(--bg-subtle);
			color: var(--text-muted);

			.charge-page__method-icon > svg {
				fill: var(--text-muted);
			}
		}
	}

	&__method-icon {
		font-size: 1.125rem;
		line-height: 1;
		padding: 2px 27px;

		> svg {
			fill: var(--text-primary);
		}
	}

	&__receipt {
		width: 100%;
		margin-top: 20px;
		padding: 16px;
		background: var(--bg-subtle);
		border-radius: 8px;
	}

	&__receipt-row {
		display: flex;
		justify-content: space-between;
		font-size: 0.8125rem;
		padding: 4px 0;
		color: var(--text-secondary);

		&--total {
			font-size: 0.9375rem;
			font-weight: 700;
			color: var(--fg-default);
			border-top: 1px solid var(--border-default);
			margin-top: 8px;
			padding-top: 10px;
		}
	}

	&__submit {
		width: 100%;
		padding: 10px 0;
		margin-top: 16px;
		border: none;
		border-radius: 8px;
		background: #2a8db3;
		color: #fff;
		font-size: 1rem;
		font-weight: 600;
		cursor: pointer;
		transition: background 0.15s;

		&:hover {
			background: #82b917;
		}

		&:disabled {
			background: var(--text-muted);
			cursor: not-allowed;
		}
	}

	&__reset {
		width: 100%;
		padding: 8px 0;
		margin-top: 8px;
		border: 1px solid var(--border-default);
		border-radius: 8px;
		background: var(--bg-page);
		color: var(--text-secondary);
		font-size: 0.875rem;
		font-weight: 500;
		cursor: pointer;
		transition: all 0.15s;

		&:hover:not(:disabled) {
			background: var(--bg-subtle);
		}

		&:disabled {
			opacity: 0.5;
			cursor: not-allowed;
		}
	}

	&__error {
		margin-top: 12px;
		padding: 10px 12px;
		border-radius: 8px;
		background: #fee2e2;
		color: #dc2626;
		font-size: 0.8125rem;
		font-weight: 500;
	}

	// 토스 위젯 컨테이너 (SDK 가 내부 UI 를 렌더링)
	&__toss-methods {
		margin-top: 12px;
	}

	&__toss-agreement {
		margin-top: 4px;
	}

	// 결제 결과
	&__result {
		padding: 40px 20px;
		min-height: inherit;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	&__result-icon {
		width: 56px;
		height: 56px;
		border-radius: 50%;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		font-size: 1.5rem;
		font-weight: 700;
		margin-bottom: 16px;

		&--success {
			background: #dcfce7;
			color: #16a34a;
		}

		&--waiting {
			background: #fef9c3;
			color: #ca8a04;
		}

		&--error {
			background: #fee2e2;
			color: #dc2626;
		}
	}

	&__result-message {
		font-size: 1rem;
		font-weight: 600;
	}

	&__result-code {
		font-size: 0.75rem;
		color: var(--text-muted);
		margin-bottom: 16px;
	}

	&__spinner {
		width: 40px;
		height: 40px;
		border: 3px solid var(--border-default);
		border-top-color: #3b82f6;
		border-radius: 50%;
		animation: charge-spin 0.8s linear infinite;
		margin: 0 auto 16px;
	}
}

@keyframes charge-spin {
	to { transform: rotate(360deg); }
}