/**
 * EU Withdrawal Button — Frontend Styles
 *
 * Flat black buttons, modal UI, float button, item selection grid.
 * Mobile-first, theme-agnostic, WCAG AA compliant.
 *
 * @package EWB
 */

/* ========================================================================
   Reset & Isolation — prevent theme conflicts
   ======================================================================== */

.ewb-btn,
.ewb-modal,
.ewb-overlay,
.ewb-float,
.ewb-order-withdrawal {
	box-sizing: border-box;
	font-family: inherit;
	line-height: 1.4;
}

/* ========================================================================
   Buttons — flat black, outline icon
   ======================================================================== */

.ewb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 22px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #ffffff;
	background: #1a1a1a;
	border: 2px solid #1a1a1a;
	border-radius: 0;
	cursor: pointer;
	text-decoration: none !important;
	transition: background 0.2s ease, color 0.2s ease;
	min-height: 44px;
	min-width: 44px;
	white-space: nowrap;
}

.ewb-btn:hover,
.ewb-btn:focus-visible {
	background: #ffffff;
	color: #1a1a1a;
	border-color: #1a1a1a;
}

.ewb-btn:focus-visible {
	outline: 2px solid #1a1a1a;
	outline-offset: 2px;
}

.ewb-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ewb-btn svg {
	flex-shrink: 0;
	transition: stroke 0.2s ease;
}

.ewb-btn:hover svg,
.ewb-btn:focus-visible svg {
	stroke: #1a1a1a;
}

.ewb-btn--sm {
	padding: 8px 16px;
	font-size: 12px;
	min-height: 36px;
}

.ewb-btn--confirm {
	font-size: 15px;
	font-weight: 700;
	padding: 14px 32px;
	margin-top: 16px;
	width: 100%;
}

/* ========================================================================
   Float button — fixed position, all pages
   ======================================================================== */

.ewb-float {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 9999;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	animation: ewbFloatIn 0.4s ease 0.5s both;
}

@keyframes ewbFloatIn {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
	.ewb-float {
		bottom: 16px;
		left: 16px;
		right: 16px;
	}

	.ewb-float .ewb-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ========================================================================
   Order page button & info
   ======================================================================== */

.ewb-order-withdrawal {
	margin: 20px 0;
	padding: 16px 0;
	border-top: 1px solid #e0e0e0;
}

.ewb-days-info {
	margin: 8px 0 0;
	font-size: 12px;
	color: #666;
}

/* ========================================================================
   Modal overlay
   ======================================================================== */

.ewb-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(2px);
	animation: ewbFadeIn 0.2s ease;
	overflow-y: auto;
	padding: 20px;
}

.ewb-overlay--active {
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

@keyframes ewbFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

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

.ewb-modal {
	position: relative;
	background: #ffffff;
	width: 100%;
	max-width: 560px;
	margin: 40px auto;
	padding: 32px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
	animation: ewbSlideUp 0.3s ease;
}

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

.ewb-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	z-index: 10;
	padding: 0;
	transition: background 0.2s;
}

.ewb-modal__close:hover {
	background: #f5f5f5;
}

.ewb-modal__close svg {
	width: 16px;
	height: 16px;
}

.ewb-modal__title {
	font-size: 20px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 4px;
	padding-right: 40px;
}

.ewb-modal__subtitle {
	font-size: 13px;
	color: #888;
	margin: 0 0 20px;
}

/* ========================================================================
   Guest lookup section
   ======================================================================== */

.ewb-guest {
	margin-bottom: 20px;
	padding: 16px;
	background: #fafafa;
	border: 1px solid #eee;
}

.ewb-guest__title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 12px;
}

.ewb-guest__row {
	margin-bottom: 12px;
}

.ewb-guest__row label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #555;
	margin-bottom: 4px;
}

.ewb-guest__row input {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	background: #fff;
	color: #1a1a1a;
}

.ewb-guest__row input:focus {
	border-color: #1a1a1a;
	outline: none;
}

/* ========================================================================
   Order picker (logged-in, float button)
   ======================================================================== */

