/**
 * ModernBooking — Frontend Booking Stylesheet
 * Dark Theme Design — VibeFitness branding
 *
 * @package  com_modernbooking
 * @since    1.5.0
 */

/* ── Brand & Dark Theme Variables ─────────────────── */
:root {
	--vf-primary: #c71010;
	--vf-primary-hover: #e01818;
	--vf-primary-light: rgba(199, 16, 16, 0.15);
	--vf-primary-border: rgba(199, 16, 16, 0.4);
	--vf-primary-glow: rgba(199, 16, 16, 0.25);
	--vf-transition: 0.2s ease;

	/* Dark theme surfaces */
	--vf-surface: rgba(255, 255, 255, 0.04);
	--vf-surface-hover: rgba(255, 255, 255, 0.07);
	--vf-surface-elevated: rgba(255, 255, 255, 0.06);
	--vf-border: rgba(255, 255, 255, 0.1);
	--vf-border-subtle: rgba(255, 255, 255, 0.06);

	/* Text hierarchy */
	--vf-text: #f0f0f0;
	--vf-text-secondary: rgba(255, 255, 255, 0.6);
	--vf-text-muted: rgba(255, 255, 255, 0.4);

	/* Calendar selection — cool slate */
	--vf-cal-selected: #2d3748;
	--vf-cal-selected-border: #4a5568;
	--vf-cal-selected-glow: rgba(74, 85, 104, 0.5);

	/* Timeslot selection — warm ember */
	--vf-slot-selected: #4a2020;
	--vf-slot-selected-border: #7f2b2b;
	--vf-slot-selected-text: #fca5a5;
	--vf-slot-selected-hover: #5a2424;

	/* Status colors */
	--vf-booked-bg: rgba(255, 255, 255, 0.05);
	--vf-booked-border: rgba(255, 255, 255, 0.08);
	--vf-booked-text: rgba(255, 255, 255, 0.35);
}

/* ── Alpine.js Visibility ────────────────────────────── */
[x-cloak] { display: none !important; }

/* Override Bootstrap's !important display utilities when Alpine x-show hides elements */
.modernbooking-frontend [style*="display: none"] {
	display: none !important;
}

/* ── Base Typography & Color Overrides ────────────── */
.modernbooking-frontend {
	color: var(--vf-text);
}

.modernbooking-frontend .text-muted {
	color: var(--vf-text-secondary) !important;
}

.modernbooking-frontend h1,
.modernbooking-frontend h2,
.modernbooking-frontend h3,
.modernbooking-frontend h4,
.modernbooking-frontend h5,
.modernbooking-frontend h6 {
	color: var(--vf-text);
}

.modernbooking-frontend a:not(.btn) {
	color: var(--vf-primary);
}
.modernbooking-frontend a:not(.btn):hover {
	color: var(--vf-primary-hover);
}

/* ── VibeFitness Brand Utilities ──────────────────── */
.bg-vf-primary { background-color: var(--vf-primary) !important; }
.text-vf-primary { color: var(--vf-primary) !important; }
.border-vf-primary { border-color: var(--vf-primary) !important; }

.btn-vf-primary {
	background: var(--vf-primary) !important;
	border-color: var(--vf-primary) !important;
	color: #fff !important;
	font-weight: 600 !important;
	transition: all var(--vf-transition) !important;
	font-size: 1rem !important;
	padding: 0.35rem 0.9rem !important;
	letter-spacing: 0.02em !important;
	text-transform: none !important;
}
.btn-vf-primary:hover,
.btn-vf-primary:focus {
	background: var(--vf-primary-hover);
	border-color: var(--vf-primary-hover);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 4px 20px var(--vf-primary-glow);
}
.btn-vf-primary:active {
	transform: translateY(0);
}
.btn-vf-primary:disabled {
	background: rgba(255, 255, 255, 0.15);
	border-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.4);
	transform: none;
	box-shadow: none;
}

