/**
 * Apex Bookings - Frontend CSS
 * Modern, scoped, responsive design
 */

:root {
	--apex-primary: #2563eb;
	--apex-primary-hover: #1d4ed8;
	--apex-primary-light: #eff6ff;
	--apex-accent: #059669;
	--apex-warning: #d97706;
	--apex-danger: #dc2626;
	--apex-text: #1f2937;
	--apex-text-muted: #6b7280;
	--apex-bg: #f9fafb;
	--apex-card-bg: #ffffff;
	--apex-border: #e5e7eb;
	--apex-border-focus: #3b82f6;
	--apex-radius: 12px;
	--apex-radius-sm: 8px;
	--apex-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.08);
	--apex-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
	--apex-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.apex-booking-app {
	font-family: var(--apex-font);
	color: var(--apex-text);
	background: var(--apex-card-bg);
	border: 1px solid var(--apex-border);
	border-radius: var(--apex-radius);
	box-shadow: var(--apex-shadow);
	max-width: 860px;
	margin: 24px auto;
	padding: 0;
	overflow: hidden;
	box-sizing: border-box;
}

.apex-booking-app *,
.apex-booking-app *::before,
.apex-booking-app *::after {
	box-sizing: border-box;
}

/* App Header & Mode Switcher */
.apex-app-header {
	background: #f8fafc;
	border-bottom: 1px solid var(--apex-border);
	padding: 12px 20px;
}

.apex-mode-switcher {
	display: flex;
	gap: 10px;
	background: #e2e8f0;
	padding: 4px;
	border-radius: var(--apex-radius-sm);
	max-width: 440px;
	margin: 0 auto;
}

.apex-mode-tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	border: none;
	background: transparent;
	color: var(--apex-text-muted);
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.apex-mode-tab:hover {
	color: var(--apex-text);
}

.apex-mode-tab.active {
	background: #ffffff;
	color: var(--apex-primary);
	box-shadow: var(--apex-shadow-sm);
}

/* Views & Panels */
.apex-app-content {
	padding: 28px;
}

.apex-view-panel {
	display: none;
}

.apex-view-panel.active {
	display: block;
	animation: apexFadeIn 0.3s ease;
}

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

/* Wizard Steps */
.apex-step-content {
	display: none;
}

.apex-step-content.active {
	display: block;
	animation: apexFadeIn 0.3s ease;
}

/* Stepper Header */
.apex-stepper-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 32px;
	position: relative;
	max-width: 600px;
	margin-left: auto;
	margin-right: auto;
}

.apex-step-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	position: relative;
	z-index: 2;
	flex: 1;
}

.apex-step-circle {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #f1f5f9;
	border: 2px solid #cbd5e1;
	color: #64748b;
	font-weight: 700;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.apex-step-label {
	font-size: 13px;
	font-weight: 600;
	color: #64748b;
	transition: color 0.3s ease;
}

.apex-step-item.active .apex-step-circle {
	background: var(--apex-primary);
	border-color: var(--apex-primary);
	color: #ffffff;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.apex-step-item.active .apex-step-label {
	color: var(--apex-primary);
}

.apex-step-item.completed .apex-step-circle {
	background: var(--apex-accent);
	border-color: var(--apex-accent);
	color: #ffffff;
}

.apex-step-line {
	flex: 1;
	height: 3px;
	background: #e2e8f0;
	margin: 0 -15px 22px;
	z-index: 1;
	transition: background 0.3s ease;
}

.apex-step-line.completed {
	background: var(--apex-accent);
}

/* Step Headings */
.apex-step-heading {
	margin-bottom: 24px;
}

.apex-step-heading .apex-title {
	font-size: 22px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 6px 0;
}

.apex-step-heading .apex-subtitle {
	font-size: 14px;
	color: var(--apex-text-muted);
	margin: 0;
}

/* Step 1: Date & Time Selector */
.apex-datetime-selector {
	display: grid;
	grid-template-columns: 1fr 1.6fr;
	gap: 24px;
	margin-bottom: 24px;
}

@media (max-width: 768px) {
	.apex-datetime-selector {
		grid-template-columns: 1fr;
	}
}

.apex-field-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 8px;
}

