/**
 * Availability Search Shortcode Styles
 * Mobile-First, Production-Ready CSS
 * @package HolidayHomeBooking
 */

/* ==========================================================================
   CSS Custom Properties (Variables) - Inherit from booking-form if present
   ========================================================================== */

:root {
	/* Colors */
	--hhb-primary: #2563eb;
	--hhb-primary-hover: #1d4ed8;
	--hhb-primary-light: #eff6ff;
	--hhb-success: #10b981;
	--hhb-success-light: #d1fae5;
	--hhb-error: #ef4444;
	--hhb-error-light: #fee2e2;
	--hhb-warning: #f59e0b;
	--hhb-warning-light: #fef3c7;
	
	/* Neutral Colors */
	--hhb-text-primary: #1f2937;
	--hhb-text-secondary: #6b7280;
	--hhb-border: #e5e7eb;
	--hhb-border-dark: #d1d5db;
	--hhb-bg-white: #ffffff;
	--hhb-bg-light: #f9fafb;
	--hhb-bg-gray: #f3f4f6;
	
	/* Spacing */
	--hhb-spacing-xs: 0.5rem;   /* 8px */
	--hhb-spacing-sm: 0.75rem;  /* 12px */
	--hhb-spacing-md: 1rem;     /* 16px */
	--hhb-spacing-lg: 1.5rem;   /* 24px */
	--hhb-spacing-xl: 2rem;     /* 32px */
	
	/* Typography */
	--hhb-font-size-xs: 0.75rem;   /* 12px */
	--hhb-font-size-sm: 0.875rem;  /* 14px */
	--hhb-font-size-base: 1rem;    /* 16px */
	--hhb-font-size-lg: 1.125rem;  /* 18px */
	--hhb-font-size-xl: 1.25rem;   /* 20px */
	--hhb-font-size-2xl: 1.5rem;   /* 24px */
	
	/* Border Radius */
	--hhb-radius-sm: 0.25rem;  /* 4px */
	--hhb-radius-md: 0.5rem;   /* 8px */
	--hhb-radius-lg: 0.75rem;  /* 12px */
	
	/* Shadows */
	--hhb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--hhb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--hhb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	
	/* Transitions */
	--hhb-transition: all 0.2s ease;
}

/* ==========================================================================
   Base Container
   ========================================================================== */

.hhb-availability-search {
	width: 100%;
	margin: var(--hhb-spacing-md) 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: var(--hhb-font-size-base);
	line-height: 1.5;
	color: var(--hhb-text-primary);
}

/* ==========================================================================
   Search Form
   ========================================================================== */

.hhb-search-form {
	background: var(--hhb-bg-white);
	border: 1px solid var(--hhb-border);
	border-radius: var(--hhb-radius-md);
	padding: var(--hhb-spacing-md);
	margin-bottom: var(--hhb-spacing-lg);
	box-shadow: var(--hhb-shadow-sm);
}

.hhb-search-fields {
	display: flex;
	flex-direction: column;
	gap: var(--hhb-spacing-md);
}

.hhb-search-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hhb-spacing-md);
}

/* Tablet and up: 2 columns for dates and guests */
@media (min-width: 768px) {
	.hhb-search-dates,
	.hhb-search-guests {
		grid-template-columns: 1fr 1fr;
	}
	
	.hhb-search-filters {
		grid-template-columns: 1fr 1fr;
	}
}

/* Desktop: maintain 2 columns for filters */
@media (min-width: 1024px) {
	.hhb-search-filters {
		grid-template-columns: 1fr 1fr;
	}
}

/* Form Fields */
.hhb-search-field {
	display: flex;
	flex-direction: column;
}

.hhb-search-field label {
	font-size: var(--hhb-font-size-sm);
	font-weight: 600;
	color: var(--hhb-text-primary);
	margin-bottom: var(--hhb-spacing-xs);
}

.hhb-search-field input[type="text"],
.hhb-search-field select {
	width: 100%;
	padding: 0.625rem var(--hhb-spacing-sm);
	border: 1px solid var(--hhb-border);
	border-radius: var(--hhb-radius-sm);
	font-size: var(--hhb-font-size-base);
	color: var(--hhb-text-primary);
	background: var(--hhb-bg-white);
	transition: var(--hhb-transition);
	box-sizing: border-box;
}

.hhb-search-field input[type="text"]:focus,
.hhb-search-field select:focus {
	outline: none;
	border-color: var(--hhb-primary);
	box-shadow: 0 0 0 3px var(--hhb-primary-light);
}

/* Price Slider */
.hhb-price-slider-wrapper {
	display: flex;
	flex-direction: column;
	gap: var(--hhb-spacing-xs);
}

.hhb-price-slider {
	width: 100%;
	height: 8px;
	border-radius: var(--hhb-radius-sm);
	background: var(--hhb-bg-gray);
	outline: none;
	-webkit-appearance: none;
}

