/**
 * sTip - Modern Tipping UI
 * By Secrets Team @ SecretsDubai.com
 * 
 * Designed to integrate seamlessly with Funnelkit checkout
 */

/* ============================================
   Container & Layout
   ============================================ */

.stip-container {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px 0;
	margin: 0;
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

.stip-label {
	font-size: 14px;
	font-weight: 500;
	color: #374151;
	margin: 0 0 4px 0;
	letter-spacing: -0.01em;
}

/* ============================================
   Pill Buttons Row
   ============================================ */

.stip-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.stip-btn {
	all: unset;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	color: #374151;
	background-color: #ffffff;
	border: 1.5px solid #e5e7eb;
	border-radius: 100px;
	cursor: pointer;
	transition: all 0.15s ease;
	white-space: nowrap;
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

.stip-btn:hover {
	background-color: #f9fafb;
	border-color: #d1d5db;
}

.stip-btn:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.stip-btn.active {
	background-color: #000000;
	border-color: #000000;
	color: #ffffff;
}

.stip-btn.active:hover {
	opacity: 0.9;
}

/* No Tip button - slightly different style */
.stip-btn[data-amount="0"] {
	color: #6b7280;
}

.stip-btn[data-amount="0"].active {
	background-color: #6b7280;
	border-color: #6b7280;
	color: #ffffff;
}

/* ============================================
   Custom Amount Input
   ============================================ */

.stip-custom-wrapper {
	display: none;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	animation: stip-slide-down 0.2s ease;
}

.stip-custom-wrapper.visible {
	display: flex;
}

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

.stip-custom-input-wrap {
	position: relative;
	flex: 1;
	max-width: 160px;
}

.stip-currency-symbol {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	pointer-events: none;
}

.stip-custom-input {
	all: unset;
	width: 100%;
	padding: 10px 12px 10px 28px;
	font-size: 14px;
	font-weight: 500;
	color: #111827;
	background-color: #ffffff;
	border: 1.5px solid #e5e7eb;
	border-radius: 8px;
	box-sizing: border-box;
	transition: all 0.15s ease;
	-moz-appearance: textfield;
}

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

.stip-custom-input::placeholder {
	color: #9ca3af;
	font-weight: 400;
}

.stip-custom-input:focus {
	border-color: #000000;
	box-shadow: 0 0 0 1px #000000;
}

.stip-apply-btn {
	all: unset;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #ffffff;
	background-color: #000000;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.15s ease;
	white-space: nowrap;
}

.stip-apply-btn:hover {
	opacity: 0.85;
}

.stip-apply-btn:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.stip-apply-btn.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* ============================================
   Active Tip Display (in totals)
   ============================================ */

.stip-remove-btn {
	all: unset;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-left: 8px;
	font-size: 11px;
	font-weight: 600;
	color: #ffffff;
	background-color: #ef4444;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.15s ease;
	vertical-align: middle;
}

.stip-remove-btn:hover {
	background-color: #dc2626;
	transform: scale(1.1);
}

/* ============================================
   Loading State
   ============================================ */

.stip-btn.loading,
.stip-container.loading .stip-btn {
	opacity: 0.5;
	pointer-events: none;
	cursor: wait;
}

/* ============================================
   Funnelkit Specific Overrides
   ============================================ */

/* One-page checkout compatibility */
.wfacp_main_form .stip-container {
	padding: 20px 0;
	border-top: 1px solid #e5e7eb;
	margin-top: 8px;
}

.wfacp_main_form .stip-label {
	font-size: 15px;
    margin-bottom: 0.75vh !important;
    color: #fff;
}

.wfacp_main_form .stip-btn {
	padding: 12px 20px;
}

/* Match Funnelkit form field styling */
.wfacp-form .stip-custom-input {
	height: auto;
	min-height: 44px;
}

/* ============================================
   WooCommerce Blocks Support
   ============================================ */

.wp-block-stip-checkout-block {
	overflow: hidden;
}

.wc-block-checkout .stip-container {
	padding: 16px 0;
}

.wc-block-components-totals-wrapper .stip-container {
	padding: 12px 16px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
	.stip-buttons {
		gap: 6px;
	}
	
	.stip-btn {
		padding: 8px 14px;
		font-size: 13px;
	}
	
	.stip-custom-wrapper {
		flex-direction: column;
		align-items: stretch;
	}
	
	.stip-custom-input-wrap {
		max-width: none;
	}
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
	.stip-label {
		color: #e5e7eb;
	}
	
	.stip-btn {
		color: #e5e7eb;
		background-color: #1f2937;
		border-color: #374151;
	}
	
	.stip-btn:hover {
		background-color: #374151;
		border-color: #4b5563;
	}
	
	.stip-btn.active {
		background-color: #ffffff;
		border-color: #ffffff;
		color: #000000;
	}
	
	.stip-custom-input {
		color: #f9fafb;
		background-color: #1f2937;
		border-color: #374151;
	}
	
	.stip-custom-input:focus {
		border-color: #ffffff;
		box-shadow: 0 0 0 1px #ffffff;
	}
	
	.stip-currency-symbol {
		color: #9ca3af;
	}
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
	.stip-container {
		display: none;
	}
}