.apex-date-input {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	border: 1.5px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	color: var(--apex-text);
	background: #ffffff;
	outline: none;
	transition: all 0.2s ease;
}

.apex-date-input:focus {
	border-color: var(--apex-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.apex-date-helper-text {
	font-size: 12px;
	color: var(--apex-text-muted);
	margin-top: 6px;
}

/* Slots Grid */
.apex-slots-section {
	background: #f8fafc;
	border: 1px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	padding: 16px;
	min-height: 240px;
}

.apex-slots-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 10px;
	margin-top: 12px;
	max-height: 320px;
	overflow-y: auto;
	padding-right: 4px;
}

.apex-slots-placeholder {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px 10px;
	color: var(--apex-text-muted);
}

.apex-slots-placeholder .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	margin-bottom: 10px;
	color: #94a3b8;
}

.apex-slot-pill {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 10px 8px;
	border: 1.5px solid #cbd5e1;
	border-radius: var(--apex-radius-sm);
	background: #ffffff;
	color: #1e293b;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
	user-select: none;
}

.apex-slot-pill:hover:not(.disabled) {
	border-color: var(--apex-primary);
	background: var(--apex-primary-light);
	color: var(--apex-primary);
}

.apex-slot-pill.selected {
	background: var(--apex-primary);
	border-color: var(--apex-primary);
	color: #ffffff;
	box-shadow: 0 4px 8px -2px rgba(37, 99, 235, 0.4);
}

.apex-slot-pill.disabled {
	opacity: 0.45;
	background: #f1f5f9;
	border-color: #e2e8f0;
	cursor: not-allowed;
}

.apex-slot-reason {
	font-size: 10px;
	font-weight: 500;
	color: #94a3b8;
	margin-top: 2px;
}

/* Step 2: Service Selection */
.apex-services-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.apex-service-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	border: 1.5px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	background: #ffffff;
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
}

.apex-service-card:hover {
	border-color: #93c5fd;
	box-shadow: var(--apex-shadow-sm);
}

.apex-service-card.selected {
	border-color: var(--apex-primary);
	background: #f0f7ff;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.apex-card-checkbox {
	margin-top: 2px;
}

.apex-card-checkbox input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--apex-primary);
	cursor: pointer;
}

.apex-card-details {
	flex: 1;
}

.apex-service-name {
	font-size: 15px;
	font-weight: 600;
	color: #0f172a;
	margin: 0 0 6px 0;
}

.apex-service-meta {
	display: flex;
	align-items: center;
	gap: 8px;
}

.apex-duration-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 500;
	color: #64748b;
	background: #f1f5f9;
	padding: 2px 8px;
	border-radius: 10px;
}

.apex-card-price .apex-price {
	font-size: 16px;
	font-weight: 700;
	color: var(--apex-accent);
}

/* Running Total Bar */
.apex-running-total-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #f8fafc;
	border: 1.5px solid #e2e8f0;
	border-radius: var(--apex-radius-sm);
	padding: 14px 20px;
	margin-bottom: 24px;
}

.apex-total-item {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.apex-total-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--apex-text-muted);
}

.apex-total-val {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
}

.apex-total-highlight .apex-total-val {
	font-size: 18px;
	color: var(--apex-accent);
}

/* Step 3: Layout & Inputs */
.apex-step3-layout {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 24px;
	margin-bottom: 24px;
}

@media (max-width: 768px) {
	.apex-step3-layout {
		grid-template-columns: 1fr;
	}
}

.apex-input-row {
	display: flex;
	gap: 14px;
	margin-bottom: 14px;
}

.apex-input-group {
	flex: 1;
}

.apex-input-group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 6px;
}

.apex-input-group .required {
	color: var(--apex-danger);
}

.apex-input {
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	border: 1.5px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	background: #ffffff;
	color: var(--apex-text);
	outline: none;
	transition: all 0.2s ease;
}