.hhb-price-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--hhb-primary);
	cursor: pointer;
	box-shadow: var(--hhb-shadow-sm);
}

.hhb-price-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--hhb-primary);
	cursor: pointer;
	box-shadow: var(--hhb-shadow-sm);
	border: none;
}

.hhb-price-value {
	display: flex;
	align-items: center;
	gap: var(--hhb-spacing-xs);
	font-size: var(--hhb-font-size-sm);
	color: var(--hhb-text-secondary);
}

.hhb-price-amount {
	font-weight: 600;
	color: var(--hhb-text-primary);
}

/* Action Buttons */
.hhb-search-actions {
	display: flex;
	gap: var(--hhb-spacing-sm);
	flex-wrap: wrap;
}

.hhb-search-button,
.hhb-reset-button {
	padding: 0.75rem var(--hhb-spacing-lg);
	border: none;
	border-radius: var(--hhb-radius-sm);
	font-size: var(--hhb-font-size-base);
	font-weight: 600;
	cursor: pointer;
	transition: var(--hhb-transition);
	flex: 1;
	min-width: 150px;
}

.hhb-search-button {
	background: var(--hhb-primary);
	color: white;
}

.hhb-search-button:hover {
	background: var(--hhb-primary-hover);
}

.hhb-reset-button {
	background: var(--hhb-bg-gray);
	color: var(--hhb-text-primary);
}

.hhb-reset-button:hover {
	background: var(--hhb-border-dark);
}

@media (min-width: 768px) {
	.hhb-search-actions {
		grid-column: 1 / -1;
		justify-content: flex-start;
	}
	
	.hhb-search-button,
	.hhb-reset-button {
		flex: 0;
		min-width: 180px;
	}
}

/* ==========================================================================
   Results Area
   ========================================================================== */

.hhb-search-results-wrapper {
	position: relative;
	min-height: 200px;
}

/* Loading State */
.hhb-search-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--hhb-spacing-xl);
	text-align: center;
}

.hhb-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--hhb-border);
	border-top-color: var(--hhb-primary);
	border-radius: 50%;
	animation: hhb-spin 0.8s linear infinite;
	margin-bottom: var(--hhb-spacing-md);
}

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

/* No Results */
.hhb-no-results {
	text-align: center;
	padding: var(--hhb-spacing-xl);
	background: var(--hhb-bg-light);
	border-radius: var(--hhb-radius-md);
	border: 1px solid var(--hhb-border);
}

.hhb-no-results-icon {
	font-size: 4rem;
	margin-bottom: var(--hhb-spacing-md);
}

.hhb-no-results h3 {
	margin: 0 0 var(--hhb-spacing-sm) 0;
	color: var(--hhb-text-primary);
	font-size: var(--hhb-font-size-xl);
}

.hhb-no-results p {
	margin: 0;
	color: var(--hhb-text-secondary);
}

/* ==========================================================================
   Results Grid/List/Cards Layouts
   ========================================================================== */

.hhb-search-results {
	display: grid;
	gap: var(--hhb-spacing-lg);
	margin-bottom: var(--hhb-spacing-lg);
}

