/**
 * Room Timeline View Styles
 *
 * Styles for the multi-calendar timeline view where each room
 * has its own vertical calendar strip.
 */

/* Removed: Old multi-calendar styles - now using timeline grid */

/* Room header */
.room-header {
	padding: 1rem;
	color: white;
	font-weight: 600;
	text-align: center;
	border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.room-name {
	font-size: 1rem;
	font-weight: 700;
	margin-bottom: 0.25rem;
}

.room-location {
	font-size: 0.75rem;
	opacity: 0.9;
}

/* Calendar container within room column */
.room-calendar-inner {
	flex: 1;
	padding: 0.5rem;
	overflow-y: auto;
	min-height: 500px;
}

/* FullCalendar adjustments for timeline view */
.room-timeline-column .fc {
	font-size: 0.875rem;
}

.room-timeline-column .fc-timegrid-slot {
	height: 2em;
}

.room-timeline-column .fc-event {
	border-radius: 4px;
	padding: 2px 4px;
	font-size: 0.75rem;
	cursor: move;
}

.room-timeline-column .fc-event-title {
	font-weight: 500;
}

.room-timeline-column .fc-timegrid-axis {
	width: 50px !important;
}

.room-timeline-column .fc-col-header-cell {
	font-size: 0.75rem;
	padding: 0.25rem;
}

/* Drag and drop visual feedback */
.room-timeline-column .fc-event-dragging {
	opacity: 0.6;
	cursor: grabbing !important;
}

.room-timeline-column .fc-event-dragging::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.3);
	pointer-events: none;
}

/* Empty state for rooms with no appointments */
.room-timeline-column .fc-timegrid-body:not(:has(.fc-event)) {
	position: relative;
}

.room-timeline-column .fc-timegrid-body:not(:has(.fc-event))::after {
	content: attr(data-empty-message);
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #9ca3af;
	font-size: 0.875rem;
	text-align: center;
	pointer-events: none;
}

/* Scrollbar styling */
.room-timeline-container::-webkit-scrollbar {
	height: 10px;
}

.room-timeline-container::-webkit-scrollbar-track {
	background: #f1f5f9;
	border-radius: 5px;
}

.room-timeline-container::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 5px;
}

.room-timeline-container::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

/* Room filter dropdown styles */
.room-filter-dropdown {
	position: relative;
	display: inline-block;
}

.room-filter-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	border: 1px solid #d1d5db;
	border-radius: 0.375rem;
	background: white;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s;
}

.room-filter-button:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}

.room-filter-button i {
	font-size: 0.75rem;
}

.room-filter-menu {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 0.5rem;
	min-width: 250px;
	max-height: 400px;
	overflow-y: auto;
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 0.5rem;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
	z-index: 50;
}

.room-filter-menu.hidden {
	display: none;
}

.room-filter-header {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #e5e7eb;
	font-weight: 600;
	font-size: 0.875rem;
	color: #111827;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.room-filter-clear {
	font-size: 0.75rem;
	color: #6b7280;
	cursor: pointer;
	font-weight: normal;
}

.room-filter-clear:hover {
	color: #374151;
	text-decoration: underline;
}

.room-filter-list {
	padding: 0.5rem 0;
	max-height: 300px;
	overflow-y: auto;
}

.room-filter-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 1rem;
	cursor: pointer;
	transition: background-color 0.15s;
}

.room-filter-item:hover {
	background: #f9fafb;
}

.room-filter-item input[type="checkbox"] {
	width: 1rem;
	height: 1rem;
	border-radius: 0.25rem;
	border: 1px solid #d1d5db;
	cursor: pointer;
}

.room-filter-item input[type="checkbox"]:checked {
	background-color: var(--brand-primary);
	border-color: var(--brand-primary);
}

.room-filter-item-label {
	flex: 1;
	font-size: 0.875rem;
	color: #374151;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.room-filter-item-name {
	font-weight: 500;
}

.room-filter-item-location {
	font-size: 0.75rem;
	color: #6b7280;
}

.room-filter-color-dot {
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 50%;
	flex-shrink: 0;
}

/* View mode toggle */
.view-mode-toggle {
	display: inline-flex;
	gap: 0.5rem;
	border: 1px solid #e5e7eb;
	border-radius: 0.375rem;
	padding: 0.25rem;
	background: #f9fafb;
}

