/**
 * Ticket Picker — Frontend Styles
 *
 * @package RaffleForWooCommercePro
 * @since   1.0.0
 */

/* Container */
.rfwc-pro-picker {
	margin: 0 0 1.5em;
	padding: 1.25em;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* Header */
.rfwc-pro-picker__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em;
	margin-bottom: 0.75em;
}

.rfwc-pro-picker__title {
	margin: 0;
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.3;
}

.rfwc-pro-picker__controls {
	display: flex;
	align-items: center;
	gap: 0.75em;
}

.rfwc-pro-picker__search {
	width: 140px;
	padding: 0.35em 0.6em;
	font-size: 0.875em;
	border: 1px solid #ccc;
	border-radius: 4px;
	outline: none;
	transition: border-color 0.2s;
}

.rfwc-pro-picker__search:focus {
	border-color: var(--rfwc-accent, #7f54b3);
	box-shadow: 0 0 0 1px var(--rfwc-accent, #7f54b3);
}

.rfwc-pro-picker__count {
	font-size: 0.875em;
	color: #555;
	white-space: nowrap;
}

.rfwc-pro-picker__selected-count {
	font-weight: 700;
	color: var(--rfwc-accent, #7f54b3);
}

/* Legend */
.rfwc-pro-picker__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	margin-bottom: 0.75em;
	font-size: 0.8125em;
	color: #666;
}

.rfwc-pro-picker__legend-item {
	display: flex;
	align-items: center;
	gap: 0.35em;
}

.rfwc-pro-picker__legend-item::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
}

.rfwc-pro-picker__legend-item--available::before {
	background: #f7f7f7;
	border: 1px solid #d0d0d0;
}

.rfwc-pro-picker__legend-item--sold::before {
	background: #eee;
	border: 1px solid #ddd;
	opacity: 0.6;
}

.rfwc-pro-picker__legend-item--selected::before {
	background: var(--rfwc-accent, #7f54b3);
	border: 1px solid var(--rfwc-accent-dark, #6b4299);
}

.rfwc-pro-picker__legend-item--reserved::before {
	background: #fef3c7;
	border: 1px solid #fbbf24;
}

/* Grid */
.rfwc-pro-picker__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 6px;
	max-height: 400px;
	overflow-y: auto;
	padding: 4px;
	scrollbar-width: thin;
}

.rfwc-pro-picker__grid::-webkit-scrollbar {
	width: 6px;
}

.rfwc-pro-picker__grid::-webkit-scrollbar-track {
	background: #f0f0f0;
	border-radius: 3px;
}

.rfwc-pro-picker__grid::-webkit-scrollbar-thumb {
	background: #c0c0c0;
	border-radius: 3px;
}

/* Loading state */
.rfwc-pro-picker__loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: 2em;
	color: #888;
	font-size: 0.875em;
}

/* Individual ticket cell */
.rfwc-pro-picker__ticket {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 0.25em 0.3em;
	font-size: 0.75em;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	background: #f7f7f7;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s ease;
	user-select: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	word-break: break-all;
}

.rfwc-pro-picker__ticket:hover {
	background: var(--rfwc-accent-bg-light, #f9f5ff);
	border-color: var(--rfwc-accent, #7f54b3);
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.rfwc-pro-picker__ticket:active {
	transform: translateY(0);
}

/* Sold state */
.rfwc-pro-picker__ticket--sold {
	background: #f0f0f0;
	border-color: #e0e0e0;
	color: #bbb;
	cursor: not-allowed;
	opacity: 0.6;
	text-decoration: line-through;
}

.rfwc-pro-picker__ticket--sold:hover {
	background: #f0f0f0;
	border-color: #e0e0e0;
	transform: none;
	box-shadow: none;
}

/* Selected state */
.rfwc-pro-picker__ticket--selected {
	background: var(--rfwc-accent, #7f54b3);
	border-color: var(--rfwc-accent-dark, #6b4299);
	color: #fff;
	font-weight: 700;
}

.rfwc-pro-picker__ticket--selected:hover {
	background: var(--rfwc-accent-dark, #6b4299);
	border-color: var(--rfwc-accent-darker, #5a3d82);
	transform: translateY(-1px);
	box-shadow: 0 2px 6px rgba(127, 84, 179, 0.3);
}

/* Reserved by another customer */
.rfwc-pro-picker__ticket--reserved {
	background: #fef3c7;
	border-color: #fbbf24;
	color: #92400e;
	cursor: not-allowed;
	opacity: 0.75;
}

.rfwc-pro-picker__ticket--reserved:hover {
	background: #fef3c7;
	border-color: #fbbf24;
	transform: none;
	box-shadow: none;
}

/* Loading state (waiting for AJAX reservation) */
.rfwc-pro-picker__ticket--loading {
	opacity: 0.5;
	pointer-events: none;
	position: relative;
}

.rfwc-pro-picker__ticket--loading::after {
	content: "";
	position: absolute;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: var(--rfwc-accent, #7f54b3);
	border-radius: 50%;
	animation: rfwc-picker-spin 0.6s linear infinite;
}

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

/* Hidden by search filter */
.rfwc-pro-picker__ticket--hidden {
	display: none;
}

/* Pagination */
.rfwc-pro-picker__pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	margin-top: 0.75em;
	padding-top: 0.75em;
	border-top: 1px solid #eee;
}

.rfwc-pro-picker__page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 0.5em;
	font-size: 0.8125em;
	background: #f7f7f7;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s;
}

.rfwc-pro-picker__page-btn:hover {
	background: var(--rfwc-accent-bg-light, #f9f5ff);
	border-color: var(--rfwc-accent, #7f54b3);
}

.rfwc-pro-picker__page-btn--active {
	background: var(--rfwc-accent, #7f54b3);
	border-color: var(--rfwc-accent-dark, #6b4299);
	color: #fff;
	font-weight: 700;
}

.rfwc-pro-picker__page-btn--disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.rfwc-pro-picker__page-info {
	font-size: 0.8125em;
	color: #666;
}

/* Responsive */
@media (max-width: 600px) {
	.rfwc-pro-picker {
		padding: 0.75em;
	}

	.rfwc-pro-picker__header {
		flex-direction: column;
		align-items: flex-start;
	}

	.rfwc-pro-picker__search {
		width: 100%;
	}

	.rfwc-pro-picker__grid {
		grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
		gap: 4px;
		max-height: 300px;
	}

	.rfwc-pro-picker__ticket {
		min-height: 34px;
		font-size: 0.7em;
	}
}

/* Reservation timer */
.rfwc-pro-picker__timer {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	padding: 0.25em 0.6em;
	font-size: 0.8125em;
	font-weight: 600;
	color: #92400e;
	background: #fef3c7;
	border: 1px solid #fbbf24;
	border-radius: 4px;
	white-space: nowrap;
}

.rfwc-pro-picker__timer--urgent {
	color: #991b1b;
	background: #fee2e2;
	border-color: #fca5a5;
	animation: rfwc-timer-pulse 1s ease-in-out infinite;
}

@keyframes rfwc-timer-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

.rfwc-pro-picker__timer-icon {
	font-size: 1em;
}

/* Temporary notice */
.rfwc-pro-picker__notice {
	padding: 0.5em 0.75em;
	margin-bottom: 0.75em;
	font-size: 0.875em;
	color: #9a3412;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	border-radius: 4px;
}

@media (max-width: 400px) {
	.rfwc-pro-picker__grid {
		grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
	}
}
