/**
 * Frontend Styles
 * Styles for Amazon button, Wholesale button, and modal
 *
 * @package sisamn-product-extensions
 */

/* ========================================
   Button Wrapper Styles - Match Add to Cart
   ======================================== */

/* Amazon button - inline with Add to Cart */
.spe-amazon-button-wrapper {
	display: inline-block !important;
	vertical-align: middle;
	margin-left: 10px;
	margin-top: 0;
}

/* Wholesale button - full width below */
.spe-wholesale-button-wrapper {
	margin-top: 15px;
	width: 100%;
	display: block;
}

/* ========================================
   Amazon Button - Text Mode
   ======================================== */

.spe-amazon-button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px;
	text-decoration: none !important;
	white-space: nowrap;
	box-sizing: border-box !important;
}

.spe-amazon-icon {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
}

/* ========================================
   Amazon Button - Image Badge Mode
   ======================================== */

.spe-amazon-button-image {
	display: inline-block !important;
	text-decoration: none !important;
	vertical-align: middle;
}

.spe-amazon-badge-image {
	display: block !important;
	width: auto !important;
	height: 42px !important;
	max-height: 42px !important;
	object-fit: contain !important;
	object-position: center !important;
	border: none !important;
}

/* ========================================
   Wholesale Button Styles
   ======================================== */

.spe-wholesale-button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px;
	cursor: pointer;
	width: 100% !important;
	box-sizing: border-box !important;
	text-decoration: none !important;
}

/* ========================================
   Modal Styles
   ======================================== */

.spe-modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	z-index: 999999;
	overflow-y: auto;
	padding: 20px;
}

.spe-modal-overlay.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.spe-modal {
	background: #fff;
	border-radius: 8px;
	max-width: 600px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spe-modal-header {
	padding: 20px 24px;
	border-bottom: 1px solid #e0e0e0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.spe-modal-title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.spe-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #999;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.spe-modal-close:hover {
	color: #333;
}

.spe-modal-body {
	padding: 24px;
}

.spe-modal-product-info {
	background: #f5f5f5;
	padding: 16px;
	border-radius: 6px;
	margin-bottom: 20px;
	border: 1px solid #e0e0e0;
}

.spe-modal-product-info p {
	margin: 4px 0;
	color: #333;
	font-size: 14px;
}

.spe-modal-product-info strong {
	color: #333;
	font-weight: 600;
}

.spe-form-row {
	margin-bottom: 16px;
}

.spe-form-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	color: #333;
	font-size: 14px;
}

.spe-form-label .required {
	color: #dc3545;
	margin-left: 2px;
}

.spe-form-input,
.spe-form-select,
.spe-form-textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	font-family: inherit;
	background-color: #fff;
	box-sizing: border-box;
}

.spe-form-input:focus,
.spe-form-select:focus,
.spe-form-textarea:focus {
	outline: none;
	border-color: #0085ba;
	box-shadow: 0 0 0 2px rgba(0, 133, 186, 0.1);
}

.spe-form-input.error,
.spe-form-select.error,
.spe-form-textarea.error {
	border-color: #dc3545;
}

.spe-form-error {
	color: #dc3545;
	font-size: 12px;
	margin-top: 4px;
	display: none;
}

.spe-form-error.show {
	display: block;
}

.spe-form-textarea {
	min-height: 80px;
	resize: vertical;
}

.spe-form-description {
	font-size: 12px;
	color: #777;
	margin-top: 4px;
}

.spe-modal-footer {
	padding: 16px 24px;
	border-top: 1px solid #e0e0e0;
	display: flex;
	justify-content: stretch;
	align-items: center;
	gap: 10px;
	background-color: #fafafa;
}

/* Modal Buttons - Equal width, fill container */
.spe-modal-footer .spe-btn {
	flex: 1;
	min-width: 0;
	text-align: center;
}

.spe-btn-primary {
	/* Will inherit from .button class */
}

.spe-btn-secondary {
	background-color: #f5f5f5 !important;
	color: #333 !important;
	border: 1px solid #ddd !important;
}

.spe-btn-secondary:hover {
	background-color: #e5e5e5 !important;
	border-color: #ccc !important;
}

/* Loading Spinner */
.spe-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: spin 0.6s linear infinite;
	margin-right: 6px;
}

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

/* Success/Error Messages */
.spe-message {
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 16px;
	font-size: 14px;
	display: none;
}

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

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

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

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
	.spe-modal {
		margin: 10px;
		max-height: calc(100vh - 20px);
	}

	.spe-modal-overlay {
		padding: 10px;
	}

	.spe-modal-header,
	.spe-modal-body,
	.spe-modal-footer {
		padding: 16px;
	}

	.spe-modal-title {
		font-size: 18px;
	}

	.spe-amazon-badge-image {
		height: 38px !important;
		max-height: 38px !important;
	}

	.spe-amazon-button-wrapper {
		margin-left: 8px;
	}
}

@media (max-width: 480px) {
	.spe-modal-footer {
		flex-direction: row;
		gap: 8px;
	}

	.spe-modal-footer .spe-btn {
		flex: 1;
		padding: 12px 10px;
		font-size: 14px;
	}

	.spe-amazon-badge-image {
		height: 34px !important;
		max-height: 34px !important;
	}

	/* Stack buttons on very small screens */
	.spe-amazon-button-wrapper {
		display: block !important;
		margin-left: 0;
		margin-top: 10px;
		width: 100%;
	}

	.spe-amazon-button {
		width: 100% !important;
	}

	.spe-amazon-button-image {
		display: block !important;
		width: 100%;
	}

	.spe-amazon-badge-image {
		width: 100% !important;
	}
}
