/* =====================================================================
   Directory Manager — frontend styles
   ===================================================================== */

.wpdir-wrap {
	margin: 0 0 24px;
}

.wpdir-title {
	margin: 0 0 10px;
	font-size: 1.35em;
}

/* ---- Table ----------------------------------------------------------- */
.wpdir-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	max-width: 100%;
	margin: 0 0 14px;
}

.wpdir-table-scroll .wpdir-table {
	margin: 0;
}

.wpdir-table {
	width: 100%;
	border-collapse: collapse;
}

.wpdir-table th,
.wpdir-table td {
	border: 1px solid #e2e2e2;
	padding: 10px 12px;
	text-align: left;
	vertical-align: middle;
}

.wpdir-table th {
	background: #f7f7f7;
	font-weight: 600;
}

/* ---- Manual sort: clickable sortable column headers ------------------- */
.wpdir-table th.wpdir-sortable {
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}

.wpdir-table th.wpdir-sortable .wpdir-sort-indicator::after {
	content: '⇅';
	opacity: 0.4;
	margin-left: 5px;
	font-size: 0.8em;
}

.wpdir-table th.wpdir-sort-asc .wpdir-sort-indicator::after {
	content: '▲';
	opacity: 0.85;
}

.wpdir-table th.wpdir-sort-desc .wpdir-sort-indicator::after {
	content: '▼';
	opacity: 0.85;
}

/* ---- Percentage column widths (set in the admin Columns editor) -------- */
/* When widths are set the table uses a fixed layout, so every column keeps
   the exact same scale on desktop and mobile; the wrapper above provides
   horizontal scrolling on narrow screens. Without widths the table falls
   back to automatic, content-based sizing. */
.wpdir-table.wpdir-cols-fixed {
	table-layout: fixed;
}

.wpdir-table.wpdir-cols-fixed th,
.wpdir-table.wpdir-cols-fixed td {
	overflow-wrap: break-word;
	word-break: break-word;
}

.wpdir-table.wpdir-cols-fixed th {
	white-space: normal;
}

.wpdir-table.wpdir-cols-fixed .wpdir-btn {
	max-width: 100%;
	word-break: break-word;
}

/* While the frontend table is being edited each row gains an extra "actions"
   column, so the layout falls back to auto to handle it gracefully. */
.wpdir-wrap.wpdir-editing .wpdir-table {
	table-layout: auto;
}

.wpdir-table tr:nth-child(even) td {
	background: #fcfcfc;
}

/* ---- Merged section separator row ------------------------------------- */
.wpdir-section-row td {
	background: #eef1f4 !important;
	border-top: 2px solid #d0d6dc;
}

.wpdir-section-label {
	display: block;
	font-weight: 700;
	font-size: 1.05em;
	letter-spacing: 0.02em;
}

/* ---- Live search box -------------------------------------------------- */
.wpdir-search {
	margin: 0 0 10px;
}

.wpdir-search-input {
	width: 100%;
	max-width: 380px;
	padding: 8px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 0.95em;
	box-sizing: border-box;
	background: #fff;
}

.wpdir-search-input:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

.wpdir-no-results td {
	background: #fcfcfc !important;
	color: #646970;
	text-align: center;
	font-style: italic;
}