.view-mode-button {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.375rem 0.75rem;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #6b7280;
	background: transparent;
	border: none;
	cursor: pointer;
	transition: all 0.15s;
}

.view-mode-button:hover {
	color: #374151;
	background: white;
}

.view-mode-button.active {
	color: white;
	background: var(--brand-primary);
	box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.view-mode-button i {
	font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.room-timeline-column {
		flex: 0 0 250px;
		min-width: 250px;
		max-width: 250px;
	}

	.room-header {
		padding: 0.75rem;
	}

	.room-name {
		font-size: 0.875rem;
	}

	.room-filter-menu {
		right: 0;
		left: auto;
	}
}

/* Animation for filter dropdown */
.room-filter-menu {
	animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==============================================
   TIMELINE GRID VIEW STYLES
   (Rooms as rows, time as columns)
   ============================================== */

.timeline-view {
	width: 100%;
	background: white;
	border-radius: 0.5rem;
}

/* Timeline Navigation */
.timeline-nav {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	border-bottom: 1px solid #e5e7eb;
	flex-wrap: wrap;
}

.timeline-nav-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 0.375rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s;
}

.timeline-nav-btn:hover {
	background: #f9fafb;
	border-color: var(--brand-primary);
	color: var(--brand-primary);
}

.timeline-nav-btn.today-btn {
	background: var(--brand-primary);
	color: white;
	border-color: var(--brand-primary);
}

.timeline-nav-btn.today-btn:hover {
	opacity: 0.9;
}

.timeline-view-toggle {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
}

.timeline-view-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 0.375rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s;
}

.timeline-view-btn:hover {
	background: #f9fafb;
}

.timeline-view-btn.active {
	background: var(--brand-primary);
	color: white;
	border-color: var(--brand-primary);
}

.timeline-title {
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	margin: 0;
	flex-shrink: 0;
}

/* Timeline Grid */
.timeline-grid {
	position: relative;
	overflow-x: auto;
	overflow-y: auto;
	max-height: 70vh;
	cursor: grab;
	scroll-behavior: smooth;
}

.timeline-grid:active {
	cursor: grabbing;
}

.timeline-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	min-width: 800px;
	table-layout: fixed; /* Force fixed column widths */
}

/* Header Row */
.timeline-header-row {
	position: sticky;
	top: 0;
	z-index: 10;
	background: #f9fafb;
}

