/**
 * Tobalt Booking - Frontend Styles
 * Custom UI kit - no inheritance from theme
 *
 * @package Tobalt_Booking
 * @author  Tobalt — https://tobalt.lt
 */

/* Reset & Variables */
.tobalt-booking-widget,
.tobalt-booking-widget * {
	box-sizing: border-box;
}

.tobalt-booking-widget {
	--tb-primary: #2563eb;
	--tb-primary-hover: #1d4ed8;
	--tb-primary-light: #dbeafe;
	--tb-success: #16a34a;
	--tb-success-light: #dcfce7;
	--tb-error: #dc2626;
	--tb-error-light: #fee2e2;
	--tb-text: #1f2937;
	--tb-text-muted: #6b7280;
	--tb-border: #e5e7eb;
	--tb-bg: #ffffff;
	--tb-bg-alt: #f9fafb;
	--tb-radius: 8px;
	--tb-radius-lg: 12px;
	--tb-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	--tb-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
	--tb-transition: 0.2s ease;

	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--tb-text);
}

/* Container */
.tobalt-booking-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

/* Date & Guest Selector Bar */
.tobalt-selector-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 20px;
	background: var(--tb-bg);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	box-shadow: var(--tb-shadow);
	margin-bottom: 30px;
}

.tobalt-selector-group {
	flex: 1;
	min-width: 150px;
}

.tobalt-selector-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--tb-text-muted);
	margin-bottom: 6px;
}

.tobalt-selector-input {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius);
	background: var(--tb-bg);
	color: var(--tb-text);
	transition: border-color var(--tb-transition), box-shadow var(--tb-transition);
}

.tobalt-selector-input:focus {
	outline: none;
	border-color: var(--tb-primary);
	box-shadow: 0 0 0 3px var(--tb-primary-light);
}

.tobalt-selector-input::-webkit-calendar-picker-indicator {
	cursor: pointer;
}

/* Search Button */
.tobalt-search-btn {
	align-self: flex-end;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: var(--tb-primary);
	border: none;
	border-radius: var(--tb-radius);
	cursor: pointer;
	transition: background var(--tb-transition), transform var(--tb-transition);
}

.tobalt-search-btn:hover {
	background: var(--tb-primary-hover);
}

.tobalt-search-btn:active {
	transform: scale(0.98);
}

/* Units Grid */
.tobalt-units-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 24px;
}

.tobalt-units-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Unit Card */
.tobalt-unit-card {
	background: var(--tb-bg);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	overflow: hidden;
	transition: box-shadow var(--tb-transition), transform var(--tb-transition);
}

.tobalt-unit-card:hover {
	box-shadow: var(--tb-shadow-lg);
	transform: translateY(-2px);
}

.tobalt-unit-image {
	width: 100%;
	height: 200px;
	object-fit: cover;
	background: var(--tb-bg-alt);
}

.tobalt-unit-image-placeholder {
	width: 100%;
	height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--tb-bg-alt);
	color: var(--tb-text-muted);
}

.tobalt-unit-content {
	padding: 20px;
}

.tobalt-unit-type {
	display: inline-block;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--tb-primary);
	background: var(--tb-primary-light);
	border-radius: 4px;
	margin-bottom: 10px;
}

.tobalt-unit-name {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--tb-text);
}

.tobalt-unit-description {
	margin: 0 0 15px;
	font-size: 14px;
	color: var(--tb-text-muted);
	line-height: 1.6;
}

.tobalt-unit-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	padding-top: 15px;
	border-top: 1px solid var(--tb-border);
}

.tobalt-unit-capacity {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	color: var(--tb-text-muted);
}

.tobalt-unit-capacity svg {
	width: 18px;
	height: 18px;
}

.tobalt-unit-price {
	margin-left: auto;
	font-size: 18px;
	font-weight: 700;
	color: var(--tb-text);
}

.tobalt-unit-price-label {
	font-size: 12px;
	font-weight: 400;
	color: var(--tb-text-muted);
}

/* Unit Actions */
.tobalt-unit-actions {
	padding: 15px 20px;
	background: var(--tb-bg-alt);
	border-top: 1px solid var(--tb-border);
}

.tobalt-book-btn {
	width: 100%;
	padding: 14px 20px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: var(--tb-primary);
	border: none;
	border-radius: var(--tb-radius);
	cursor: pointer;
	transition: background var(--tb-transition);
}

.tobalt-book-btn:hover {
	background: var(--tb-primary-hover);
}

.tobalt-book-btn:disabled {
	background: var(--tb-border);
	cursor: not-allowed;
}

/* Booking Form Modal */
.tobalt-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--tb-transition), visibility var(--tb-transition);
}

.tobalt-modal-overlay.active {
	opacity: 1;
	visibility: visible;
}

.tobalt-modal {
	width: 90%;
	max-width: 500px;
	max-height: 90vh;
	overflow-y: auto;
	background: var(--tb-bg);
	border-radius: var(--tb-radius-lg);
	box-shadow: var(--tb-shadow-lg);
	transform: translateY(20px);
	transition: transform var(--tb-transition);
}

.tobalt-modal-overlay.active .tobalt-modal {
	transform: translateY(0);
}

.tobalt-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px;
	border-bottom: 1px solid var(--tb-border);
}

.tobalt-modal-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}

.tobalt-modal-close {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: var(--tb-text-muted);
	transition: background var(--tb-transition);
}

.tobalt-modal-close:hover {
	background: var(--tb-bg-alt);
}

.tobalt-modal-body {
	padding: 20px;
}

/* Form Styles */
.tobalt-form-group {
	margin-bottom: 20px;
}