.apex-input:focus {
	border-color: var(--apex-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

/* Summary Card */
.apex-summary-card {
	background: #f8fafc;
	border: 1px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	padding: 18px;
}

.apex-summary-title {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 14px 0;
	border-bottom: 1px solid #e2e8f0;
	padding-bottom: 8px;
}

.apex-summary-line {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
	font-size: 13px;
}

.apex-sum-label {
	color: var(--apex-text-muted);
}

.apex-sum-val {
	color: #0f172a;
	text-align: right;
}

.apex-summary-divider {
	height: 1px;
	background: #e2e8f0;
	margin: 12px 0;
}

.apex-sum-total-row {
	font-size: 15px;
	font-weight: 700;
}

.apex-highlight-price {
	color: var(--apex-accent);
	font-size: 18px;
}

/* Buttons & Footers */
.apex-step-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-top: 1px solid var(--apex-border);
	padding-top: 20px;
	margin-top: 10px;
}

.apex-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 22px;
	font-size: 14px;
	font-weight: 600;
	border-radius: var(--apex-radius-sm);
	cursor: pointer;
	border: none;
	transition: all 0.2s ease;
	text-decoration: none;
}

.apex-btn-primary {
	background: var(--apex-primary);
	color: #ffffff;
}

.apex-btn-primary:hover:not(:disabled) {
	background: var(--apex-primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 10px -2px rgba(37, 99, 235, 0.4);
}

.apex-btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.apex-btn-secondary {
	background: #f1f5f9;
	color: #334155;
	border: 1px solid #cbd5e1;
}

.apex-btn-secondary:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.apex-btn-danger {
	background: var(--apex-danger);
	color: #ffffff;
}

.apex-btn-danger:hover {
	background: #b91c1c;
}

/* Confirmation Screen */
.apex-confirmation-card {
	text-align: center;
	padding: 30px 10px;
	max-width: 540px;
	margin: 0 auto;
}

.apex-conf-icon {
	width: 72px;
	height: 72px;
	background: #dcfce7;
	color: #16a34a;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.apex-conf-title {
	font-size: 24px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 8px 0;
}

.apex-conf-subtitle {
	font-size: 14px;
	color: var(--apex-text-muted);
	margin: 0 0 24px 0;
	line-height: 1.5;
}

.apex-booking-id-box {
	background: #f8fafc;
	border: 2px dashed #93c5fd;
	border-radius: var(--apex-radius-sm);
	padding: 16px;
	margin-bottom: 24px;
}

.apex-id-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #64748b;
	margin-bottom: 6px;
}

.apex-id-flex {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.apex-id-code {
	font-family: monospace;
	font-size: 22px;
	font-weight: 700;
	color: var(--apex-primary);
	letter-spacing: 1px;
}

.apex-copy-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 600;
	color: #334155;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	cursor: pointer;
}

.apex-copy-btn:hover {
	background: #f1f5f9;
}

.apex-conf-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	margin-top: 24px;
}

/* Lookup Widget */
.apex-lookup-card {
	background: #f8fafc;
	border: 1px solid var(--apex-border);
	border-radius: var(--apex-radius-sm);
	padding: 24px;
	margin-bottom: 24px;
}

.apex-lookup-form-grid {
	display: flex;
	gap: 16px;
	margin-bottom: 18px;
}

@media (max-width: 600px) {
	.apex-lookup-form-grid {
		flex-direction: column;
	}
}

.apex-lookup-actions {
	text-align: right;
}

.apex-booking-detail-card {
	background: #ffffff;
	border: 1.5px solid #cbd5e1;
	border-radius: var(--apex-radius);
	padding: 24px;
	box-shadow: var(--apex-shadow-sm);
}

.apex-detail-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #e2e8f0;
	padding-bottom: 14px;
	margin-bottom: 18px;
}

.apex-id-badge {
	font-family: monospace;
	font-size: 18px;
	font-weight: 700;
	color: #0f172a;
	margin-right: 10px;
}

.apex-status-badge {
	display: inline-block;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 12px;
	text-transform: capitalize;
}

