/**
 * Bonus Prociechi - Frontend Styles
 *
 * @package BonusProciechi
 */

/* === Bonus Button === */
.bonus-prociechi-wrapper {
	margin: 20px 0;
	text-align: center;
}

/* Hide bonus button on cart page - show only on checkout */
.woocommerce-cart .bonus-prociechi-wrapper {
	display: none !important;
}

#bonus-prociechi-button {
	background-color: #95c12a;
	color: #fff;
	border: none;
	padding: 12px 24px;
	font-size: 16px;
	cursor: pointer;
	border-radius: 4px;
	transition: background-color 0.3s ease, transform 0.1s ease;
}

#bonus-prociechi-button:hover,
#bonus-prociechi-button:focus {
	background-color: #7a9e22;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#bonus-prociechi-button:focus {
	outline: 2px solid #95c12a;
	outline-offset: 2px;
}

#bonus-prociechi-button:active {
	transform: translateY(0);
}

/* === Modal Overlay === */
.bonus-prociechi-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bonus-prociechi-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(2px);
}

/* === Modal Content === */
.bonus-prociechi-modal-content {
	position: relative;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	max-width: 900px;
	width: 95%;
	max-height: 90vh;
	overflow-y: auto;
	animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* === Modal Header === */
.bonus-prociechi-modal-header {
	padding: 20px 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	background-color: #0073aa;
	border-radius: 8px 8px 0 0;
}

.bonus-prociechi-modal-header h2 {
	margin: 0;
	font-size: 20px;
	color: #ffffff;
	font-weight: 600;
}

.bonus-prociechi-modal-close {
	background: none !important;
	border: none !important;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #ffffff !important;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background-color 0.2s ease;
	opacity: 1 !important;
}

.bonus-prociechi-modal-close span {
	color: #ffffff !important;
}

.bonus-prociechi-modal-close:hover,
.bonus-prociechi-modal-close:focus {
	background-color: rgba(255, 255, 255, 0.2) !important;
	opacity: 1 !important;
	color: #ffffff !important;
}

.bonus-prociechi-modal-close:focus {
	outline: 2px solid #ffffff !important;
	outline-offset: 2px;
}

/* === Modal Body === */
.bonus-prociechi-modal-body {
	padding: 35px 40px;
	background-color: #ffffff;
}

/* === Important Notice === */
.bonus-important-notice {
	background: #fff3cd;
	border-left: 4px solid #ffc107;
	padding: 15px 18px;
	margin-bottom: 25px;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.6;
	color: #856404;
}

.bonus-important-notice strong {
	color: #664d03;
	font-weight: 600;
}

/* === Locked Cart Styles === */
.bonus-locked-notice {
	color: #999 !important;
	font-size: 12px !important;
	font-style: italic;
}

.bonus-locked-quantity {
	font-weight: 600;
	color: #333;
}

/* === Cart Locked Banner === */
.bonus-cart-locked-banner {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 8px;
	padding: 20px 25px;
	margin-bottom: 25px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
	border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Add top margin when banner appears on product page */
.single-product .bonus-cart-locked-banner {
	margin-top: 25px;
}

.bonus-locked-message {
	color: #ffffff;
	font-size: 15px;
	line-height: 1.6;
	flex: 1;
}

.bonus-locked-message strong {
	font-weight: 700;
	font-size: 16px;
	display: block;
	margin-bottom: 5px;
}

.bonus-cart-locked-banner .button-cancel-bonus {
	background-color: #fff;
	color: #667eea;
	border: 2px solid #fff;
	padding: 12px 24px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	border-radius: 6px;
	transition: all 0.3s ease;
	white-space: nowrap;
	flex-shrink: 0;
}

.bonus-cart-locked-banner .button-cancel-bonus:hover {
	background-color: #f8f9fa;
	color: #5568d3;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bonus-cart-locked-banner .button-cancel-bonus:active {
	transform: translateY(0);
}

.bonus-cart-locked-banner .button-cancel-bonus:disabled {
	background-color: #e9ecef;
	color: #999;
	cursor: not-allowed;
	opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
	.bonus-cart-locked-banner {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
		padding: 20px;
	}

	.bonus-locked-message strong {
		font-size: 15px;
	}

	.bonus-cart-locked-banner .button-cancel-bonus {
		width: 100%;
		margin-top: 10px;
	}
}

/* === Form Styles === */
.bonus-form-row {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	gap: 25px !important;
	margin-bottom: 22px !important;
	width: 100% !important;
}

@media (max-width: 768px) {
	.bonus-prociechi-modal-content {
		max-width: 95%;
		width: 95%;
	}

	.bonus-prociechi-modal-body {
		padding: 25px 20px;
	}

	.bonus-form-row {
		gap: 18px;
		margin-bottom: 18px;
	}
}

@media (max-width: 600px) {
	.bonus-form-row {
		grid-template-columns: 1fr !important;
		gap: 16px !important;
	}

	.bonus-prociechi-modal-body {
		padding: 20px 15px;
	}

	.bonus-form-field input {
		max-width: 100% !important;
	}
}

.bonus-form-field {
	display: flex !important;
	flex-direction: column !important;
	min-width: 0 !important;
	align-items: flex-start !important;
}

.bonus-form-field label {
	font-weight: 600;
	margin-bottom: 8px;
	color: #333;
	font-size: 13px;
	display: block !important;
	width: auto !important;
	text-align: left !important;
}

.bonus-form-field label .required {
	color: #d32f2f;
	text-decoration: none;
	font-weight: bold;
	margin-left: 2px;
}

.bonus-form-field input {
	padding: 10px 12px;
	border: 1px solid #cccccc;
	border-radius: 3px;
	font-size: 14px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	width: 100% !important;
	max-width: 380px !important;
	box-sizing: border-box !important;
}

.bonus-form-field input::placeholder {
	color: #999;
	opacity: 0.7;
	font-style: italic;
}

.bonus-form-field input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

.bonus-form-field input:focus::placeholder {
	opacity: 0.5;
}

.bonus-form-field input.error {
	border-color: #d32f2f;
}

.bonus-form-field input.valid {
	border-color: #388e3c;
}

.bonus-form-field input[aria-invalid="true"] {
	border-color: #d32f2f;
	background-color: #fff5f5;
}

.field-error {
	color: #d32f2f;
	font-size: 12px;
	margin-top: 5px;
	display: block;
}

.form-help {
	color: #666;
	font-size: 11px;
	margin-top: 4px;
	display: block;
	font-style: italic;
}

/* === Modal Footer === */
.bonus-prociechi-modal-footer {
	display: flex;
	gap: 15px;
	margin-top: 35px;
	padding-top: 25px;
	border-top: 1px solid #e0e0e0;
	justify-content: flex-end;
}

.bonus-prociechi-modal-footer .button {
	padding: 12px 24px !important;
	font-size: 15px !important;
	border-radius: 3px !important;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none !important;
	font-weight: 500;
}

.bonus-prociechi-modal-footer .button-primary {
	background-color: #0073aa !important;
	color: #fff !important;
	border: none !important;
}

.bonus-prociechi-modal-footer .button-primary:hover,
.bonus-prociechi-modal-footer .button-primary:focus {
	background-color: #005a87 !important;
	color: #fff !important;
}

.bonus-prociechi-modal-footer .button-primary:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.bonus-prociechi-modal-footer .button-primary:disabled,
.bonus-prociechi-modal-footer .button-primary.loading {
	opacity: 0.6;
	cursor: not-allowed;
}

.bonus-prociechi-modal-footer .button:not(.button-primary) {
	background-color: #f5f5f5 !important;
	color: #333 !important;
	border: 1px solid #cccccc !important;
}

.bonus-prociechi-modal-footer .button:not(.button-primary):hover,
.bonus-prociechi-modal-footer .button:not(.button-primary):focus {
	background-color: #e0e0e0 !important;
	border-color: #999 !important;
}

/* === Messages === */
.bonus-form-messages {
	margin-top: 16px;
	display: none;
}

.bonus-message {
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 12px;
	font-size: 14px;
}

.bonus-message-success {
	background-color: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #81c784;
}

.bonus-message-error {
	background-color: #ffebee;
	color: #c62828;
	border: 1px solid #ef5350;
}

/* === Prevent Body Scroll === */
body.bonus-modal-open {
	overflow: hidden;
}

/* === Loading State === */
.button.loading {
	position: relative;
	pointer-events: none;
}

.button.loading::after {
	content: "";
	position: absolute;
	width: 16px;
	height: 16px;
	top: 50%;
	right: 8px;
	margin-top: -8px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: spin 0.6s linear infinite;
}

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

/* === Accessibility Improvements === */
@media (prefers-reduced-motion: reduce) {
	.bonus-prociechi-modal-content,
	.button,
	.form-field input {
		animation: none;
		transition: none;
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.bonus-prociechi-modal-overlay {
		background-color: rgba(0, 0, 0, 0.8);
	}

	.form-field input:focus {
		outline: 3px solid;
	}
}

/* === Screen Reader Only === */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* === Focus Visible (for better keyboard navigation) === */
*:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* === Mobile Optimizations === */
@media (max-width: 480px) {
	.bonus-prociechi-modal-content {
		width: 95%;
		max-height: 95vh;
	}

	.bonus-prociechi-modal-header {
		padding: 16px;
	}

	.bonus-prociechi-modal-header h2 {
		font-size: 20px;
	}

	.bonus-prociechi-modal-body {
		padding: 16px;
	}

	.bonus-prociechi-modal-footer {
		flex-direction: column-reverse;
	}

	.bonus-prociechi-modal-footer .button {
		width: 100%;
	}
}

/* === Alert Modals === */
.bonus-alert-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bonus-alert-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
}

.bonus-alert-content {
	position: relative;
	background-color: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	max-width: 480px;
	width: 90%;
	overflow: hidden;
	animation: bonusAlertSlideIn 0.3s ease-out;
}

@keyframes bonusAlertSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.bonus-alert-icon {
	width: 60px;
	height: 60px;
	margin: 15px auto 15px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	font-weight: bold;
}

.bonus-success .bonus-alert-icon {
	background: linear-gradient(135deg, #10b981, #059669);
	color: #fff;
}

.bonus-error .bonus-alert-icon {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: #fff;
}

.bonus-alert-header {
	padding: 25px 25px 15px;
	text-align: center;
}

.bonus-confirm .bonus-alert-header {
	padding-top: 30px;
}

.bonus-alert-header h3 {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: #1f2937;
	line-height: 1.3;
}

.bonus-alert-body {
	padding: 0 25px 25px;
	text-align: center;
}

.bonus-alert-body p {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: #6b7280;
}

.bonus-alert-footer {
	padding: 20px 25px 25px;
	display: flex;
	gap: 12px;
	justify-content: center;
}

.bonus-confirm .bonus-alert-footer {
	justify-content: space-between;
}

.bonus-alert-btn {
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none;
	min-width: 120px;
}

.bonus-alert-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bonus-alert-btn:active {
	transform: translateY(0);
}

.bonus-alert-ok {
	background: #0073aa !important;
	background-color: #0073aa !important;
	color: #fff !important;
	border: none !important;
}

.bonus-alert-ok:hover,
.bonus-alert-ok:focus {
	background: #005a87 !important;
	background-color: #005a87 !important;
	color: #fff !important;
	border: none !important;
}

.bonus-alert-confirm {
	background: #0073aa !important;
	background-color: #0073aa !important;
	color: #fff !important;
	border: none !important;
	flex: 1;
}

.bonus-alert-confirm:hover,
.bonus-alert-confirm:focus {
	background: #005a87 !important;
	background-color: #005a87 !important;
	color: #fff !important;
	border: none !important;
}

.bonus-alert-cancel {
	background-color: #d3d3d3 !important;
	background: #d3d3d3 !important;
	color: #000 !important;
	border: none !important;
	flex: 1;
}

.bonus-alert-cancel:hover,
.bonus-alert-cancel:focus {
	background-color: #696969 !important;
	background: #696969 !important;
	color: #fff !important;
	border: none !important;
}

/* Responsive */
@media (max-width: 600px) {
	.bonus-alert-content {
		max-width: 95%;
	}

	.bonus-alert-header h3 {
		font-size: 19px;
	}

	.bonus-alert-body p {
		font-size: 14px;
	}

	.bonus-alert-footer {
		flex-direction: column;
	}

	.bonus-alert-btn {
		width: 100%;
		min-width: auto;
	}

	.bonus-confirm .bonus-alert-footer {
		flex-direction: column-reverse;
	}
}