.tobalt-form-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--tb-text);
}

.tobalt-form-label .required {
	color: var(--tb-error);
}

.tobalt-form-input,
.tobalt-form-textarea {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	font-family: inherit;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius);
	background: var(--tb-bg);
	color: var(--tb-text);
	transition: border-color var(--tb-transition), box-shadow var(--tb-transition);
}

.tobalt-form-input:focus,
.tobalt-form-textarea:focus {
	outline: none;
	border-color: var(--tb-primary);
	box-shadow: 0 0 0 3px var(--tb-primary-light);
}

.tobalt-form-input.error,
.tobalt-form-textarea.error {
	border-color: var(--tb-error);
}

.tobalt-form-error {
	margin-top: 4px;
	font-size: 13px;
	color: var(--tb-error);
}

.tobalt-form-textarea {
	min-height: 100px;
	resize: vertical;
}

.tobalt-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* Submit Button */
.tobalt-submit-btn {
	width: 100%;
	padding: 16px 20px;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var(--tb-primary);
	border: none;
	border-radius: var(--tb-radius);
	cursor: pointer;
	transition: background var(--tb-transition);
}

.tobalt-submit-btn:hover {
	background: var(--tb-primary-hover);
}

.tobalt-submit-btn:disabled {
	background: var(--tb-border);
	cursor: not-allowed;
}

/* Success Message */
.tobalt-success-message {
	text-align: center;
	padding: 40px 20px;
}

.tobalt-success-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--tb-success-light);
	border-radius: 50%;
	color: var(--tb-success);
}

.tobalt-success-title {
	margin: 0 0 10px;
	font-size: 24px;
	font-weight: 700;
	color: var(--tb-text);
}

.tobalt-success-text {
	margin: 0;
	font-size: 15px;
	color: var(--tb-text-muted);
}

/* Loading State */
.tobalt-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
}

.tobalt-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--tb-border);
	border-top-color: var(--tb-primary);
	border-radius: 50%;
	animation: tobalt-spin 0.8s linear infinite;
}

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

/* Empty State */
.tobalt-empty-state {
	text-align: center;
	padding: 60px 20px;
	color: var(--tb-text-muted);
}

.tobalt-empty-state svg {
	width: 64px;
	height: 64px;
	margin-bottom: 16px;
	opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
	.tobalt-selector-bar {
		flex-direction: column;
	}

	.tobalt-selector-group {
		min-width: 100%;
	}

	.tobalt-search-btn {
		width: 100%;
	}

	.tobalt-units-grid {
		grid-template-columns: 1fr;
	}

	.tobalt-form-row {
		grid-template-columns: 1fr;
	}

	.tobalt-modal {
		width: 95%;
		margin: 10px;
	}
}

/* Print Styles */
@media print {
	.tobalt-booking-widget {
		display: none;
	}
}

/* ==========================================
   Availability Calendar
   ========================================== */

.tobalt-availability-widget {
	font-family: var(--tb-font-family);
	max-width: 800px;
	margin: 0 auto;
}

.tobalt-availability-filter {
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.tobalt-availability-filter label {
	font-weight: 600;
	color: var(--tb-text);
}

.tobalt-availability-filter select {
	padding: 8px 12px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius);
	font-size: 14px;
	min-width: 200px;
}

.tobalt-availability-calendars {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 30px;
}

.tobalt-calendar-month {
	background: #fff;
	border-radius: var(--tb-radius);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	padding: 20px;
}

.tobalt-calendar-title {
	margin: 0 0 15px;
	font-size: 16px;
	font-weight: 700;
	color: var(--tb-text);
	text-align: center;
	text-transform: capitalize;
}

.tobalt-calendar-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.tobalt-calendar-table th {
	padding: 8px 4px;
	font-size: 12px;
	font-weight: 600;
	color: var(--tb-text-muted);
	text-align: center;
}

.tobalt-calendar-table td {
	padding: 4px;
	text-align: center;
	vertical-align: middle;
}

.tobalt-calendar-empty {
	background: transparent;
}

.tobalt-calendar-day {
	position: relative;
}

.tobalt-day-number {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0 auto;
	border-radius: 50%;
	font-size: 13px;
	font-weight: 500;
	color: var(--tb-text);
	background: var(--tb-success-light);
	transition: all 0.2s ease;
}

.tobalt-day-past .tobalt-day-number {
	background: #f5f5f5;
	color: #bbb;
}

.tobalt-day-booked .tobalt-day-number {
	background: var(--tb-danger-light);
	color: var(--tb-danger);
}

.tobalt-day-partial .tobalt-day-number {
	background: linear-gradient(135deg, var(--tb-success-light) 50%, var(--tb-danger-light) 50%);
}

/* Legend */
.tobalt-availability-legend {
	margin-top: 25px;
	display: flex;
	justify-content: center;
	gap: 25px;
	flex-wrap: wrap;
}

.tobalt-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--tb-text-muted);
}

.tobalt-legend-dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
}

.tobalt-legend-available {
	background: var(--tb-success-light);
	border: 2px solid #28a745;
}

.tobalt-legend-booked {
	background: var(--tb-danger-light);
	border: 2px solid var(--tb-danger);
}

.tobalt-legend-past {
	background: #f5f5f5;
	border: 2px solid #ddd;
}

/* Responsive */
@media (max-width: 600px) {
	.tobalt-availability-calendars {
		grid-template-columns: 1fr;
	}

	.tobalt-availability-filter {
		flex-direction: column;
		align-items: stretch;
	}

	.tobalt-availability-filter select {
		min-width: 100%;
	}
}