.timeline-room-header {
	padding: 0.5rem 0.75rem;
	font-weight: 600;
	font-size: 0.8125rem;
	color: #374151;
	background: #f9fafb;
	border-bottom: 2px solid #e5e7eb;
	border-right: 2px solid #e5e7eb;
	position: sticky;
	left: 0;
	z-index: 16; /* Higher than room cells and appointments */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Column Resizer - overlay that spans full grid height */
.column-resize-overlay {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 12px;
	cursor: col-resize;
	z-index: 30;
	pointer-events: all;
	user-select: none;
}

.column-resize-overlay::before {
	content: '';
	position: absolute;
	right: 6px;
	top: 0;
	bottom: 0;
	width: 3px;
	background: transparent;
	transition: background 0.2s;
	pointer-events: none; /* Allow clicks to pass through to parent */
}

.column-resize-overlay:hover::before {
	background: rgba(59, 130, 246, 0.6);
}

.column-resize-overlay:active::before {
	background: #2563eb;
	width: 4px;
	right: 5px;
}

.timeline-time-header {
	padding: 0.5rem 0.25rem;
	font-weight: 600;
	font-size: 0.8125rem;
	color: #6b7280;
	text-align: center;
	background: #f9fafb;
	border-bottom: 2px solid #e5e7eb;
	border-right: 1px solid #e5e7eb;
	white-space: nowrap;
}

/* Room Rows */
.timeline-room-row {
	display: table-row;
}

.timeline-room-cell {
	display: table-cell;
	padding: 0.5rem 0.75rem;
	font-weight: 400; /* Reduced from 500 - less prominent */
	font-size: 0.8125rem;
	border-bottom: 1px solid #e5e7eb;
	border-right: 2px solid #e5e7eb;
	position: sticky;
	left: 0;
	z-index: 15; /* Higher than appointments (z-index: 10) */
	background: #f9fafb; /* Light gray background instead of white */
	vertical-align: top;
	overflow: hidden;
}

.timeline-room-cell .room-name {
	font-weight: 500; /* Reduced from 600 */
	color: #6b7280; /* Gray instead of dark gray */
	margin-bottom: 0.25rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.timeline-room-cell .room-location {
	font-size: 0.75rem;
	color: #9ca3af; /* Lighter gray */
	font-weight: 400;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Time Slots */
.timeline-slot {
	display: table-cell;
	padding: 0.25rem;
	border-bottom: 1px solid #e5e7eb;
	border-right: 1px solid #f3f4f6; /* Light border for 15-min slots */
	vertical-align: top;
	min-height: 80px;
	background: white;
	position: relative;
	transition: background-color 0.2s, border-color 0.2s;
}

/* Day view slots - narrow 15-min slots */
.timeline-slot.day-slot {
	min-width: 25px;
	max-width: 25px;
	width: 25px;
}

/* Week view slots - wider day columns */
.timeline-slot.week-slot {
	min-width: 120px;
	max-width: 120px;
	width: 120px;
	padding: 0.5rem;
}

/* Hour boundary - thicker LEFT border (start of hour) */
.timeline-slot.hour-boundary {
	border-left: 2px solid #d1d5db; /* Thicker LEFT border on full hours */
}

/* Highlight today's column (week view only) */
.timeline-slot.today-slot {
	background-color: #fef3c7; /* Light yellow background */
	border-right-color: #fbbf24;
}

.timeline-slot:hover {
	background: #f9fafb;
}

.timeline-slot.today-slot:hover {
	background: #fde68a; /* Slightly darker yellow on hover */
}

/* Unavailable slot - too small gap (15 min only) */
.timeline-slot.slot-unavailable {
	background-color: #f3f4f6; /* Light gray background */
	cursor: not-allowed;
	position: relative;
}

.timeline-slot.slot-unavailable:hover {
	background-color: #e5e7eb; /* Slightly darker gray on hover */
}

.timeline-slot.slot-unavailable::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 2px;
	height: 60%;
	background: repeating-linear-gradient(
		0deg,
		#d1d5db,
		#d1d5db 2px,
		transparent 2px,
		transparent 4px
	);
}

/* Appointments in Timeline */
.timeline-appointment {
	padding: 0.25rem 0.375rem;
	border-radius: 0.25rem;
	margin-bottom: 0.125rem;
	color: white;
	font-size: 0.6875rem;
	cursor: move;
	transition: all 0.15s;
	box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	user-select: none;
	line-height: 1.2;
}

.timeline-appointment:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.1);
}

.timeline-appointment.dragging {
	opacity: 0.5;
	transform: scale(0.95);
	box-shadow: 0 4px 8px 0 rgb(0 0 0 / 0.2);
}

.timeline-appointment .apt-time {
	font-weight: 600;
	font-size: 0.6875rem;
	margin-bottom: 0.0625rem;
}

.timeline-appointment .apt-patient {
	font-weight: 500;
	font-size: 0.6875rem;
	margin-bottom: 0.0625rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.timeline-appointment .apt-duration {
	font-size: 0.625rem;
	opacity: 0.85;
}

/* Drag & Drop Visual Feedback */
.timeline-slot.drag-over {
	background: #dbeafe;
	border: 2px dashed var(--brand-primary);
	box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Conflict warning when dropping would cause employee double-booking */
.timeline-slot.conflict-warning {
	background-color: #fee2e2; /* Light red */
	border: 2px solid #ef4444; /* Red border */
	box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.2);
	cursor: not-allowed;
}

.timeline-slot.conflict-warning::after {
	content: attr(data-conflict-message);
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #dc2626;
	color: white;
	padding: 0.5rem 0.75rem;
	border-radius: 0.375rem;
	font-weight: 600;
	font-size: 0.75rem;
	white-space: nowrap;
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
	z-index: 20;
	pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
	.timeline-nav {
		flex-direction: column;
		align-items: stretch;
	}

	.timeline-view-toggle {
		margin-left: 0;
		width: 100%;
	}

	.timeline-view-btn {
		flex: 1;
		justify-content: center;
	}

	.timeline-title {
		text-align: center;
		width: 100%;
	}

	.timeline-room-header,
	.timeline-room-cell {
		min-width: 120px;
		max-width: 120px;
		width: 120px;
	}

	.timeline-time-header {
		min-width: 80px;
	}

	.timeline-slot {
		min-width: 80px;
	}
}