/* ── Dark Cards ──────────────────────────────────── */
.modernbooking-frontend .card {
	background: var(--vf-surface);
	border: 1px solid var(--vf-border);
	color: var(--vf-text);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.modernbooking-frontend .card-header {
	background: var(--vf-surface-elevated);
	border-bottom: 1px solid var(--vf-border-subtle);
	color: var(--vf-text);
}

.modernbooking-frontend .card-body {
	color: var(--vf-text);
}

.modernbooking-frontend .card-footer {
	background: transparent;
	border-top: 1px solid var(--vf-border-subtle);
}

/* ── Service Hero Card ───────────────────────────── */
.service-hero-card {
	background: var(--vf-surface) !important;
	border: 1px solid var(--vf-border) !important;
}

.service-hero-card .card-title {
	font-size: 1.75rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-align: center;
}

.service-hero-img {
	max-height: 280px;
	object-fit: cover;
}

.service-description-text {
	font-size: 0.95rem;
	line-height: 1.7;
	color: var(--vf-text-secondary);
	text-align: center;
}
.service-description-text p:last-child { margin-bottom: 0; }

/* ── Flatpickr Calendar — Dark Theme ─────────────── */
.modernbooking-frontend .flatpickr-calendar {
	background: transparent !important;
	border: 1px solid var(--vf-border) !important;
	border-radius: 0.75rem !important;
	box-shadow: none !important;
	font-family: inherit !important;
	width: 100% !important;
	max-width: 100% !important;
}
.modernbooking-frontend .flatpickr-calendar.inline {
	margin: 0 auto;
}

/* Calendar navigation */
.modernbooking-frontend .flatpickr-months {
	background: transparent !important;
	padding: 0.5rem 0 !important;
}
.modernbooking-frontend .flatpickr-months .flatpickr-month {
	background: transparent !important;
	color: var(--vf-text) !important;
	fill: var(--vf-text) !important;
	height: 40px !important;
}
.modernbooking-frontend .flatpickr-current-month {
	color: var(--vf-text) !important;
	font-weight: 600 !important;
	font-size: 1.05rem !important;
}
.modernbooking-frontend .flatpickr-current-month .flatpickr-monthDropdown-months {
	background: transparent !important;
	color: var(--vf-text) !important;
	-webkit-appearance: none;
	appearance: none;
	font-weight: 600 !important;
}
.modernbooking-frontend .flatpickr-current-month .flatpickr-monthDropdown-months option {
	background: #1a1a1a !important;
	color: var(--vf-text) !important;
}
.modernbooking-frontend .flatpickr-current-month input.cur-year {
	color: var(--vf-text) !important;
	font-weight: 600 !important;
}
.modernbooking-frontend .flatpickr-months .flatpickr-prev-month,
.modernbooking-frontend .flatpickr-months .flatpickr-next-month {
	color: var(--vf-text) !important;
	fill: var(--vf-text) !important;
}
.modernbooking-frontend .flatpickr-months .flatpickr-prev-month svg,
.modernbooking-frontend .flatpickr-months .flatpickr-next-month svg {
	fill: var(--vf-text-secondary) !important;
}
.modernbooking-frontend .flatpickr-months .flatpickr-prev-month:hover svg,
.modernbooking-frontend .flatpickr-months .flatpickr-next-month:hover svg {
	fill: var(--vf-text) !important;
}

/* Weekday headers */
.modernbooking-frontend .flatpickr-weekdays {
	background: transparent !important;
}
.modernbooking-frontend span.flatpickr-weekday {
	background: transparent !important;
	color: var(--vf-text-muted) !important;
	font-weight: 600 !important;
	font-size: 0.8rem !important;
	text-transform: uppercase !important;
	letter-spacing: 0.05em !important;
}

/* Calendar sizing */
.modernbooking-frontend .flatpickr-innerContainer,
.modernbooking-frontend .flatpickr-rContainer,
.modernbooking-frontend .flatpickr-days,
.modernbooking-frontend .dayContainer {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 100% !important;
}

/* Day cells — add margin for spacing between cells */
.modernbooking-frontend .flatpickr-day {
	border-radius: 0.375rem !important;
	line-height: 2.2 !important;
	height: 2.2rem !important;
	max-width: calc(100% / 7 - 4px) !important;
	margin: 2px !important;
	color: var(--vf-text) !important;
	border: 1px solid transparent !important;
	font-weight: 500 !important;
	font-size: 0.85rem !important;
	transition: all 0.15s ease !important;
	position: relative;
}
.modernbooking-frontend .flatpickr-day.prevMonthDay,
.modernbooking-frontend .flatpickr-day.nextMonthDay {
	color: var(--vf-text-muted) !important;
}
.modernbooking-frontend .flatpickr-day.flatpickr-disabled {
	color: rgba(255, 255, 255, 0.25) !important;
}

/* Selected day — cool slate, differentiated from CTA */
.modernbooking-frontend .flatpickr-day.selected,
.modernbooking-frontend .flatpickr-day.startRange,
.modernbooking-frontend .flatpickr-day.endRange {
	background: var(--vf-cal-selected) !important;
	border-color: var(--vf-cal-selected-border) !important;
	color: #f7fafc !important;
	box-shadow: 0 0 0 1px var(--vf-cal-selected-glow) !important;
	font-weight: 600 !important;
}

/* Hover */
.modernbooking-frontend .flatpickr-day:hover:not(.selected):not(.flatpickr-disabled) {
	background: var(--vf-surface-hover) !important;
	border-color: var(--vf-border) !important;
}

/* Today */
.modernbooking-frontend .flatpickr-day.today {
	border-color: var(--vf-primary-border) !important;
}
.modernbooking-frontend .flatpickr-day.today:not(.selected) {
	color: var(--vf-primary) !important;
}

/* ── Calendar Availability Indicators ────────────── */
/* Dot rendered below the day number */
.modernbooking-frontend .flatpickr-day.has-availability::after,
.modernbooking-frontend .flatpickr-day.partial-availability::after,
.modernbooking-frontend .flatpickr-day.no-availability::after {
	content: '';
	position: absolute;
	bottom: 2px;
	left: 50%;
	transform: translateX(-50%);
	width: 5px;
	height: 5px;
	border-radius: 50%;
}
/* All slots available — green dot */
.modernbooking-frontend .flatpickr-day.has-availability::after {
	background: #22c55e;
}
/* Some slots available — amber dot */
.modernbooking-frontend .flatpickr-day.partial-availability::after {
	background: #f59e0b;
}
/* Fully booked — red dot */
.modernbooking-frontend .flatpickr-day.no-availability::after {
	background: #ef4444;
}
/* Keep dot visible on selected days */
.modernbooking-frontend .flatpickr-day.selected.has-availability::after,
.modernbooking-frontend .flatpickr-day.selected.partial-availability::after {
	background: #22c55e;
	opacity: 0.9;
}

/* ── Timeslot Grid — Uniform 4-Column Layout ─────── */
.timeslot-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.5rem;
}

