/* =============================================
   WC Tip Manager — Frontend / Checkout Styles
   ============================================= */

.wctm-tip-section {
	position: relative;
	margin: 16px 0;
	font-family: inherit;
}

.wctm-tip-inner {
	background: #fff;
	border: 2px solid #e5e7eb;
	border-radius: 14px;
	padding: 20px 20px 16px;
	position: relative;
	overflow: hidden;
	transition: border-color .25s ease, box-shadow .25s ease;
}

.wctm-tip-inner::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #7c3aed, #a855f7, #ec4899);
	border-radius: 14px 14px 0 0;
}

.wctm-tip-inner:hover {
	border-color: #c4b5fd;
	box-shadow: 0 4px 12px rgba(124,58,237,.1);
}

/* Header */
.wctm-tip-header {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 16px;
}

.wctm-tip-emoji {
	font-size: 32px;
	line-height: 1;
	flex-shrink: 0;
}

.wctm-tip-header-text { flex: 1; min-width: 0; }

.wctm-tip-title {
	margin: 0 0 3px !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	color: #1e1b4b !important;
	line-height: 1.3 !important;
	padding: 0 !important;
	border: none !important;
}

.wctm-tip-subtitle {
	margin: 0 !important;
	font-size: 13px !important;
	color: #6b7280 !important;
	line-height: 1.45 !important;
	padding: 0 !important;
}

/* Buttons row */
.wctm-tip-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 0;
}

.wctm-tip-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 16px;
	background: #fff;
	border: 2px solid #e5e7eb;
	border-radius: 9px;
	font-size: 14px;
	font-weight: 600;
	color: #374151;
	cursor: pointer;
	transition: all .2s ease;
	line-height: 1;
	font-family: inherit;
	white-space: nowrap;
	text-decoration: none;
	position: relative;
	overflow: hidden;
}

.wctm-tip-btn::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(124,58,237,.08);
	opacity: 0;
	transition: opacity .2s;
}

.wctm-tip-btn:hover {
	border-color: #7c3aed;
	color: #7c3aed;
	transform: translateY(-1px);
	box-shadow: 0 3px 8px rgba(124,58,237,.2);
}

.wctm-tip-btn:hover::after { opacity: 1; }

.wctm-tip-btn:active {
	transform: translateY(0);
	box-shadow: 0 1px 3px rgba(124,58,237,.15);
}

.wctm-tip-btn--active {
	background: #7c3aed !important;
	border-color: #7c3aed !important;
	color: #fff !important;
	box-shadow: 0 3px 10px rgba(124,58,237,.3) !important;
}

.wctm-tip-btn--active::after { opacity: 0 !important; }

.wctm-tip-btn--custom {
	border-style: dashed;
}

.wctm-tip-btn--none {
	color: #9ca3af;
	font-size: 12px;
	font-weight: 500;
}

.wctm-tip-btn--none.wctm-tip-btn--active {
	background: #f3f4f6 !important;
	border-color: #9ca3af !important;
	color: #6b7280 !important;
	box-shadow: none !important;
}

/* WooCommerce price inside buttons */
.wctm-tip-btn .woocommerce-Price-amount,
.wctm-tip-btn bdi {
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
}

/* Custom Input */
.wctm-custom-field {
	margin-top: 12px;
	animation: wctm-slide-down .25s ease;
}

@keyframes wctm-slide-down {
	from { opacity: 0; transform: translateY(-8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.wctm-custom-input-wrap {
	display: flex;
	align-items: stretch;
	max-width: 240px;
	border: 2px solid #7c3aed;
	border-radius: 9px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}

.wctm-custom-currency {
	display: flex;
	align-items: center;
	padding: 0 10px;
	background: #ede9fe;
	color: #7c3aed;
	font-size: 13px;
	font-weight: 700;
	flex-shrink: 0;
	border-right: 1px solid #c4b5fd;
	line-height: 1;
}

.wctm-custom-input {
	flex: 1;
	border: none !important;
	outline: none !important;
	padding: 9px 10px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	color: #1e1b4b !important;
	background: transparent !important;
	width: 100% !important;
	box-shadow: none !important;
	min-width: 0;
	font-family: inherit;
	-moz-appearance: textfield;
}

.wctm-custom-input::-webkit-outer-spin-button,
.wctm-custom-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.wctm-custom-apply {
	background: #7c3aed;
	color: #fff;
	border: none;
	padding: 0 16px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .2s;
	flex-shrink: 0;
	font-family: inherit;
}

.wctm-custom-apply:hover {
	background: #6d28d9;
}

.wctm-custom-error {
	margin-top: 6px;
	font-size: 12px;
	color: #ef4444;
	font-weight: 500;
	min-height: 18px;
}

/* Status */
.wctm-tip-status {
	margin-top: 10px;
	min-height: 24px;
}

.wctm-tip-added {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #d1fae5;
	color: #065f46;
	padding: 5px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	animation: wctm-pop .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes wctm-pop {
	from { transform: scale(.8); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

.wctm-tip-checkmark {
	color: #10b981;
	font-size: 14px;
	line-height: 1;
}

/* Loading overlay */
.wctm-loading {
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,.75);
	border-radius: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s;
	z-index: 10;
	backdrop-filter: blur(2px);
}

.wctm-loading.active {
	opacity: 1;
	pointer-events: all;
}

.wctm-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid #ede9fe;
	border-top-color: #7c3aed;
	border-radius: 50%;
	animation: wctm-spin .7s linear infinite;
}

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

/* Thank-you page notice */
.wctm-thankyou-notice {
	background: #ede9fe;
	border: 1.5px solid #c4b5fd;
	border-radius: 10px;
	padding: 14px 18px;
	margin: 16px 0;
	font-size: 14px;
	color: #4c1d95;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.wctm-ty-icon { font-size: 22px; }

/* Responsive */
@media (max-width: 480px) {
	.wctm-tip-inner { padding: 16px 14px 14px; }
	.wctm-tip-btn { padding: 8px 12px; font-size: 13px; }
	.wctm-custom-input-wrap { max-width: 100%; }
	.wctm-tip-emoji { font-size: 26px; }
}

/* =============================================
   Block Checkout specific overrides
   ============================================= */

/* When injected into the block order summary panel */
.wc-block-checkout__order-summary .wctm-tip-section,
.wc-block-components-totals-wrapper .wctm-tip-section,
.wp-block-woocommerce-checkout-order-summary-block .wctm-tip-section,
#wctm-tip-section-injected {
    margin: 0 0 16px 0 !important;
}

/* Block checkout wraps everything in a sidebar panel — match its styling */
.wc-block-components-panel .wctm-tip-inner,
.wc-block-checkout__order-summary .wctm-tip-inner {
    border-radius: 8px;
    padding: 16px;
}

/* Make price in tip buttons inherit block theme color correctly */
.wctm-tip-btn bdi,
.wctm-tip-btn .woocommerce-Price-amount {
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

/* Block cart totals injection */
.wc-block-cart .wctm-tip-section {
    margin: 0 0 16px 0 !important;
}
