/**
 * COD WooCommerce Form Styles
 *
 * Responsive styling for COD order form
 *
 * @package COD_WooCommerce
 * @version 1.0.0
 */

/* ===== Form Container ===== */
.cod-order-form-wrapper {
	margin: 2rem 0;
	padding: 0;
}

.cod-order-form-container {
	background-color: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 2rem;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== Form Title and Subtitle ===== */
.cod-form-title {
	font-size: 1.5rem;
	font-weight: 600;
	color: #333333;
	margin: 0 0 0.5rem 0;
	padding: 0;
}

.cod-form-subtitle {
	font-size: 0.9rem;
	color: #666666;
	margin: 0 0 1.5rem 0;
	padding: 0;
}

/* ===== Form Sections ===== */
.cod-form-section {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid #f0f0f0;
}

.cod-form-section:last-of-type {
	border-bottom: none;
	margin-bottom: 1rem;
	padding-bottom: 0;
}

.cod-section-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: #333333;
	margin: 0 0 1rem 0;
	padding: 0;
	display: flex;
	align-items: center;
}

.cod-section-title::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 1.1rem;
	background-color: var(--cod-primary-color, #007cba);
	margin-right: 0.75rem;
	border-radius: 2px;
}

/* ===== Form Groups ===== */
.cod-form-group {
	margin-bottom: 1.5rem;
	display: flex;
	flex-direction: column;
}

.cod-form-group:last-child {
	margin-bottom: 0;
}

/* ===== Form Labels ===== */
.cod-form-label {
	display: block;
	font-size: 0.95rem;
	font-weight: 500;
	color: #333333;
	margin-bottom: 0.5rem;
	cursor: pointer;
}

.cod-required {
	color: #dc3545;
	margin-left: 0.25rem;
	font-weight: 600;
}

.cod-optional {
	color: #999999;
	font-size: 0.85rem;
	font-weight: 400;
	margin-left: 0.25rem;
}

/* ===== Form Inputs ===== */
.cod-form-input,
.cod-form-select,
.cod-form-textarea {
	width: 100%;
	padding: 0.75rem;
	font-size: 1rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-family: inherit;
	transition: all 0.3s ease;
	background-color: #ffffff;
	color: #333333;
}

