/**
 * Certified Clients Directory - Frontend styles
 *
 * @package Certified_Clients_Directory
 */

.ccd-directory-wrapper {
	max-width: 100%;
	margin: 1.5em 0;
}

/* Filter bar */
.ccd-filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	margin-bottom: 1.5em;
	align-items: center;
}

.ccd-filter-search {
	flex: 1;
	min-width: 200px;
}

.ccd-filter-search .ccd-search-input {
	width: 100%;
	max-width: 400px;
	padding: 0.5em 0.75em;
	font-size: 15px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.ccd-filter-status .ccd-status-select {
	padding: 0.5em 2em 0.5em 0.75em;
	font-size: 15px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
}

.ccd-filter-layout {
	display: flex;
	gap: 0.25em;
}

.ccd-layout-btn {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, border-color 0.2s;
}

.ccd-layout-btn:hover {
	background: #f5f5f5;
	border-color: #999;
}

.ccd-layout-btn.ccd-layout-active {
	background: #333;
	border-color: #333;
	color: #fff;
}

.ccd-layout-icon-table {
	display: block;
	width: 16px;
	height: 12px;
	border: 2px solid currentColor;
	position: relative;
}

.ccd-layout-icon-table::before,
.ccd-layout-icon-table::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 0;
	border-top: 2px solid currentColor;
}

.ccd-layout-icon-table::before { top: 33%; }
.ccd-layout-icon-table::after { top: 66%; }

.ccd-layout-icon-cards {
	display: block;
	width: 5px;
	height: 5px;
	background: currentColor;
	box-shadow:
		6px 0 0 currentColor,
		0 6px 0 currentColor,
		6px 6px 0 currentColor;
	border-radius: 1px;
}

/* Layout containers - show only active */
.ccd-layout-table,
.ccd-layout-cards {
	display: none;
}

.ccd-layout-table.ccd-layout-active,
.ccd-layout-cards.ccd-layout-active {
	display: block;
}

/* Table layout */
.ccd-directory-table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.ccd-directory-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
}

.ccd-directory-table th,
.ccd-directory-table td {
	padding: 0.75em 1em;
	text-align: left;
	border-bottom: 1px solid #ddd;
	vertical-align: top;
}

.ccd-directory-table thead th {
	background: #f5f5f5;
	font-weight: 600;
	color: #333;
}

.ccd-directory-table tbody tr:hover {
	background: #fafafa;
}

.ccd-directory-table .ccd-org-details {
	font-size: 0.95em;
	color: #666;
}

/* Sites read more */
.ccd-sites-container .ccd-read-more,
.ccd-sites-container .ccd-read-less {
	font-size: 0.9em;
	color: #0073aa;
	text-decoration: none;
	cursor: pointer;
}

.ccd-sites-container .ccd-read-more:hover,
.ccd-sites-container .ccd-read-less:hover {
	text-decoration: underline;
}

.ccd-status-badge {
	display: inline-block;
	padding: 0.0em 0.6em;
	border-radius: 4px;
	font-size: 0.85em;
	font-weight: 600;
}

.ccd-status-valid {
	background: #c9e1be;
	color: #283d2c;
}

.ccd-status-expired {
	background: #f8d7da;
	color: #b82c3a;
}

.ccd-status-suspended {
	background: #fff3cd;
	color: #856404;
}

.ccd-status-withdrawn {
	background: #e2e3e5;
	color: #383d41;
}

.ccd-status-unknown {
	background: #e9ecef;
	color: #495057;
}

/* Cards layout - compact */
.ccd-directory-cards {
	display: grid;
	gap: 1.5em;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.ccd-card-compact {
	border: 1px solid #113163;
	border-radius: 8px;
	padding: 1.25em;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	transition: box-shadow 0.2s ease;
	cursor: pointer;
	position: relative;
}

.ccd-card-compact:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ccd-card-compact .ccd-card-title {
	margin: 0 0 0.5em;
	font-size: 1.15em;
	line-height: 1.3;
	color: #113163;
}

.ccd-card-compact .ccd-card-scope {
	margin: 0.5em 0;
	font-size: 0.95em;
	color: #212121;
	line-height: 1.5;
}

.ccd-card-compact .ccd-card-meta {
	margin-top: 0.75em;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1em;
	align-items: center;
	font-size: 0.9em;
	color: #666;
}

.ccd-card-compact .ccd-meta-item {
	display: inline-block;
}

.ccd-card-compact .ccd-card-view-btn {
	margin-top: 1em;
	padding: 0.4em 1em;
	font-size: 14px;
	background: #113163;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s;
}

.ccd-card-compact .ccd-card-view-btn:hover {
	background: #555;
}

.ccd-card-compact .ccd-card-view-btn:focus {
	outline: 2px solid #333;
	outline-offset: 2px;
}

/* Modal */
.ccd-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2em;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s;
}

.ccd-modal.ccd-modal-open {
	opacity: 1;
	visibility: visible;
}

.ccd-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
}

.ccd-modal-content {
	position: relative;
	max-width: 600px;
	max-height: 90vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 24px rgba(0,0,0,0.2);
	padding: 1.5em 2em 2em;
}

.ccd-modal-close {
	position: absolute;
	top: 0.75em;
	right: 0.75em;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	color: #666;
	cursor: pointer;
}

.ccd-modal-close:hover {
	color: #333;
}

.ccd-modal-header {
	font-size: 1.35em;
	font-weight: 600;
	margin-bottom: 1em;
	padding-right: 2.5em;
}

.ccd-modal-body {
	font-size: 15px;
	line-height: 1.6;
}

.ccd-modal-body p {
	margin: 0.75em 0;
}

body.ccd-modal-active {
	overflow: hidden;
}

/* No results */
.ccd-no-results {
	padding: 2em;
	text-align: center;
	color: #666;
	background: #f9f9f9;
	border-radius: 4px;
	font-size: 15px;
}

/* Responsive - stack table on small screens */
@media screen and (max-width: 768px) {
	.ccd-directory-table thead {
		display: none;
	}

	.ccd-directory-table tr {
		display: block;
		margin-bottom: 1em;
		border: 1px solid #ddd;
		border-radius: 6px;
		overflow: hidden;
	}

	.ccd-directory-table td {
		display: block;
		text-align: left;
		padding: 0.5em 1em;
		border: none;
		border-bottom: 1px solid #eee;
	}

	.ccd-directory-table td:last-child {
		border-bottom: none;
	}

	.ccd-directory-table td::before {
		content: attr(data-label);
		font-weight: 600;
		display: block;
		margin-bottom: 0.25em;
		color: #555;
	}

	.ccd-filter-bar {
		flex-direction: column;
		align-items: stretch;
	}

	.ccd-filter-search .ccd-search-input {
		max-width: none;
	}
}