.ewb-order-picker {
	margin-bottom: 20px;
}

.ewb-order-card {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	border: 1px solid #eee;
	margin-bottom: 8px;
	cursor: pointer;
	transition: border-color 0.2s;
}

.ewb-order-card:hover {
	border-color: #1a1a1a;
}

.ewb-order-card__info {
	font-size: 13px;
}

.ewb-order-card__id {
	font-weight: 700;
}

.ewb-order-card__meta {
	font-size: 11px;
	color: #888;
	margin-top: 2px;
}

.ewb-order-card__days {
	font-size: 11px;
	font-weight: 600;
	color: #c0392b;
	white-space: nowrap;
}

/* ========================================================================
   Items container
   ======================================================================== */

.ewb-items-container {
	margin-bottom: 16px;
}

.ewb-loading {
	color: #888;
	font-size: 13px;
	text-align: center;
	padding: 20px 0;
}

.ewb-item {
	display: flex;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
	align-items: flex-start;
}

.ewb-item:last-child {
	border-bottom: none;
}

.ewb-item--excluded {
	opacity: 0.5;
	pointer-events: none;
}

.ewb-item__check {
	flex-shrink: 0;
	margin-top: 4px;
}

.ewb-item__check input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: #1a1a1a;
	cursor: pointer;
}

.ewb-item__thumb {
	width: 48px;
	height: 48px;
	flex-shrink: 0;
	border: 1px solid #eee;
	object-fit: cover;
}

.ewb-item__details {
	flex: 1;
	min-width: 0;
}

.ewb-item__name {
	font-size: 14px;
	font-weight: 600;
	color: #1a1a1a;
	margin: 0 0 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ewb-item__price {
	font-size: 12px;
	color: #666;
	margin: 0 0 8px;
}

.ewb-item__excluded {
	font-size: 11px;
	color: #c0392b;
	font-style: italic;
}

.ewb-item__controls {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.ewb-item__qty-wrap {
	display: flex;
	align-items: center;
	gap: 4px;
}

.ewb-item__qty-wrap label {
	font-size: 11px;
	color: #888;
	white-space: nowrap;
}

.ewb-item__qty-wrap select {
	padding: 4px 8px;
	font-size: 13px;
	border: 1px solid #ddd;
	background: #fff;
}

.ewb-item__reason {
	flex: 1;
	min-width: 120px;
}

.ewb-item__reason select {
	width: 100%;
	padding: 4px 8px;
	font-size: 12px;
	border: 1px solid #ddd;
	background: #fff;
}

/* ========================================================================
   Summary bar
   ======================================================================== */

.ewb-summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: #1a1a1a;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 16px;
}

/* ========================================================================
   Contact email section
   ======================================================================== */

.ewb-contact {
	margin-bottom: 12px;
}

.ewb-contact__label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #555;
	margin-bottom: 4px;
}

.ewb-contact__input {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	background: #fff;
}

.ewb-contact__input:focus {
	border-color: #1a1a1a;
	outline: none;
}

/* ========================================================================
   Alert messages
   ======================================================================== */

.ewb-alert {
	padding: 12px 16px;
	font-size: 13px;
	margin-bottom: 12px;
}

.ewb-alert--error {
	background: #fdf2f2;
	color: #c0392b;
	border-left: 3px solid #c0392b;
}

.ewb-alert--success {
	background: #f0fdf4;
	color: #166534;
	border-left: 3px solid #166534;
}

/* ========================================================================
   Spinner
   ======================================================================== */

.ewb-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ewbSpin 0.6s linear infinite;
	margin-left: 8px;
}

.ewb-btn--loading .ewb-spinner {
	display: inline-block;
}

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

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

@media (max-width: 600px) {
	.ewb-modal {
		margin: 10px auto;
		padding: 20px 16px;
	}

	.ewb-modal__title {
		font-size: 17px;
	}

	.ewb-item {
		flex-wrap: wrap;
	}

	.ewb-item__controls {
		width: 100%;
	}

	.ewb-btn--confirm {
		font-size: 14px;
		padding: 12px 20px;
	}
}
