/**
 * COTSA Unified Payments - Mobile Responsive Styles
 *
 * @package COTSA_Unified_Payments
 * @since 2.0.0
 *
 * Mobile-first responsive design with no PHP/JS changes
 * Breakpoints: Mobile 320px → Tablet 768px → Desktop 1024px+
 */

/* ==========================================
   MOBILE-FIRST BASE STYLES (320px - 767px)
   ========================================== */

/* Form Container */
.cup-payment-form {
	width: 100%;
	max-width: 100%;
	padding: 16px;
	box-sizing: border-box;
	margin: 0 auto;
}

/* Form Wrapper */
.cup-form-wrapper {
	width: 100%;
	box-sizing: border-box;
}

/* Form Group / Field Container */
.cup-form-group,
.cup-field {
	width: 100%;
	margin-bottom: 16px;
	box-sizing: border-box;
	display: block;
	position: relative;
	z-index: auto;
}

/* Labels */
.cup-form-group label,
.cup-field label,
label {
	display: block;
	width: 100%;
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
	box-sizing: border-box;
}

/* Required Indicator */
.cup-form-group label .cup-required,
.cup-field label .cup-required,
.cup-required {
	color: #dc3545;
	font-weight: bold;
	margin-left: 2px;
}

/* Input Fields */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea,
select,
.cup-form-group input,
.cup-field input,
.cup-form-group select,
.cup-field select {
	width: 100%;
	max-width: 100%;
	padding: 12px;
	margin: 0;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 16px; /* Prevents zoom on iOS */
	line-height: 1.5;
	box-sizing: border-box;
	min-height: 48px; /* Touch target size */
	display: block;
	font-family: inherit;
	background-color: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
}

/* Input Focus State */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: #1e3d18;
	box-shadow: 0 0 0 3px rgba(30, 61, 24, 0.1);
	position: relative;
	z-index: 0;
}

/* Placeholder Text */
input::placeholder,
textarea::placeholder {
	color: #999;
	font-size: 14px;
}

/* Dropdown / Select */
select {
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 20px;
	padding-right: 40px;
	cursor: pointer;
}

/* ==========================================
   STEP 2: PRICE BREAKDOWN BOX
   ========================================== */

.cup-price-breakdown {
	width: 100%;
	background-color: #f0f8f0;
	border: 1px solid #1e3d18;
	border-radius: 4px;
	padding: 16px;
	margin: 20px 0;
	box-sizing: border-box;
	position: relative;
	z-index: 1;
}

.cup-price-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #e0e0e0;
	font-size: 14px;
	line-height: 1.6;
	width: 100%;
	box-sizing: border-box;
}

.cup-price-row:last-child {
	border-bottom: none;
}

.cup-price-row.cup-price-total {
	font-size: 16px;
	font-weight: bold;
	color: #1e3d18;
	padding: 12px 0;
	border-top: 2px solid #1e3d18;
	margin-top: 8px;
}

.cup-price-label {
	flex: 1;
	text-align: left;
	font-weight: 500;
	color: #333;
}

.cup-price-value {
	flex: 1;
	text-align: right;
	font-weight: 600;
	color: #1e3d18;
}

/* ==========================================
   STEP 3: BUTTONS & CALL-TO-ACTION
   ========================================== */

button,
.button,
.cup-button,
input[type="submit"],
.cup-form-group button,
.cup-field button {
	width: 100%;
	padding: 16px;
	margin-top: 16px;
	margin-bottom: 8px;
	border: none;
	border-radius: 4px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
	cursor: pointer;
	transition: all 0.2s;
	text-align: center;
	box-sizing: border-box;
	min-height: 52px;
	display: block;
	text-decoration: none;
	background-color: #1e3d18;
	color: white;
}

button:active,
button:hover,
.button:active,
.button:hover,
input[type="submit"]:active,
input[type="submit"]:hover {
	background-color: #162d13;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ==========================================
   STEP 4: DROPDOWNS & OVERLAYS
   ========================================== */

.cup-preset-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
	margin: 12px 0;
}

