/**
Theme Name: Verifone Child
Theme URI: https://www.verifonewebpay.fi/
Description: Banner generator matching Verifone design specifications
Author: Evermade
Author URI: https://www.evermade.fi/
Version: 2.0.0
Text Domain: verifone-child
Template: astra
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

/* Reset and Base Styles */
* {
	box-sizing: border-box;
}

a#CybotCookiebotDialogPoweredbyCybot {
	display: none;
}

.pikselikuva {
	position: absolute;
}

/* Page specific styles */
.page-template-page-banner-generator .ast-container {
	display: block;
	max-width: 100%;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.page-template-page-banner-generator {
	background: #f5f5f5;
}

.page-template-page-banner-generator #content {
	padding-bottom: 3rem;
}

/* Ensure Elementor sections display properly */
.page-template-page-banner-generator .elementor-section {
	margin: 0;
}

/* Main Wrapper */
.banner-generator-wrapper {
	max-width: 1400px;
	margin: 0 auto; /* Center content */
	padding: 40px 20px;
}

/* Grid Layout */
.banner-generator-grid {
	display: grid;
	grid-template-columns: 360px 1fr;
	gap: 32px; /* Increased gap for better spacing */
	align-items: start;
	width: 100%;
}

/* Sidebar */
.banner-sidebar {
	/*background: #fff;*/
	border-radius: 4px;
	overflow: hidden;
	width: 100%;
	max-width: 360px; /* Desktop: fixed width for sidebar */
}

.sidebar-header {
	display: block; /* Visible on desktop */
	font-size: 18px;
	font-weight: 600;
	color: #000;
	padding: 0 0 16px 0;
	margin: 0;
	border-bottom: 1px solid #e0e0e0;
	margin-bottom: 16px;
}

/* Override Elementor button styles for sidebar toggle */
.banner-sidebar .sidebar-toggle,
.banner-sidebar button.sidebar-toggle,
button.sidebar-toggle#sidebar-toggle {
	width: 100%;
	background: transparent !important; /* Override Elementor button background */
	background-color: transparent !important;
	border: none !important; /* Override Elementor button border */
	border-style: none !important;
	border-width: 0 !important;
	border-radius: 0 !important; /* Override Elementor button border-radius */
	padding: 0 !important; /* Override Elementor button padding */
	display: none; /* Hidden by default on desktop */
	justify-content: space-between;
	align-items: flex-start; /* Align to top for multi-line text */
	cursor: pointer;
	font-size: 18px !important;
	font-weight: 600 !important;
	color: #000 !important; /* Override Elementor button color */
	text-align: left;
	font-family: inherit !important; /* Use theme font, not Elementor button font */
}

.sidebar-toggle span {
	flex: 1;
	word-wrap: break-word;
}

.sidebar-toggle svg {
	width: 24px;
	height: 24px;
	min-width: 24px; /* Prevent shrinking */
	flex-shrink: 0; /* Prevent shrinking */
	transition: transform 0.3s;
	stroke: currentColor; /* Use text color */
}

.sidebar-toggle[aria-expanded='false'] svg {
	transform: rotate(-180deg); /* Arrow points up when collapsed */
}

.sidebar-content {
	padding: 0;
	max-height: none; /* Always visible on desktop */
	overflow: visible;
}

/* Payment Categories */
/*
.payment-category {
  border-bottom: 1px solid #e0e0e0;
}
*/

.payment-category:last-child {
	border-bottom: none;
}

.category-title {
	font-size: 14px;
	font-weight: 600;
	color: #000;
	margin: 0;
	padding: 16px 0 12px;
}

.payment-list {
	list-style: none;
	margin: 0;
	padding: 0 0 16px;
}

.payment-item {
	margin-bottom: 8px;
}

.payment-item:last-child {
	margin-bottom: 0;
}

.payment-checkbox {
	display: none;
}

.payment-item label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s;
	background: #fff;
}

.payment-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.payment-logo {
	width: 32px;
	height: 32px;
	object-fit: contain;
	display: block;
	image-rendering: -moz-crisp-edges; /* Firefox */
	image-rendering: -webkit-optimize-contrast; /* Webkit */
	image-rendering: crisp-edges; /* Standard */
	-ms-interpolation-mode: nearest-neighbor; /* IE */
}

.payment-item label:hover {
	border-color: #1234ff;
	background: #f8f9ff;
}

.payment-checkbox:checked + label {
	border-color: #1234ff;
	background: #fff;
}

.payment-name {
	font-family: 'Noto Sans', sans-serif;
	font-weight: 600;
	font-style: normal;
	font-size: 14px;
	line-height: 150%;
	letter-spacing: 0%;
	color: #000000; /* Black when unchecked */
}

/* Blue color when checkbox is checked */
.payment-checkbox:checked + label .payment-name {
	color: #1234ff;
}

.checkmark {
	width: 20px;
	height: 20px;
	color: #1234ff;
	opacity: 0;
	transition: opacity 0.2s;
}

.payment-checkbox:checked + label .checkmark {
	opacity: 1;
}