.timeslot-btn {
	width: 100%;
	padding: 0.4rem 0.5rem !important;
	text-align: center;
	border-radius: 0.5rem !important;
	transition: all var(--vf-transition);
	cursor: pointer;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 0 !important;
	line-height: 1.3 !important;
	font-size: 0.8rem !important;
}

.timeslot-btn .timeslot-price {
	font-size: 0.75rem;
	opacity: 0.7;
}

/* Available (unselected) */
.timeslot-btn.timeslot-available {
	background: var(--vf-surface) !important;
	border: 1px solid var(--vf-border) !important;
	color: var(--vf-text) !important;
}
.timeslot-btn.timeslot-available:hover:not(:disabled) {
	background: var(--vf-surface-hover) !important;
	border-color: var(--vf-primary-border) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Selected (reserved by me) — warm ember, distinct from CTA */
.timeslot-btn.timeslot-selected {
	background: var(--vf-slot-selected) !important;
	border-color: var(--vf-slot-selected-border) !important;
	color: var(--vf-slot-selected-text) !important;
	box-shadow: 0 2px 8px rgba(127, 43, 43, 0.3);
}
.timeslot-btn.timeslot-selected:hover {
	background: var(--vf-slot-selected-hover) !important;
	border-color: #943333 !important;
}

/* Booked (unavailable) — clear visual distinction */
.timeslot-btn.timeslot-booked {
	background: var(--vf-booked-bg) !important;
	border: 1px dashed var(--vf-booked-border) !important;
	color: var(--vf-booked-text) !important;
	cursor: not-allowed;
	position: relative;
}
.timeslot-btn.timeslot-booked span:first-child {
	text-decoration: line-through;
	text-decoration-color: rgba(255, 255, 255, 0.15);
}

/* ── Order Summary Sidebar ────────────────────────── */
.modernbooking-frontend .list-group-item {
	background: transparent;
	border-color: var(--vf-border-subtle);
	border-left: 0;
	border-right: 0;
	color: var(--vf-text);
}
.modernbooking-frontend .list-group-item:first-child { border-top: 0; }

.summary-stat-badge {
	background: var(--vf-surface-elevated) !important;
	color: var(--vf-text) !important;
	border: 1px solid var(--vf-border) !important;
	font-weight: 500 !important;
	padding: 0.4em 0.75em !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 0.4em !important;
	font-size: 0.8rem !important;
}
.summary-stat-badge i {
	font-size: 0.75rem;
	opacity: 0.7;
}

/* Price breakdown */
.modernbooking-frontend .border-top {
	border-color: var(--vf-border-subtle) !important;
}

/* Remove slot button — generous tap target */
.slot-remove-btn {
	background: none !important;
	border: none !important;
	color: rgba(239, 68, 68, 0.6) !important;
	cursor: pointer !important;
	padding: 0.4rem !important;
	margin: -0.4rem -0.25rem -0.4rem 0 !important;
	line-height: 1 !important;
	border-radius: 4px !important;
	transition: all 0.15s ease !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-width: 32px !important;
	min-height: 32px !important;
}
.slot-remove-btn i {
	font-size: 1rem !important;
}
.slot-remove-btn:hover {
	color: rgba(239, 68, 68, 1) !important;
	background: rgba(239, 68, 68, 0.1) !important;
}

/* ── Clear All Button ────────────────────────────── */
.summary-clear-btn {
	background: none !important;
	border: none !important;
	color: var(--vf-text-muted) !important;
	font-size: 0.75rem !important;
	font-weight: 500 !important;
	letter-spacing: 0.03em !important;
	cursor: pointer !important;
	padding: 0.3rem 0.6rem !important;
	border-radius: 4px !important;
	transition: all 0.2s ease !important;
	text-transform: uppercase !important;
	box-shadow: none !important;
	outline: none !important;
	line-height: 1.4 !important;
}
.summary-clear-btn:hover {
	color: #ef4444 !important;
	background: rgba(239, 68, 68, 0.08) !important;
}
.summary-clear-btn i {
	font-size: 0.7rem;
}

/* ── Coupon Section ─────────────────────────────── */
.coupon-section {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--vf-border-subtle);
}
.coupon-input-row {
	display: flex;
	gap: 0.4rem;
}
.coupon-input {
	flex: 1 !important;
	background: var(--vf-surface) !important;
	border: 1px solid var(--vf-border) !important;
	border-radius: 6px !important;
	color: var(--vf-text) !important;
	padding: 0.45rem 0.7rem !important;
	font-size: 0.8rem !important;
	font-weight: 500 !important;
	outline: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	height: auto !important;
	line-height: 1.4 !important;
}
.coupon-input::placeholder {
	color: var(--vf-text-muted) !important;
}
.coupon-input:focus {
	border-color: var(--vf-primary-border) !important;
	box-shadow: 0 0 0 2px var(--vf-primary-glow) !important;
	background: var(--vf-surface) !important;
	outline: none !important;
}
.coupon-apply-btn {
	background: var(--vf-surface-elevated) !important;
	border: 1px solid var(--vf-border) !important;
	border-radius: 6px !important;
	color: var(--vf-text-secondary) !important;
	padding: 0.45rem 0.9rem !important;
	font-size: 0.75rem !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	white-space: nowrap !important;
	letter-spacing: 0.02em !important;
	box-shadow: none !important;
	line-height: 1.4 !important;
	text-transform: none !important;
}
.coupon-apply-btn:hover:not(:disabled) {
	background: var(--vf-surface-hover) !important;
	border-color: var(--vf-text-secondary) !important;
	color: var(--vf-text) !important;
}
.coupon-apply-btn:disabled {
	opacity: 0.4 !important;
	cursor: default !important;
}
.coupon-error {
	color: #ef4444;
	font-size: 0.75rem;
	margin-top: 0.35rem;
}
.coupon-applied-badge {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	background: rgba(34, 197, 94, 0.06) !important;
	border: 1px solid rgba(34, 197, 94, 0.15) !important;
	border-radius: 8px !important;
	padding: 0.5rem 0.75rem !important;
}
.coupon-applied-info {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
}
.coupon-applied-info .bi-check-circle {
	color: #22c55e;
	font-size: 0.9rem;
}
.coupon-applied-name {
	font-weight: 600;
	color: var(--vf-text);
}
.coupon-applied-amount {
	color: #22c55e;
	font-weight: 500;
}
.coupon-remove-btn {
	background: none !important;
	border: none !important;
	color: var(--vf-text-muted) !important;
	cursor: pointer !important;
	padding: 0.15rem !important;
	font-size: 0.7rem !important;
	line-height: 1 !important;
	border-radius: 4px !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
}
.coupon-remove-btn:hover {
	color: #ef4444 !important;
	background: rgba(239, 68, 68, 0.1) !important;
}

