:root {
	--foodord-bg: #ffffff;
	--foodord-bg-alt: #f8fafc;
	--foodord-border: #e2e8f0;
	--foodord-border-hover: #cbd5e1;
	--foodord-text: #1e293b;
	--foodord-text-muted: #64748b;
	--foodord-primary: #2563eb;
	--foodord-primary-hover: #1d4ed8;
	--foodord-danger: #ef4444;
	--foodord-danger-hover: #dc2626;
	--foodord-radius: 8px;
}

/* Base Field Styling */
.foodord-timed-field {
	margin-bottom: 24px;
}

.foodord-timed-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--foodord-text);
	margin-bottom: 10px;
}

.foodord-timed-segmented-control {
	border: 0;
	padding: 0;
	margin: 0 0 24px;
	min-width: 0;
}

.foodord-timed-segmented-control__group {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px;
}

.foodord-timed-segmented-control__input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.foodord-timed-segmented-control__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 0 14px;
	border: 1px solid #d5deea;
	border-radius: 999px;
	background: #f8fafc;
	color: #0f172a;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	user-select: none;
}

.foodord-timed-segmented-control__input:focus + .foodord-timed-segmented-control__button {
	outline: none;
	border-color: var(--foodord-primary);
	box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.foodord-timed-segmented-control__input:checked + .foodord-timed-segmented-control__button {
	background: #eff6ff;
	border-color: #bfdbfe;
	color: #1d4ed8;
}

/* Current Time Header */
.foodord-timed-current-time {
	background: var(--foodord-bg);
	border: 1px solid var(--foodord-border);
	padding: 16px 20px;
	border-radius: var(--foodord-radius);
	margin-bottom: 24px;
	display: flex;
	align-items: center;
	gap: 16px;
}

.foodord-timed-current-time .dashicons-clock {
	font-size: 24px;
	width: 24px;
	height: 24px;
	color: var(--foodord-primary);
}

.foodord-timed-current-time strong {
	color: var(--foodord-text);
	font-weight: 700;
	font-size: 14px;
}

.foodord-timed-timezone {
	color: var(--foodord-text-muted);
	font-size: 12px;
}

.foodord-timed-current-time a {
	color: var(--foodord-primary);
	text-decoration: none;
	font-weight: 500;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s;
}

.foodord-timed-current-time a:hover {
	border-color: var(--foodord-primary);
}

/* Schedule Wrapper & Items */
.foodord-timed-schedule-wrapper {
	display: flex;
	flex-direction: column;
	gap: 32px;
	margin-top: 20px;
}

.foodord-timed-schedule-item {
	background: var(--foodord-bg);
	border: 1px solid var(--foodord-border);
	border-radius: var(--foodord-radius);
	transition: border-color 0.2s;
	position: relative;
}

.foodord-timed-schedule-item:hover {
	border-color: var(--foodord-border-hover);
}

.foodord-timed-schedule-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: var(--foodord-bg-alt);
	border-bottom: 1px solid var(--foodord-border);
	border-radius: var(--foodord-radius) var(--foodord-radius) 0 0;
}

.foodord-timed-schedule-header strong {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--foodord-text-muted);
}

.foodord-timed-schedule-header strong .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

.foodord-timed-schedule-body {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Schedule Fields */
.foodord-schedule-field {
	margin-bottom: 0;
}

.foodord-timed-day-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 0;
}

.foodord-timed-day {
	position: relative;
	cursor: pointer;
}

.foodord-timed-day input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	cursor: pointer;
	height: 0;
	width: 0;
	margin: 0;
}

.foodord-timed-day span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 36px;
	padding: 0 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--foodord-text);
	background: var(--foodord-bg);
	border: 1px solid var(--foodord-border);
	border-radius: 8px;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	user-select: none;
}

.foodord-timed-day:hover span {
	border-color: var(--foodord-primary);
	color: var(--foodord-primary);
	background: #f0f7ff;
}

.foodord-timed-day input[type="checkbox"]:checked+span {
	background: var(--foodord-primary);
	border-color: var(--foodord-primary);
	color: #fff;
}

.foodord-timed-day input[type="checkbox"]:focus+span {
	border-color: var(--foodord-primary);
}

.foodord-schedule-logic {
	position: absolute;
	top: -16px;
	left: 50%;
	transform: translate(-50%, -50%);
	background: var(--foodord-text);
	color: #fff;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	z-index: 2;
}

.foodord-schedule-logic.is-hidden {
	display: none;
}

.foodord-timed-schedule-body select,
.foodord-condition-row select,
.foodord-timed-schedule-body input[type="time"],
.foodord-timed-schedule-body input[type="date"] {
	appearance: none;
	border: 1px solid var(--foodord-border);
	border-radius: 6px;
	padding: 4px 12px;
	height: 40px;
	font-size: 13px;
	background-color: var(--foodord-bg);
	color: var(--foodord-text);
	transition: all 0.2s;
	width: 100%;
	box-sizing: border-box;
}

.foodord-timed-schedule-body select,
.foodord-condition-row select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: calc(100% - 12px) 50%;
	background-size: 14px;
	padding-right: 36px;
	cursor: pointer;
}

.foodord-timed-schedule-body select:hover,
.foodord-condition-row select:hover {
	background-color: #f8fafc;
	border-color: var(--foodord-border-hover);
}

.foodord-timed-schedule-body select:focus,
.foodord-condition-row select:focus,
.foodord-timed-schedule-body input:focus {
	border-color: var(--foodord-primary);
	outline: none;
}