.cup-preset-button {
	flex: 1;
	min-width: 70px;
	padding: 10px 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background-color: #f9f9f9;
	font-size: 13px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cup-preset-button:hover,
.cup-preset-button.active {
	background-color: #1e3d18;
	color: white;
	border-color: #1e3d18;
}

/* ==========================================
   STEP 5: TYPOGRAPHY & SPACING
   ========================================== */

body {
	font-size: 16px;
	line-height: 1.6;
	color: #333;
}

h1, .cup-form-title {
	font-size: 24px;
	font-weight: bold;
	margin: 16px 0 8px 0;
	line-height: 1.3;
	color: #1e3d18;
}

h2, .cup-form-subtitle {
	font-size: 18px;
	font-weight: 600;
	margin: 12px 0 6px 0;
	color: #1e3d18;
}

p {
	margin: 8px 0;
	font-size: 14px;
	line-height: 1.6;
}

.cup-form-description,
.cup-form-helper {
	font-size: 13px;
	color: #666;
	margin: 4px 0 12px 0;
}

/* Error Messages */
.cup-error,
.cup-form-error,
.error-message {
	color: #dc3545;
	font-size: 13px;
	margin-top: 4px;
	display: block;
}

/* Success Messages */
.cup-success,
.success-message {
	color: #1e3d18;
	font-size: 13px;
	margin-top: 4px;
}

/* ==========================================
   MOBILE DROPDOWN OVERLAY FIX (320px - 767px)
   ========================================== */

@media screen and (max-width: 767px) {
	/* Increased spacing for form groups on mobile to prevent dropdown overlay */
	.cup-form-group,
	.cup-field {
		margin-bottom: 20px;
	}

	/* Extra space below last form group before price breakdown */
	.cup-form-group:last-of-type {
		margin-bottom: 24px;
	}

	/* Adjusted margin for price breakdown to work with increased form-group spacing */
	.cup-price-breakdown {
		margin-top: 8px;
		margin-bottom: 16px;
	}
}

/* ==========================================
   TABLET STYLES (768px - 1023px)
   ========================================== */

@media screen and (min-width: 768px) {
	.cup-payment-form {
		max-width: 600px;
		padding: 24px;
	}

	.cup-form-group,
	.cup-field {
		margin-bottom: 20px;
	}

	label {
		font-size: 15px;
	}

	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="number"],
	textarea,
	select {
		font-size: 15px;
		padding: 14px;
		min-height: 50px;
	}

	.cup-price-breakdown {
		padding: 20px;
		margin: 24px 0;
	}

	.cup-price-row {
		font-size: 15px;
		padding: 10px 0;
	}

	.cup-preset-buttons {
		gap: 12px;
	}

	.cup-preset-button {
		min-width: 100px;
		font-size: 14px;
		min-height: 48px;
	}

	button,
	.button,
	input[type="submit"] {
		padding: 14px;
		font-size: 15px;
		min-height: 48px;
	}

	h1, .cup-form-title {
		font-size: 28px;
		margin: 20px 0 10px 0;
	}

	h2, .cup-form-subtitle {
		font-size: 20px;
		margin: 16px 0 8px 0;
	}
}

/* ==========================================
   DESKTOP STYLES (1024px+)
   ========================================== */

@media screen and (min-width: 1024px) {
	.cup-payment-form {
		max-width: 700px;
		padding: 32px;
	}

	.cup-form-group,
	.cup-field {
		margin-bottom: 24px;
	}

	label {
		font-size: 16px;
		margin-bottom: 10px;
	}

	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="number"],
	textarea,
	select {
		font-size: 16px;
		padding: 14px;
		min-height: 50px;
	}

	.cup-price-breakdown {
		padding: 24px;
		margin: 28px 0;
		display: flex;
		flex-direction: column;
	}

	.cup-price-row {
		font-size: 16px;
		padding: 12px 0;
		display: flex;
		justify-content: space-between;
	}

	.cup-price-label {
		flex: 0 1 auto;
		text-align: left;
	}

	.cup-price-value {
		flex: 0 1 auto;
		text-align: right;
		min-width: 100px;
	}

	.cup-preset-buttons {
		gap: 16px;
	}

	.cup-preset-button {
		min-width: 120px;
		font-size: 15px;
		min-height: 50px;
	}

	button,
	.button,
	input[type="submit"] {
		width: 100%;
		padding: 16px;
		font-size: 16px;
		min-height: 52px;
	}

	h1, .cup-form-title {
		font-size: 32px;
		margin: 24px 0 12px 0;
	}

	h2, .cup-form-subtitle {
		font-size: 22px;
		margin: 20px 0 10px 0;
	}
}

/* ==========================================
   ACCESSIBILITY & UTILITY
   ========================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
	outline: 2px solid #1e3d18;
	outline-offset: 2px;
}

/* Print styles */
@media print {
	.cup-payment-form {
		padding: 0;
		margin: 0;
		background: none;
		border: none;
	}

	button,
	.button {
		display: none;
	}
}

/* High contrast mode support */
@media (prefers-contrast: more) {
	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="number"],
	textarea,
	select {
		border-width: 2px;
	}

	.cup-price-breakdown {
		border-width: 2px;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