/* Preview Area */
.banner-preview-area {
	background: #fff;
	border-radius: 4px;
	padding: 24px;
	width: 100%;
	height: 100%;
}

.preview-title {
	font-size: 24px;
	font-weight: 600;
	color: #000;
	margin: 0 0 24px;
}

.preview-section {
	margin-bottom: 32px;
}

.preview-section:last-child {
	margin-bottom: 0;
}

.preview-format-title {
	font-size: 18px;
	font-weight: 600;
	color: #000;
	margin: 0 0 16px;
}

.preview-container {
	background: transparent;
	border-radius: 0;
	padding: 20px 0;
	display: flex;
	justify-content: flex-start; /* Left-align banners instead of center */
	align-items: center;
	min-height: 200px;
	margin-bottom: 20px;
	position: relative;
}

/* Loading State - Shimmer effect while banners generate */
.preview-container.is-loading {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: loading-shimmer 1.5s infinite;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
}

.preview-container.is-loading .preview-image {
	opacity: 0;
	visibility: hidden;
}

.preview-container.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 40px;
	height: 40px;
	border: 3px solid #e0e0e0;
	border-top-color: #0056d2;
	border-radius: 50%;
	animation: loading-spinner 0.8s linear infinite;
}

@keyframes loading-shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

@keyframes loading-spinner {
	0% {
		transform: translate(-50%, -50%) rotate(0deg);
	}
	100% {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* Horizontal banner scrollable on smaller screens */
.preview-container-horizontal {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
	scrollbar-width: thin;
	scrollbar-color: #1234ff #e0e0e0;
}

/* Custom scrollbar styling for horizontal banner */
.preview-container-horizontal::-webkit-scrollbar {
	height: 8px;
}

.preview-container-horizontal::-webkit-scrollbar-track {
	background: #e0e0e0;
	border-radius: 4px;
}

.preview-container-horizontal::-webkit-scrollbar-thumb {
	background: #1234ff;
	border-radius: 4px;
}

.preview-container-horizontal::-webkit-scrollbar-thumb:hover {
	background: #0039c3;
}

.preview-image {
	max-width: 100%;
	height: auto;
	display: block;
	/* All styling (cyan bg, rounded corners, shadow) is baked into the canvas image */
	/* High-quality smooth rendering for aspect-ratio-aware downscaled logos */
	image-rendering: auto; /* Use browser's high-quality algorithm */
	image-rendering: -webkit-optimize-contrast; /* Webkit optimization */
}

/* Hide images with empty src to prevent broken image icon */
.preview-image[src=''] {
	display: none;
}

/* Vertical banner should use explicit size provided by JS (avoid auto overrides) */
.preview-section:last-child .preview-image,
#imagePysty {
	max-width: none !important;
	width: auto;
	min-width: 0;
	height: auto;
}

/* Keep horizontal banner at EXACT desktop size (920px) on ALL screens - MUST NOT RESIZE */
#imageVaaka {
	width: 920px;
	max-width: none !important;
	min-width: 920px !important;
	height: 120px;
}

/* Ensure download buttons and other elements in the section are not affected */
.preview-section .download-btn {
	margin-top: 16px;
	max-width: 100%;
}

/* Download Button */
.download-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: #1234ff;
	color: #ffffff !important;
	padding: 14px 28px;
	border-radius: 30px;
	text-decoration: none;
	font-family: 'Noto Sans', sans-serif;
	font-weight: 600;
	font-style: normal;
	font-size: 16px;
	line-height: 24px;
	letter-spacing: 0%;
	transition: all 0.2s;
	box-shadow: 0 2px 6px rgba(0, 74, 239, 0.2);
}

.download-btn:hover {
	background: #0039c5;
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(0, 74, 239, 0.3);
	transform: translateY(-1px);
}

.download-btn svg {
	width: 20px;
	height: 20px;
	fill: #ffffff;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
	.banner-generator-grid {
		grid-template-columns: 1fr;
		max-width: 100%;
		overflow-x: hidden; /* Prevent horizontal overflow */
	}

	.banner-sidebar {
		order: 1;
		max-width: 100% !important;
		overflow-x: hidden;
	}

	.banner-preview-area {
		order: 2;
		max-width: 100% !important;
		overflow-x: hidden;
	}

	/* Collapsible sidebar on tablet and below */
	.sidebar-header {
		display: none; /* Hide desktop header on tablet/mobile */
	}

	.banner-sidebar .sidebar-toggle,
	.banner-sidebar button.sidebar-toggle,
	button.sidebar-toggle#sidebar-toggle {
		display: flex !important; /* Show toggle button on tablet and mobile */
		width: 100% !important; /* Full width of sidebar */
		max-width: 100% !important; /* Full width, no constraint */
		padding: 0 0 16px 0 !important; /* Same as desktop header - override Elementor */
		border-bottom: 1px solid #e0e0e0 !important; /* Border like desktop */
		border-style: solid !important; /* Override Elementor */
		border-width: 0 0 1px 0 !important; /* Only bottom border */
		margin-bottom: 16px !important;
		justify-content: space-between !important; /* Arrow at far right */
		font-family: 'Noto Sans', sans-serif !important;
		font-weight: 600 !important;
		font-size: 24px !important;
		line-height: 125% !important;
		letter-spacing: 0% !important;
	}

	.banner-sidebar .sidebar-toggle span,
	.banner-sidebar button.sidebar-toggle span,
	button.sidebar-toggle#sidebar-toggle span {
		max-width: 282px !important; /* Limit text width only */
	}

	.sidebar-content {
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease-out;
		max-width: 100%;
		box-sizing: border-box;
	}

	.sidebar-toggle[aria-expanded='true'] + .sidebar-content {
		max-height: 2000px;
		overflow-y: auto; /* Allow vertical scroll if needed */
		overflow-x: hidden; /* Prevent horizontal overflow */
	}
}