/* ── Sign-In Card (Guest Mode) ───────────────────── */
.modernbooking-frontend .border-vf-primary {
	border: 2px solid var(--vf-primary) !important;
	box-shadow: 0 0 30px var(--vf-primary-glow);
}

.modernbooking-frontend .btn-outline-secondary {
	background: transparent;
	border-color: var(--vf-border);
	color: var(--vf-text-secondary);
}
.modernbooking-frontend .btn-outline-secondary:hover {
	background: var(--vf-surface-hover);
	border-color: var(--vf-text-secondary);
	color: var(--vf-text);
}

/* ── Copy To All & Remove Date Buttons ───────────── */
.modernbooking-frontend .btn-outline-secondary.btn-sm {
	background: transparent;
	border-color: var(--vf-border);
	color: var(--vf-text-secondary);
	font-size: 0.75rem;
}
.modernbooking-frontend .btn-outline-secondary.btn-sm:hover {
	background: var(--vf-surface-hover);
	color: var(--vf-text);
}
.modernbooking-frontend .btn-outline-danger.btn-sm {
	border-color: rgba(239, 68, 68, 0.3);
	color: rgba(239, 68, 68, 0.7);
}
.modernbooking-frontend .btn-outline-danger.btn-sm:hover {
	background: rgba(239, 68, 68, 0.1);
	border-color: rgba(239, 68, 68, 0.5);
	color: #ef4444;
}