/* Grid Layout */
.hhb-results-grid {
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.hhb-results-grid.hhb-columns-2 {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.hhb-results-grid.hhb-columns-3 {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.hhb-results-grid.hhb-columns-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.hhb-results-grid.hhb-columns-3 {
		grid-template-columns: repeat(3, 1fr);
	}
	
	.hhb-results-grid.hhb-columns-4 {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* List Layout */
.hhb-results-list {
	grid-template-columns: 1fr;
}

.hhb-results-list .hhb-property-card {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hhb-spacing-md);
}

@media (min-width: 768px) {
	.hhb-results-list .hhb-property-card {
		grid-template-columns: 300px 1fr;
	}
}

/* Cards Layout (same as grid but with card styling) */
.hhb-results-cards {
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.hhb-results-cards.hhb-columns-2 {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.hhb-results-cards.hhb-columns-3 {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.hhb-results-cards.hhb-columns-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.hhb-results-cards.hhb-columns-3 {
		grid-template-columns: repeat(3, 1fr);
	}
	
	.hhb-results-cards.hhb-columns-4 {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* ==========================================================================
   Property Card
   ========================================================================== */

.hhb-property-card {
	background: var(--hhb-bg-white);
	border: 1px solid var(--hhb-border);
	border-radius: var(--hhb-radius-md);
	overflow: hidden;
	transition: var(--hhb-transition);
	display: flex;
	flex-direction: column;
}

.hhb-property-card:hover {
	box-shadow: var(--hhb-shadow-lg);
	transform: translateY(-2px);
}

/* Property Image */
.hhb-property-image {
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: var(--hhb-bg-gray);
}

.hhb-property-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: var(--hhb-transition);
}

.hhb-property-card:hover .hhb-property-image img {
	transform: scale(1.05);
}

/* List layout image adjustment */
.hhb-results-list .hhb-property-image {
	height: 100%;
	min-height: 250px;
}

/* Property Content */
.hhb-property-content {
	padding: var(--hhb-spacing-md);
	display: flex;
	flex-direction: column;
	gap: var(--hhb-spacing-sm);
	flex: 1;
}

.hhb-property-title {
	margin: 0;
	font-size: var(--hhb-font-size-lg);
	font-weight: 600;
	color: var(--hhb-text-primary);
}

.hhb-property-description {
	font-size: var(--hhb-font-size-sm);
	color: var(--hhb-text-secondary);
	line-height: 1.5;
}

/* Property Meta */
.hhb-property-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hhb-spacing-sm);
}

.hhb-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-size: var(--hhb-font-size-sm);
	color: var(--hhb-text-secondary);
	background: var(--hhb-bg-light);
	padding: 0.25rem 0.5rem;
	border-radius: var(--hhb-radius-sm);
}

.hhb-meta-icon {
	font-size: var(--hhb-font-size-base);
}

/* Property Price */
.hhb-property-price {
	padding-top: var(--hhb-spacing-sm);
	border-top: 1px solid var(--hhb-border);
	margin-top: auto;
}

.hhb-price-total,
.hhb-price-from {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.hhb-price-amount {
	font-size: var(--hhb-font-size-xl);
	font-weight: 700;
	color: var(--hhb-primary);
}

.hhb-price-label,
.hhb-price-unit {
	font-size: var(--hhb-font-size-sm);
	color: var(--hhb-text-secondary);
}

.hhb-price-from {
	flex-direction: row;
	align-items: baseline;
	gap: 0.5rem;
}

.hhb-price-from .hhb-price-amount {
	font-size: var(--hhb-font-size-lg);
}

/* Property Actions */
.hhb-property-actions {
	margin-top: var(--hhb-spacing-sm);
}

.hhb-book-button {
	display: block;
	width: 100%;
	padding: 0.75rem var(--hhb-spacing-md);
	background: var(--hhb-primary);
	color: white;
	text-align: center;
	text-decoration: none;
	border-radius: var(--hhb-radius-sm);
	font-weight: 600;
	transition: var(--hhb-transition);
	border: none;
	cursor: pointer;
}

.hhb-book-button:hover {
	background: var(--hhb-primary-hover);
	color: white;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.hhb-search-pagination {
	display: flex;
	justify-content: center;
	margin-top: var(--hhb-spacing-xl);
}

.hhb-pagination {
	display: flex;
	align-items: center;
	gap: var(--hhb-spacing-xs);
	flex-wrap: wrap;
	justify-content: center;
}

.hhb-page-button {
	min-width: 40px;
	height: 40px;
	padding: 0 var(--hhb-spacing-sm);
	border: 1px solid var(--hhb-border);
	background: var(--hhb-bg-white);
	color: var(--hhb-text-primary);
	border-radius: var(--hhb-radius-sm);
	font-size: var(--hhb-font-size-sm);
	font-weight: 600;
	cursor: pointer;
	transition: var(--hhb-transition);
}

.hhb-page-button:hover:not(:disabled) {
	background: var(--hhb-primary-light);
	border-color: var(--hhb-primary);
	color: var(--hhb-primary);
}

.hhb-page-button.hhb-page-current {
	background: var(--hhb-primary);
	border-color: var(--hhb-primary);
	color: white;
}

.hhb-page-button:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.hhb-page-prev,
.hhb-page-next {
	min-width: auto;
	padding: 0 var(--hhb-spacing-md);
}

.hhb-page-ellipsis {
	padding: 0 var(--hhb-spacing-xs);
	color: var(--hhb-text-secondary);
}

.hhb-page-numbers {
	display: flex;
	align-items: center;
	gap: var(--hhb-spacing-xs);
}

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

@media (max-width: 639px) {
	.hhb-search-form {
		padding: var(--hhb-spacing-sm);
	}
	
	.hhb-property-card {
		margin-bottom: var(--hhb-spacing-md);
	}
	
	.hhb-pagination {
		font-size: var(--hhb-font-size-xs);
	}
	
	.hhb-page-button {
		min-width: 36px;
		height: 36px;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.hhb-search-button:focus,
.hhb-reset-button:focus,
.hhb-book-button:focus,
.hhb-page-button:focus {
	outline: 2px solid var(--hhb-primary);
	outline-offset: 2px;
}

/* Screen reader only text */
.hhb-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.hhb-search-form,
	.hhb-search-pagination {
		display: none;
	}
	
	.hhb-property-card {
		break-inside: avoid;
		box-shadow: none;
		border: 1px solid #ccc;
	}
}