/* ---- Elegant link button (light red bg, white text) ------------------- */
.wpdir-btn {
	display: inline-block;
	padding: 9px 20px;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.95em;
	line-height: 1.3;
	text-decoration: none;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
	transition: opacity 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.wpdir-btn:hover,
.wpdir-btn:focus {
	opacity: 0.85;
	text-decoration: none;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.wpdir-btn:active {
	transform: translateY(1px);
}

.wpdir-error {
	color: #b32d2e;
	font-weight: 600;
}

/* ---- Frontend editing --------------------------------------------------- */
.wpdir-edit-controls {
	margin: 10px 0 0;
}

.wpdir-edit-controls button {
	cursor: pointer;
}

.wpdir-edit-toggle,
.wpdir-edit-save,
.wpdir-edit-cancel {
	padding: 8px 16px;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
	background: #f6f7f7;
	font-size: 0.9em;
}

.wpdir-edit-save {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.wpdir-edit-status {
	margin-left: 10px;
	font-style: italic;
}

.wpdir-edit-cell input {
	width: 100%;
	box-sizing: border-box;
	padding: 5px 7px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	font-size: 0.92em;
	margin: 2px 0;
}

.wpdir-edit-cell textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 5px 7px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	font-size: 0.92em;
	font-family: inherit;
	min-height: 64px;
	resize: vertical;
	margin: 2px 0;
}

.wpdir-edit-cell .wpdir-link-url {
	margin-top: 4px;
}

/* ---- Rich-text cell preview (TinyMCE modal opens on click) --------------- */
.wpdir-edit-cell .wpdir-richtext-preview {
	border: 1px dashed #c3c4c7;
	background: #fafafa;
	border-radius: 3px;
	padding: 6px 8px;
	min-height: 34px;
	cursor: pointer;
	font-size: 0.92em;
	line-height: 1.5;
	word-break: break-word;
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.wpdir-edit-cell .wpdir-richtext-preview:hover,
.wpdir-edit-cell .wpdir-richtext-preview:focus {
	border-color: #2271b1;
	background: #fff;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

.wpdir-edit-cell .wpdir-richtext-preview:empty::before {
	content: attr(data-placeholder);
	color: #a7aaad;
	font-style: italic;
}

.wpdir-edit-cell .wpdir-richtext-preview p {
	margin: 0 0 4px;
}

.wpdir-edit-cell .wpdir-richtext-preview p:last-child {
	margin-bottom: 0;
}

.wpdir-edit-cell .wpdir-richtext-preview ul,
.wpdir-edit-cell .wpdir-richtext-preview ol {
	margin: 0 0 4px 20px;
	padding: 0;
}

/* Rich text inside table cells */
.wpdir-table td p {
	margin: 0 0 6px;
}

.wpdir-table td p:last-child {
	margin-bottom: 0;
}

.wpdir-table td ul,
.wpdir-table td ol {
	margin: 0 0 6px 22px;
	padding: 0;
}

.wpdir-row-actions-cell {
	width: 110px;
	white-space: nowrap;
	text-align: center;
}

.wpdir-row-actions-cell button {
	cursor: pointer;
	padding: 3px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	background: #f6f7f7;
	margin: 1px;
}

.wpdir-row-actions-cell .wpdir-row-remove {
	color: #b32d2e;
	border-color: #b32d2e;
}

.wpdir-edit-actions-row td {
	background: #f0f6fc !important;
	padding: 8px;
}

.wpdir-edit-actions-row button {
	padding: 6px 12px;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
	background: #fff;
	cursor: pointer;
	margin-right: 6px;
}

/* ---- Rich-text modal editor (shared with wpdir-mce.js) ------------------ */
.wpdir-mce-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 16px;
	overflow-y: auto;
}

.wpdir-mce-modal {
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	width: 100%;
	max-width: 760px;
	display: flex;
	flex-direction: column;
}

.wpdir-mce-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-bottom: 1px solid #dcdcde;
	font-weight: 600;
	font-size: 14px;
}

.wpdir-mce-modal-close {
	border: 0;
	background: transparent;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #787c82;
	padding: 2px 6px;
}

.wpdir-mce-modal-close:hover {
	color: #1d2327;
}

.wpdir-mce-modal-body {
	padding: 14px;
}

.wpdir-mce-modal-body .mce-tinymce {
	box-shadow: none;
}

.wpdir-mce-modal-foot {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid #dcdcde;
}

.wpdir-mce-modal-foot button {
	padding: 6px 14px;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
	background: #f6f7f7;
	color: #1d2327;
	cursor: pointer;
	font-size: 13px;
}

.wpdir-mce-modal-foot .wpdir-mce-modal-save {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}
