.caat-ad-search-form.form {
	grid-template-columns: minmax(0, 1fr);

	.form-reset {
		margin-block-start: 0;
	}

	@media (width >= 768px) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	@media (width >= 992px) {
		grid-template-columns: repeat(2, minmax(0, 1fr)) 150px 150px;
	}
}

.caat-airworthiness-directive-details-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 4px;
	margin-block-start: 16px;

	&:first-child {
		margin-block-start: 0;
	}

	@media (width >= 768px) {
		grid-template-columns: 260px minmax(0, 1fr);
		gap: 16px;
	}
}

.caat-airworthiness-directive-details-label {
	font-weight: 500;
}

.caat-airworthiness-directive-details-tag {
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 0.875rem;
	font-weight: 500;
	border: 1px solid #0f2d42;
	color: #0f2d42;
}

.card-document-list-header {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: center;
	margin-block-start: var(--wp--style--block-gap);
}

/* View toggle buttons */
.caat-ad-view-toggle {
	display: flex;
	gap: 4px;
	justify-content: flex-end;
}

.caat-ad-view-btn {
	padding: 8px 12px;
	border: 1px solid #0f2d42;
	background: transparent;
	color: #0f2d42;
	cursor: pointer;
	border-radius: 4px;
	line-height: 1;
	transition: background 0.15s, color 0.15s;

	&.active,
	&:hover {
		background: #0f2d42;
		color: #fff;
	}
}

/* Table view */
.caat-ad-table-wrapper {
	margin-block-start: var(--wp--style--block-gap);
	overflow-x: auto;
	cursor: grab;
}

.caat-ad-table-wrapper.is-dragging {
	cursor: grabbing;
	user-select: none;
}

.caat-ad-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
	table-layout: auto;

	th,
	td {
		padding: 10px 12px;
		text-align: left;
		border-bottom: 1px solid #e5e7eb;
		vertical-align: top;
	}

	.col-1 {
		min-width: 100px;
		width: 10%;
	}

	.col-2 {
		min-width: 180px;
	}

	.col-3 {
		min-width: 200px;
	}

	.col-4 {
		min-width: 80px;
		width: 1%;
		white-space: nowrap;
	}

	th {
		font-weight: 600;
		background: #f9fafb;
		white-space: nowrap;
	}

	tbody tr:hover {
		background: #f3f4f6;
	}

	a {
		color: #0f2d42;
		text-decoration: underline;

		&:hover {
			text-decoration: none;
		}
	}

	td:has(.caat-airworthiness-directive-details-tag) .caat-airworthiness-directive-details-value {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}
}

.caat-ad-table-wrapper.is-dragging a {
	pointer-events: none;
}

/* Show/hide views */
.caat-ad-list .caat-ad-table-wrapper {
	display: none;
}

.caat-ad-list[data-view="table"] .card-document-list {
	display: none;
}

.caat-ad-list[data-view="table"] .caat-ad-table-wrapper {
	display: block;
}