@media (max-width: 768px) {
	.banner-generator-wrapper {
		padding: 20px 10px;
		max-width: 100vw; /* Use viewport width, not constrained by parent */
		margin: 0 auto; /* Keep centered */
		overflow-x: hidden; /* Hide any horizontal overflow from wrapper itself */
	}

	.banner-preview-area {
		max-width: 100% !important; /* Use parent width, not viewport */
		overflow-x: hidden !important; /* Hide overflow from fixed-width banner */
		padding: 15px !important;
		box-sizing: border-box !important;
	}

	.preview-section-horizontal {
		max-width: 100% !important; /* Use parent width, not viewport */
		overflow: visible !important; /* Allow scrollable container to show */
		margin-left: 0 !important;
		margin-right: 0 !important;
		box-sizing: border-box !important;
	}

	.preview-container {
		padding: 15px 0;
		min-height: 150px;
	}

	/* Mobile: Horizontal scroll container */
	.preview-container-horizontal {
		padding: 15px !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		max-width: 100% !important; /* Use parent width, not viewport */
		width: 100% !important; /* Use parent width, not viewport */
		display: block !important; /* Not flex - prevents expanding to content */
		white-space: nowrap !important;
		-webkit-overflow-scrolling: touch !important;
		position: relative !important;
		box-sizing: border-box !important;
	}

	/* Image display for scroll */
	.preview-container-horizontal #imageVaaka {
		display: inline-block !important;
		vertical-align: top !important;
	}

	/* Larger scrollbar for mobile touch */
	.preview-container-horizontal::-webkit-scrollbar {
		height: 12px !important;
	}

	/* Scroll hint shadow */
	.preview-container-horizontal::after {
		content: '';
		position: absolute;
		top: 15px;
		right: 0;
		bottom: 27px;
		width: 40px;
		/*background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1));*/
		pointer-events: none;
		z-index: 1;
	}

	.preview-section {
		max-width: 100%;
		box-sizing: border-box;
	}

	.preview-format-title {
		font-size: 16px;
		max-width: 100%;
		box-sizing: border-box;
	}

	.download-btn {
		width: 100%;
		max-width: 100%;
		justify-content: center;
		box-sizing: border-box;
	}

	/* Ensure sidebar is not affected by horizontal banner constraints */
	.banner-sidebar {
		width: 100% !important;
		max-width: 100% !important; /* Use parent width, not viewport */
		margin-left: 0 !important;
		margin-right: 0 !important;
		box-sizing: border-box !important;
	}

	.sidebar-content {
		width: 100% !important;
		max-width: 100% !important; /* Use full width, not viewport */
		box-sizing: border-box !important;
	}

	.payment-list,
	.payment-category {
		max-width: 100%;
		box-sizing: border-box;
	}

	.payment-item label {
		max-width: 100%;
		box-sizing: border-box;
	}
}

/* Hide default canvas */
canvas {
	display: none !important;
}

/* Accessibility */
.visually-hidden {
	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 styles */
*:focus-visible {
	outline: 2px solid #1234ff;
	outline-offset: 2px;
}

/* Loading state */
.preview-container.loading {
	position: relative;
}

.preview-container.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 40px;
	height: 40px;
	border: 4px solid #e0e0e0;
	border-top-color: #1234ff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* WooCommerce styles */
.woocommerce-cart .woocommerce-shipping-totals .woocommerce-shipping-destination {
	display: none;
}

.woocommerce-cart .ast-container,
.woocommerce-checkout .ast-container {
	padding-top: 5rem;
	padding-bottom: 5rem;
}

.woocommerce-cart .cross-sells h2,
.woocommerce-cart .cart_totals h2 {
	font-size: 30px;
}

.woocommerce-cart .cart_totals .wc-proceed-to-checkout br,
.woocommerce p.return-to-shop br {
	display: none;
}

.woocommerce-cart h1.entry-title,
.woocommerce-checkout h1.entry-title {
	font-weight: 600;
	font-size: 35px;
}

.single-product .woocommerce-error,
.single-product .woocommerce-info,
.single-product .woocommerce-message {
	margin-bottom: 0;
}
