/**
 * Frontend styles for Popup Coupon Generator for WooCommerce
 */

.popucoge-popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.popucoge-popup-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: transparent;
	backdrop-filter: blur(4px);
}

.popucoge-popup-container {
	position: absolute;
	box-sizing: border-box;
	background: var(--popucoge-bg, #ffffff);
	border-radius: var(--popucoge-radius, 8px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	width: var(--popucoge-w, 500px);
	max-width: 100vw;
	max-height: min(90vh, 100dvh);
	overflow-y: auto;
	z-index: 1000000;
	min-height: var(--popucoge-min-h, 0);
}

/* Viewport placement (3×3); inset-inline-* respects RTL */
.popucoge-popup-container.popucoge-pos--top-left {
	top: 0;
	inset-inline-start: 0;
	inset-inline-end: auto;
	bottom: auto;
	transform: none;
}

.popucoge-popup-container.popucoge-pos--top-center {
	top: 0;
	inset-inline-start: 50%;
	inset-inline-end: auto;
	bottom: auto;
	transform: translateX(-50%);
}

.popucoge-popup-container.popucoge-pos--top-right {
	top: 0;
	inset-inline-end: 0;
	inset-inline-start: auto;
	bottom: auto;
	transform: none;
}

.popucoge-popup-container.popucoge-pos--center-left {
	top: 50%;
	inset-inline-start: 0;
	inset-inline-end: auto;
	bottom: auto;
	transform: translateY(-50%);
}

.popucoge-popup-container.popucoge-pos--center {
	top: 50%;
	inset-inline-start: 50%;
	inset-inline-end: auto;
	bottom: auto;
	transform: translate(-50%, -50%);
}

.popucoge-popup-container.popucoge-pos--center-right {
	top: 50%;
	inset-inline-end: 0;
	inset-inline-start: auto;
	bottom: auto;
	transform: translateY(-50%);
}

.popucoge-popup-container.popucoge-pos--bottom-left {
	bottom: 0;
	inset-inline-start: 0;
	inset-inline-end: auto;
	top: auto;
	transform: none;
}

.popucoge-popup-container.popucoge-pos--bottom-center {
	bottom: 0;
	inset-inline-start: 50%;
	inset-inline-end: auto;
	top: auto;
	transform: translateX(-50%);
}

.popucoge-popup-container.popucoge-pos--bottom-right {
	bottom: 0;
	inset-inline-end: 0;
	inset-inline-start: auto;
	top: auto;
	transform: none;
}

.popucoge-popup-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	color: #666;
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
	z-index: 10;
}

.popucoge-popup-close:hover {
	color: #000;
}

.popucoge-popup-content {
	padding: 40px;
}

.popucoge-popup-form {
	margin-top: 20px;
}

.popucoge-popup-form label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	color: #333;
}

.popucoge-popup-form input[type="email"],
.popucoge-popup-form input[type="text"],
.popucoge-popup-form input[type="number"],
.popucoge-popup-form input[type="date"],
.popucoge-popup-form textarea,
.popucoge-popup-form select {
	width: 100%;
	padding: 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	margin-bottom: 15px;
	box-sizing: border-box;
	background: #fff;
	color: #1d2327;
}

.popucoge-popup-form input[type="email"]:focus,
.popucoge-popup-form input[type="text"]:focus,
.popucoge-popup-form input[type="number"]:focus,
.popucoge-popup-form input[type="date"]:focus,
.popucoge-popup-form textarea:focus,
.popucoge-popup-form select:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.popucoge-popup-form textarea {
	min-height: 110px;
	resize: vertical;
}

.popucoge-subscribe-button {
	background-color: #0073aa;
	color: #ffffff;
	border: none;
	padding: 12px 24px;
	border-radius: 4px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s;
	width: 100%;
}

.popucoge-subscribe-button:hover {
	background-color: #005a87;
}

.popucoge-subscribe-button:active {
	background-color: #004d73;
}

.popucoge-form-message {
	margin-top: 15px;
	padding: 10px;
	border-radius: 4px;
	display: none;
}

.popucoge-form-message.success {
	background-color: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
	display: block;
}

.popucoge-form-message.error {
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
	display: block;
}

.popucoge-altcha-wrap {
	margin: 0.75em 0;
}

.popucoge-altcha-widget {
	display: block;
	max-width: 100%;
}

/* Tablet & mobile: optional width/min-height overrides */
@media (max-width: 768px) {
	.popucoge-popup-container {
		width: var(--popucoge-w-mobile, var(--popucoge-w, 500px));
		max-width: 100vw;
		max-height: min(92vh, 100dvh);
		min-height: var(--popucoge-min-h-mobile, var(--popucoge-min-h, 0));
	}

	/* Keep corner positions on-screen on narrow viewports */
	.popucoge-popup-container[class*="popucoge-pos--"] {
		max-width: min(100vw, 100%);
	}

	.popucoge-popup-content {
		padding: 30px 20px;
	}
}