.cod-form-input:focus,
.cod-form-select:focus,
.cod-form-textarea:focus {
	outline: none;
	border-color: var(--cod-primary-color, #007cba);
	box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.cod-form-input::placeholder,
.cod-form-textarea::placeholder {
	color: #999999;
}

.cod-form-textarea {
	resize: vertical;
	min-height: 80px;
	line-height: 1.4;
}

/* Input validation states */
.cod-form-input.valid,
.cod-form-select.valid,
.cod-form-textarea.valid {
	border-color: #28a745;
	background-color: #f8fdf9;
}

.cod-form-input.invalid,
.cod-form-select.invalid,
.cod-form-textarea.invalid {
	border-color: #dc3545;
	background-color: #fdf8f8;
}

/* Valid checkmark */
.cod-form-input.valid::after,
.cod-form-select.valid::after {
	content: '✓';
	position: absolute;
	right: 0.75rem;
	color: #28a745;
	font-weight: bold;
}

/* ===== Error Messages ===== */
.cod-error-message {
	display: none;
	font-size: 0.85rem;
	color: #dc3545;
	margin-top: 0.25rem;
	font-weight: 500;
}

.cod-error-message.show {
	display: block;
	animation: slideDown 0.3s ease;
}

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

/* ===== Product Display ===== */
.cod-form-group.cod-product-display {
	flex-direction: row;
	align-items: flex-start;
	background-color: #f9f9f9;
	padding: 1rem;
	border-radius: 4px;
	border: 1px solid #f0f0f0;
}

.cod-product-image {
	margin-right: 1rem;
	flex-shrink: 0;
}

.cod-product-thumb {
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 4px;
}

.cod-product-info {
	flex: 1;
}

.cod-product-name {
	font-size: 1rem;
	font-weight: 600;
	color: #333333;
	margin: 0 0 0.5rem 0;
}

.cod-product-price {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--cod-primary-color, #007cba);
	margin: 0;
}

/* ===== Variations Section ===== */
.cod-variations-section {
	background-color: #f9f9f9;
	padding: 1rem;
	border-radius: 4px;
	margin-bottom: 1rem;
}

.cod-variations-title {
	font-size: 0.95rem;
	font-weight: 600;
	color: #333333;
	margin: 0 0 1rem 0;
}

/* ===== Price Breakdown ===== */
.cod-price-breakdown {
	background-color: #f9f9f9;
	padding: 1.5rem;
	border-radius: 4px;
	border: 1px solid #f0f0f0;
	margin-bottom: 1rem;
}

.cod-price-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
}

.cod-price-row {
	display: flex;
	justify-content: space-between;
	padding: 0.75rem 0;
	border-bottom: 1px solid #e0e0e0;
	font-size: 0.95rem;
}

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

.cod-price-row.cod-price-total {
	padding-top: 1rem;
	border-top: 2px solid var(--cod-primary-color, #007cba);
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--cod-primary-color, #007cba);
}

.cod-price-label {
	color: #666666;
	font-weight: 500;
}

.cod-price-value {
	text-align: right;
	color: #333333;
	font-weight: 600;
}

.cod-price-total .cod-price-value {
	color: var(--cod-primary-color, #007cba);
}

/* ===== Payment Method ===== */
.cod-payment-method {
	background-color: var(--cod-primary-color, #007cba);
	color: white;
	padding: 1rem;
	border-radius: 4px;
	margin-top: 1rem;
}

.cod-payment-info {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 500;
}

/* ===== Form Actions ===== */
.cod-form-actions {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin: 2rem 0 0 0;
	padding-top: 1.5rem;
	border-top: 1px solid #f0f0f0;
}

.cod-submit-btn {
	flex: 1;
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	color: white;
	background-color: var(--cod-primary-color, #007cba);
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cod-submit-btn:hover:not(:disabled) {
	opacity: 0.9;
	box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
	transform: translateY(-2px);
}

.cod-submit-btn:active:not(:disabled) {
	transform: translateY(0);
}

.cod-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cod-submit-loading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: #666666;
	font-size: 0.95rem;
	font-weight: 500;
}

/* ===== Messages ===== */
.cod-form-messages {
	margin-top: 1rem;
}

.cod-message {
	padding: 1rem;
	border-radius: 4px;
	margin-bottom: 0.75rem;
	font-size: 0.95rem;
	display: none;
	animation: slideDown 0.3s ease;
}

.cod-message.show {
	display: block;
}

.cod-message-success {
	background-color: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.cod-message-error {
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.cod-message-warning {
	background-color: #fff3cd;
	color: #856404;
	border: 1px solid #ffeaa7;
}

/* ===== Loading Spinner ===== */
.cod-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-top-color: var(--cod-primary-color, #007cba);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

/* ===== Character Counter ===== */
.cod-char-count {
	font-size: 0.8rem;
	color: #999999;
	margin-top: 0.25rem;
	text-align: right;
	display: block;
}

.cod-char-current {
	font-weight: 600;
	color: #666666;
}

/* ===== Commune Loading ===== */
.cod-commune-loading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: #666666;
	margin-top: 0.5rem;
}

/* ===== Disabled State ===== */
.cod-form-select:disabled {
	background-color: #f5f5f5;
	color: #999999;
	cursor: not-allowed;
	opacity: 0.6;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
	.cod-order-form-container {
		padding: 1.25rem;
		border-radius: 4px;
	}

	.cod-form-title {
		font-size: 1.25rem;
	}

	.cod-form-input,
	.cod-form-select,
	.cod-form-textarea {
		font-size: 16px; /* Prevent auto-zoom on iOS */
		padding: 0.875rem;
	}

	.cod-submit-btn {
		min-height: 48px;
	}

	.cod-form-group.cod-product-display {
		flex-direction: column;
	}

	.cod-product-image {
		margin-right: 0;
		margin-bottom: 1rem;
	}

	.cod-price-row {
		font-size: 0.9rem;
		padding: 0.6rem 0;
	}

	.cod-section-title::before {
		width: 3px;
		margin-right: 0.5rem;
	}
}

@media (max-width: 480px) {
	.cod-order-form-container {
		padding: 1rem;
	}

	.cod-form-title {
		font-size: 1.1rem;
	}

	.cod-form-subtitle {
		font-size: 0.85rem;
		margin-bottom: 1rem;
	}

	.cod-section-title {
		font-size: 1rem;
	}

	.cod-form-group {
		margin-bottom: 1.25rem;
	}

	.cod-form-actions {
		flex-direction: column;
		gap: 0.75rem;
	}

	.cod-submit-btn {
		width: 100%;
	}

	.cod-price-breakdown {
		padding: 1rem;
	}

	.cod-product-thumb {
		width: 60px;
		height: 60px;
	}

	.cod-form-group.cod-product-display {
		padding: 0.75rem;
	}

	.cod-message {
		padding: 0.75rem;
		font-size: 0.9rem;
	}
}

/* ===== Print Styles ===== */
@media print {
	.cod-form-actions,
	.cod-submit-loading,
	.cod-spinner {
		display: none;
	}
}