/* ── Toast ─────────────────────────────────────────── */
#signin-toast {
	min-width: 340px;
	background: rgba(30, 30, 30, 0.95) !important;
	backdrop-filter: blur(10px);
	border: 1px solid var(--vf-border);
}

/* ── Reservation Timer ────────────────────────────── */
.modernbooking-frontend .card-footer.bg-warning {
	background: rgba(245, 158, 11, 0.1) !important;
	border-top-color: rgba(245, 158, 11, 0.2) !important;
}
.modernbooking-frontend .card-footer .text-warning {
	color: #fbbf24 !important;
}
.card-footer .bi-clock-history {
	font-size: 1.1rem;
}

/* ── Hourly Rate Discount ────────────────────────── */
.modernbooking-frontend .text-success {
	color: #4ade80 !important;
}

/* ── Form Controls (Dropdowns) ───────────────────── */
.modernbooking-frontend .form-select,
.modernbooking-frontend .form-control {
	background-color: rgba(255, 255, 255, 0.05);
	border-color: var(--vf-border);
	color: var(--vf-text);
}
.modernbooking-frontend .form-select:focus,
.modernbooking-frontend .form-control:focus {
	background-color: rgba(255, 255, 255, 0.08);
	border-color: var(--vf-primary-border);
	box-shadow: 0 0 0 0.2rem var(--vf-primary-light);
	color: var(--vf-text);
}
.modernbooking-frontend .form-select option {
	background: #1a1a1a;
	color: var(--vf-text);
}

.modernbooking-frontend .form-label {
	color: var(--vf-text-secondary);
	font-weight: 500;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* ── Alert (Edit Mode) ──────────────────────────── */
.modernbooking-frontend .alert-info {
	background: rgba(59, 130, 246, 0.1);
	border-color: rgba(59, 130, 246, 0.2);
	color: #93c5fd;
}

/* ── Modal (Terms & Conditions) ──────────────────── */
.modernbooking-frontend .modal-content {
	background: #1a1a1a;
	border: 1px solid var(--vf-border);
	color: var(--vf-text);
}
.modernbooking-frontend .modal-header {
	border-bottom-color: var(--vf-border-subtle);
}
.modernbooking-frontend .modal-footer {
	border-top-color: var(--vf-border-subtle);
}

/* ── Empty State ─────────────────────────────────── */
.modernbooking-frontend .display-4,
.modernbooking-frontend .display-5,
.modernbooking-frontend .display-6 {
	color: var(--vf-text-muted);
}

/* ── Spinner ─────────────────────────────────────── */
.modernbooking-frontend .spinner-border {
	color: var(--vf-text-secondary);
}

/* Focus indicators for keyboard navigation (WCAG 2.4.7) */
.timeslot-btn:focus-visible,
.slot-remove-btn:focus-visible,
.summary-clear-btn:focus-visible,
.coupon-remove-btn:focus-visible,
.coupon-apply-btn:focus-visible,
.btn-vf-primary:focus-visible {
	outline: 2px solid var(--vf-primary) !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 4px var(--vf-primary-glow) !important;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 991.98px) {
	.modernbooking-frontend .sticky-top {
		position: relative !important;
		top: 0 !important;
	}
	.service-hero-img {
		max-height: 200px;
	}
	.timeslot-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 767.98px) {
	.timeslot-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 575.98px) {
	.timeslot-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.375rem;
	}
	.timeslot-btn {
		font-size: 0.75rem !important;
		padding: 0.5rem 0.25rem !important;
		min-height: 44px !important;
	}
	.modernbooking-frontend .container {
		padding-left: 1rem;
		padding-right: 1rem;
	}
}
