/*
 * HDT Course Dates - Frontend Styles
 * Colour variables are defined here — adjust to match your theme if needed.
 */

:root {
	--hdt-primary:      #1a2e4a;   /* Navy — table/modal header. Editable in Settings > HDT Course Dates */
	--hdt-accent:       #e8600a;   /* Orange — button/links */
	--hdt-accent-hover: #c9520a;
	--hdt-btn-text:     #ffffff;   /* Button label colour */
	--hdt-border:       #dde3ea;
	--hdt-row-alt:      #f7f9fb;
	--hdt-text:         #1a1a1a;
	--hdt-text-muted:   #5a6475;
	--hdt-radius:       6px;
}

/* -----------------------------------------------------------------------
   Table wrapper
   --------------------------------------------------------------------- */

.hdt-course-dates {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 1.5em 0;
	border: 1px solid var(--hdt-primary);
	border-radius: var(--hdt-radius);
}

/* -----------------------------------------------------------------------
   Table
   --------------------------------------------------------------------- */

.hdt-dates-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 0.95rem;
	color: var(--hdt-text);
	background: #fff;
	border-radius: var(--hdt-radius);
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.hdt-dates-table thead tr {
	background: var(--hdt-primary);
	color: #fff;
}

.hdt-dates-table thead th {
	padding: 14px 18px;
	text-align: left;
	font-weight: 600;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	border: none;
}

.hdt-dates-table tbody tr {
	border-bottom: 1px solid var(--hdt-border);
	transition: background 0.15s ease;
}

.hdt-dates-table tbody tr:last-child {
	border-bottom: none;
}

.hdt-dates-table tbody tr:nth-child(even) {
	background: var(--hdt-row-alt);
}

.hdt-dates-table tbody tr:hover {
	background: #eef2f8;
}

.hdt-dates-table td {
	padding: 14px 18px;
	vertical-align: middle;
	border: none;
}

/* Column widths */
.hdt-col-title  { font-weight: 600; min-width: 160px; }
.hdt-col-date   { white-space: nowrap; min-width: 160px; }
.hdt-col-time   { white-space: nowrap; min-width: 80px; color: var(--hdt-text-muted); }
.hdt-col-notes  { color: var(--hdt-text-muted); font-size: 0.9rem; }
.hdt-col-action { text-align: right; white-space: nowrap; width: 1%; }

/* -----------------------------------------------------------------------
   Enquire button
   --------------------------------------------------------------------- */

.hdt-enquire-btn {
	display: inline-block;
	padding: 8px 20px;
	background: var(--hdt-accent);
	color: var(--hdt-btn-text) !important;
	border: none;
	border-radius: var(--hdt-radius);
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	transition: background 0.2s ease, transform 0.1s ease;
	white-space: nowrap;
}

.hdt-enquire-btn:hover,
.hdt-enquire-btn:focus {
	background: var(--hdt-accent-hover);
	outline: none;
	transform: translateY(-1px);
}

.hdt-enquire-btn:active {
	transform: translateY(0);
}

/* -----------------------------------------------------------------------
   No dates message
   --------------------------------------------------------------------- */

.hdt-no-dates {
	padding: 16px 20px;
	background: var(--hdt-row-alt);
	border-left: 4px solid var(--hdt-primary);
	border-radius: var(--hdt-radius);
	color: var(--hdt-text-muted);
	font-size: 0.95rem;
	margin: 1em 0;
}

.hdt-no-dates a {
	color: var(--hdt-accent);
	font-weight: 600;
}

/* -----------------------------------------------------------------------
   Modal overlay
   --------------------------------------------------------------------- */

.hdt-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(10, 20, 40, 0.65);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.hdt-modal-overlay.hdt-is-open {
	display: flex;
}

/* -----------------------------------------------------------------------
   Modal box
   --------------------------------------------------------------------- */

.hdt-modal {
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.3);
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	overflow-y: auto;
	animation: hdtModalIn 0.22s ease;
}

@keyframes hdtModalIn {
	from { opacity: 0; transform: translateY(-16px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.hdt-modal-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 22px 24px 18px;
	border-bottom: 1px solid var(--hdt-border);
	background: var(--hdt-primary);
	border-radius: 10px 10px 0 0;
}

.hdt-modal-label {
	margin: 0 0 2px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255,255,255,0.65);
}

.hdt-modal-header .hdt-modal-course-name {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	color: #fff !important;
	line-height: 1.3;
}

.hdt-modal-close {
	flex-shrink: 0;
	background: rgba(255,255,255,0.15);
	border: none;
	border-radius: 50%;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s;
	margin-top: 2px;
}

.hdt-modal-close:hover,
.hdt-modal-close:focus {
	background: rgba(255,255,255,0.3);
	outline: none;
}

.hdt-modal-body {
	padding: 24px;
}

/* -----------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

@media ( max-width: 680px ) {
	.hdt-dates-table {
		font-size: 0.88rem;
	}

	.hdt-dates-table thead th,
	.hdt-dates-table td {
		padding: 11px 12px;
	}

	/* Stack table on very small screens */
	.hdt-dates-table,
	.hdt-dates-table thead,
	.hdt-dates-table tbody,
	.hdt-dates-table th,
	.hdt-dates-table td,
	.hdt-dates-table tr {
		display: block;
	}

	.hdt-dates-table thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	.hdt-dates-table tr {
		border: 1px solid var(--hdt-border);
		border-radius: var(--hdt-radius);
		margin-bottom: 12px;
		padding: 4px 0;
	}

	.hdt-dates-table td {
		border: none;
		border-bottom: 1px solid var(--hdt-border);
		position: relative;
		padding-left: 45%;
	}

	.hdt-dates-table td:last-child {
		border-bottom: none;
	}

	.hdt-dates-table td::before {
		content: attr(data-label);
		position: absolute;
		left: 12px;
		top: 50%;
		transform: translateY(-50%);
		width: 38%;
		font-size: 0.75rem;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--hdt-text-muted);
	}

	.hdt-col-action {
		text-align: left;
	}

	.hdt-modal {
		max-height: 95vh;
	}
}