.foodord-timed-time-inputs,
.foodord-timed-date-range-inputs {
	display: flex;
	align-items: center;
	gap: 12px;
}

.foodord-timed-time-separator {
	color: var(--foodord-text-muted);
	font-weight: 400;
}

/* Conditions Section */
.foodord-timed-condition-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}

@keyframes foodordFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.foodord-condition-row {
	display: grid;
	grid-template-columns: 48px 160px 160px 1fr 48px;
	align-items: center;
	gap: 16px;
	background: var(--foodord-bg);
	border: 1px solid var(--foodord-border);
	border-radius: var(--foodord-radius);
	padding: 12px 16px;
	transition: all 0.2s ease;
	animation: foodordFadeIn 0.3s ease-out;
	width: 100%;
	box-sizing: border-box;
	min-width: 0;
}

.foodord-condition-row:hover {
	border-color: var(--foodord-border-hover);
}

.foodord-condition-logic {
	font-weight: 700;
	font-size: 10px;
	background: var(--foodord-text);
	color: #fff;
	padding: 2px 4px;
	border-radius: 4px;
	text-transform: uppercase;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 18px;
	justify-self: center;
}

.foodord-remove-condition {
	justify-self: center;
}

.foodord-condition-row select {
	width: 100%;
	margin: 0;
}

.foodord-condition-value {
	display: flex;
	flex-direction: column;
	min-width: 0;
	width: 100%;
}

.foodord-condition-product,
.foodord-condition-category {
	display: block;
	width: 100%;
}

.foodord-condition-product.is-hidden,
.foodord-condition-category.is-hidden,
.foodord-schedule-field.is-hidden,
.is-hidden:not(.foodord-condition-logic) {
	display: none;
}

.foodord-condition-logic.is-hidden {
	display: inline-flex;
	visibility: hidden;
}

.foodord-condition-value .select2-container.select2-container--default {
	width: 100%;
	/* Width is enforced via JS after wc-enhanced-select-init to avoid !important */
}

.foodord-condition-value .select2-container--default .select2-selection--multiple {
	border: 1px solid var(--foodord-border);
	border-radius: var(--foodord-radius);
	min-height: 40px;
	padding: 4px 12px;
	background: var(--foodord-bg);
	display: flex;
	flex-wrap: wrap;
	transition: all 0.2s;
}

.foodord-condition-value .select2-container--default.select2-container--focus .select2-selection--multiple {
	border-color: var(--foodord-primary);
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-selection__rendered {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 0;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-selection__choice {
	background-color: #f1f5f9;
	border: 1px solid var(--foodord-border);
	border-radius: 6px;
	padding: 4px 10px;
	height: 20px;
	font-size: 12px;
	font-weight: 500;
	color: var(--foodord-text);
	display: flex;
	align-items: center;
	gap: 6px;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
	border: none;
	background: transparent;
	color: var(--foodord-text-muted);
	font-size: 16px;
	font-weight: 400;
	margin-right: 0;
	transition: color 0.2s;
	cursor: pointer;
	order: 2;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
	color: var(--foodord-danger);
	background: transparent;
}

.foodord-condition-value .select2-container--default .select2-results__option {
	padding: 12px 16px;
	font-size: 13px;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
	margin: 0;
	padding: 0 4px;
	height: 32px;
	line-height: 32px;
	font-family: inherit;
	font-size: 13px;
	color: var(--foodord-text);
	width: 100%;
	min-width: 150px;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field::placeholder {
	color: var(--foodord-text-muted);
	opacity: 1;
}

.foodord-condition-value .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
	color: var(--foodord-text-muted);
	font-size: 13px;
	margin: 0;
	display: block;
}

/* Buttons */
.foodord-timed-actions {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid var(--foodord-border);
}

.foodord-timed-actions button.button-secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 38px;
	padding: 0 16px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
	border-radius: 999px;
	border: 1px solid #d5deea;
	background: #f8fafc;
	color: #0f172a;
	box-shadow: none;
	min-width: 0;
}

.foodord-timed-actions button.button-secondary:hover {
	border-color: #b9c7d8;
	background: #f1f5f9;
	color: #0f172a;
}

.foodord-timed-actions button .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
	color: #475569;
}

.foodord-remove-schedule,
.foodord-remove-condition {
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	color: #64748b;
	background: #f8fafc;
	border: 1px solid #dbe4ee;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 0;
}

.foodord-remove-schedule:hover,
.foodord-remove-condition:hover {
	background: #fff5f5;
	border-color: #fecaca;
	color: #dc2626;
}

/* Responsive */
@media (max-width: 1100px) {
	.foodord-condition-row {
		grid-template-columns: 48px 150px 150px 1fr 48px;
	}
}

@media (max-width: 960px) {
	.foodord-condition-row {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
		position: relative;
	}

	.foodord-condition-logic {
		grid-column: span 2;
		width: max-content;
	}

	.foodord-condition-value {
		grid-column: span 2;
	}

	.foodord-remove-condition {
		position: absolute;
		top: 12px;
		right: 12px;
	}
}

@media (max-width: 782px) {
	.foodord-timed-current-time {
		flex-direction: column;
		align-items: flex-start;
	}

	.foodord-timed-segmented-control__group {
		display: flex;
	}

	.foodord-timed-time-inputs,
	.foodord-timed-date-range-inputs {
		flex-direction: column;
		align-items: stretch;
	}

	.foodord-timed-time-separator {
		text-align: center;
		padding: 4px 0;
	}
}