.apex-status-pending { background: #fef3c7; color: #92400e; }
.apex-status-approved { background: #dcfce7; color: #166534; }
.apex-status-cancelled { background: #fee2e2; color: #991b1b; }
.apex-status-refunded { background: #e0e7ff; color: #3730a3; }
.apex-status-completed { background: #e0f2fe; color: #0369a1; }

.apex-payment-status-badge {
	display: inline-block;
	padding: 2px 7px;
	font-size: 11px;
	font-weight: 600;
	border-radius: 4px;
	text-transform: capitalize;
}

.apex-payment-paid { background: #dcfce7; color: #15803d; }
.apex-payment-unpaid { background: #f1f5f9; color: #64748b; }
.apex-payment-pending { background: #fef3c7; color: #b45309; }
.apex-payment-failed { background: #fee2e2; color: #b91c1c; }
.apex-payment-refunded { background: #e0e7ff; color: #4338ca; }

.apex-gateway-pill {
	display: inline-block;
	padding: 2px 7px;
	font-size: 10px;
	font-weight: 700;
	border-radius: 3px;
	text-transform: uppercase;
}

.apex-gateway-pill-stripe { background: #635bff; color: #ffffff; }
.apex-gateway-pill-paypal { background: #0070ba; color: #ffffff; }

/* Prominent Status Alerts */
.apex-status-alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--apex-radius-sm);
	font-size: 13px;
	line-height: 1.5;
}

.apex-status-alert svg {
	flex-shrink: 0;
	margin-top: 2px;
}

.apex-alert-refunded {
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	color: #3730a3;
}

.apex-alert-cancelled {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.apex-alert-completed {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.apex-btn-text-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	color: var(--apex-primary);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.apex-detail-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin-bottom: 20px;
}

.apex-detail-item {
	font-size: 13px;
}

.apex-detail-item.apex-col-full {
	grid-column: 1 / -1;
}

.apex-item-label {
	display: block;
	color: var(--apex-text-muted);
	margin-bottom: 2px;
}

.apex-item-val {
	color: #0f172a;
}

.apex-highlight-date {
	font-size: 15px;
	color: var(--apex-primary);
}

.apex-cancel-section {
	border-top: 1px solid #e2e8f0;
	padding-top: 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.apex-cancel-info {
	font-size: 12px;
	color: var(--apex-text-muted);
}

/* Spinner */
.apex-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: apexSpin 0.7s linear infinite;
}

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

/* Payment Gateway Integration */
.apex-payment-section {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid #e2e8f0;
}

.apex-payment-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 14px 0;
}

.apex-payment-title svg {
	color: var(--apex-primary);
}

.apex-payment-methods {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 16px;
}

.apex-gateway-option {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 2px solid #e2e8f0;
	border-radius: 8px;
	background: #ffffff;
	cursor: pointer;
	transition: all 0.2s ease;
}

.apex-gateway-option input[type="radio"] {
	display: none;
}

.apex-gateway-custom {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid #cbd5e1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.apex-gateway-custom::after {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ffffff;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.apex-gateway-option.active {
	border-color: var(--apex-primary);
	background: #f8faff;
}

.apex-gateway-option.active .apex-gateway-custom {
	border-color: var(--apex-primary);
	background: var(--apex-primary);
}

.apex-gateway-option.active .apex-gateway-custom::after {
	opacity: 1;
}

.apex-gateway-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.apex-gateway-name {
	font-size: 14px;
	font-weight: 600;
	color: #0f172a;
}

.apex-gateway-desc {
	font-size: 12px;
	color: var(--apex-text-muted);
}

.apex-gateway-badge {
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
	text-transform: uppercase;
}

.apex-gateway-badge.stripe-badge {
	background: #635bff;
	color: #ffffff;
}

.apex-gateway-badge.paypal-badge {
	background: #003087;
	color: #0070ba;
	background: #e6f0fa;
}

.apex-gateway-panel {
	margin-top: 14px;
}

.apex-stripe-element-container {
	padding: 12px 14px;
	border: 1.5px solid #cbd5e1;
	border-radius: 6px;
	background: #ffffff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	margin-top: 6px;
}

.apex-stripe-element-container.StripeElement--focus {
	border-color: var(--apex-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.apex-paypal-element-container {
	margin-top: 10px;
	min-height: 45px;
}

.apex-payment-error {
	color: #dc2626;
	font-size: 13px;
	margin-top: 6px;
	min-height: 18px;
	font-weight: 500;
}
