/*
 * Social Tennis Manager — Public Styles
 *
 * All rules are scoped inside .stm-public-wrap to prevent conflicts with
 * the host theme (nottinghamtennis.com).
 *
 * Design principles:
 * - Mobile-first, responsive.
 * - WCAG AA colour contrast (≥ 4.5:1 for normal text on all tinted backgrounds).
 * - Blue tint for male spots, pink tint for female spots.
 * - No external fonts, no CDN assets.
 *
 * @package Social_Tennis_Manager
 * @since   1.0.0
 */

/* ==========================================================================
   Reset / Base (scoped)
   ========================================================================== */

.stm-public-wrap *,
.stm-public-wrap *::before,
.stm-public-wrap *::after {
	box-sizing: border-box;
}

.stm-public-wrap {
	font-family: inherit;
	color: inherit;
	line-height: 1.5;
}

/* ==========================================================================
   Utility: Notices
   ========================================================================== */

.stm-public-wrap .stm-notice {
	padding: 0.75rem 1rem;
	border-left: 4px solid currentColor;
	border-radius: 3px;
	margin-bottom: 1rem;
}

.stm-public-wrap .stm-notice--info {
	background-color: #eef6fb;
	color: #1a5276; /* contrast ratio ≈ 9:1 on #eef6fb */
	border-left-color: #2e86c1;
}

.stm-public-wrap .stm-notice--error {
	background-color: #fdf2f2;
	color: #7b241c; /* contrast ratio ≈ 9:1 on #fdf2f2 */
	border-left-color: #c0392b;
}

/* ==========================================================================
   Utility: Buttons
   ========================================================================== */

.stm-public-wrap .stm-btn {
	display: inline-block;
	padding: 0.5rem 1.25rem;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.stm-public-wrap .stm-btn:focus {
	outline: 3px solid #2e86c1;
	outline-offset: 2px;
}

.stm-public-wrap .stm-btn--primary {
	background-color: #2e86c1;
	color: #ffffff; /* contrast ratio ≈ 4.7:1 */
}

.stm-public-wrap .stm-btn--primary:hover {
	background-color: #1a6fa3;
}

.stm-public-wrap .stm-btn--book {
	background-color: #1e8449;
	color: #ffffff; /* contrast ratio ≈ 5.2:1 */
	font-size: 0.85rem;
	padding: 0.4rem 0.75rem;
}

.stm-public-wrap .stm-btn--book:hover {
	background-color: #186a3b;
}

/* ==========================================================================
   Password Gate
   ========================================================================== */

.stm-public-wrap .stm-password-gate {
	max-width: 26rem;
	margin: 2rem auto;
	padding: 1.75rem 2rem;
	border: 1px solid #dde3e9;
	border-radius: 6px;
	background-color: #fafbfc;
}

.stm-public-wrap .stm-password-gate__title {
	margin: 0 0 0.5rem;
	font-size: 1.4rem;
}

.stm-public-wrap .stm-password-gate__intro {
	margin: 0 0 1rem;
	color: #555;
}

.stm-public-wrap .stm-password-gate__error {
	padding: 0.6rem 0.9rem;
	background-color: #fdf2f2;
	border-left: 4px solid #c0392b;
	color: #7b241c; /* contrast ratio ≈ 9:1 */
	border-radius: 3px;
	margin-bottom: 1rem;
}

.stm-public-wrap .stm-password-gate__field {
	margin-bottom: 1rem;
}

.stm-public-wrap .stm-password-gate__label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 600;
	font-size: 0.9rem;
}

.stm-public-wrap .stm-password-gate__input {
	width: 100%;
	padding: 0.5rem 0.75rem;
	border: 1px solid #b0b8c1;
	border-radius: 4px;
	font-size: 1rem;
	line-height: 1.4;
	transition: border-color 0.15s ease;
}

.stm-public-wrap .stm-password-gate__input:focus {
	border-color: #2e86c1;
	outline: 3px solid rgba(46, 134, 193, 0.35);
}

.stm-public-wrap .stm-password-gate__actions {
	text-align: right;
}

/* ==========================================================================
   Event List
   ========================================================================== */

.stm-public-wrap .stm-event-list__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.stm-public-wrap .stm-event-list__empty {
	color: #555;
	font-style: italic;
}

.stm-public-wrap .stm-event-card {
	padding: 1.25rem 1.5rem;
	border: 1px solid #dde3e9;
	border-radius: 6px;
	background-color: #fafbfc;
	margin-bottom: 1rem;
}

.stm-public-wrap .stm-event-card__title {
	margin: 0 0 0.4rem;
	font-size: 1.2rem;
}

.stm-public-wrap .stm-event-card__date,
.stm-public-wrap .stm-event-card__time,
.stm-public-wrap .stm-event-card__spots {
	margin: 0 0 0.35rem;
	font-size: 0.95rem;
	color: #333;
}

.stm-public-wrap .stm-event-card__actions {
	margin: 0.75rem 0 0;
}

/* ==========================================================================
   Single Event
   ========================================================================== */

.stm-public-wrap .stm-event-single__header {
	margin-bottom: 2rem;
}

.stm-public-wrap .stm-event-single__title {
	margin: 0 0 0.75rem;
	font-size: 1.6rem;
}

.stm-public-wrap .stm-event-single__meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.25rem 1rem;
	margin: 0 0 1rem;
	padding: 0;
}

.stm-public-wrap .stm-event-single__meta-label {
	font-weight: 600;
	color: #555;
	font-size: 0.9rem;
}

.stm-public-wrap .stm-event-single__meta-value {
	color: #222;
	font-size: 0.9rem;
}

.stm-public-wrap .stm-event-single__description {
	border-top: 1px solid #dde3e9;
	padding-top: 0.75rem;
}

.stm-public-wrap .stm-event-single__courts-heading {
	margin: 0 0 1rem;
	font-size: 1.2rem;
}

/* ==========================================================================
   Court — Tennis Court Visual
   ========================================================================== */

.stm-public-wrap .stm-court {
	background: linear-gradient(180deg, #337a58 0%, #2a6e4c 100%);
	border: 4px solid rgba(255, 255, 255, 0.88);
	border-radius: 4px;
	margin-bottom: 2rem;
	overflow: hidden;
	box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
}

.stm-public-wrap .stm-court__title {
	margin: 0;
	padding: 0.5rem 1rem;
	background-color: rgba(0, 0, 0, 0.52);
	color: #ffffff;
	font-size: 0.85rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	text-align: center;
}

.stm-public-wrap .stm-court__grid {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: auto auto;
	gap: 0.4rem;
	padding: 0.6rem;
	position: relative;
}

/* Mixed courts: 3-column grid — [left spots] [net] [right spots]
   Spots are placed explicitly by .stm-spot--idx-N so auto-flow order doesn't matter. */
.stm-public-wrap .stm-court--mixed .stm-court__grid {
	grid-template-columns: 1fr 16px 1fr;
}

/* Explicit spot placement for mixed courts:
   male_1 (idx-0) top-left  | NET | male_2 (idx-1) top-right
   female_1 (idx-2) bot-left | NET | female_2 (idx-3) bot-right */
.stm-public-wrap .stm-court--mixed .stm-spot--idx-0 { grid-column: 1; grid-row: 1; }
.stm-public-wrap .stm-court--mixed .stm-spot--idx-1 { grid-column: 3; grid-row: 1; }
.stm-public-wrap .stm-court--mixed .stm-spot--idx-2 { grid-column: 1; grid-row: 2; }
.stm-public-wrap .stm-court--mixed .stm-spot--idx-3 { grid-column: 3; grid-row: 2; }

/* Mens / Ladies courts: always single column */
.stm-public-wrap .stm-court--mens .stm-court__grid,
.stm-public-wrap .stm-court--ladies .stm-court__grid {
	grid-template-columns: 1fr;
}

/* ==========================================================================
   Net Divider — vertical centre column
   ========================================================================== */

.stm-public-wrap .stm-court--mixed .stm-court__net {
	grid-column: 2;
	grid-row: 1 / -1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
	gap: 6px;
}

/* Dashed net strands above and below the label */
.stm-public-wrap .stm-court--mixed .stm-court__net::before,
.stm-public-wrap .stm-court--mixed .stm-court__net::after {
	content: '';
	flex: 1;
	width: 4px;
	background: repeating-linear-gradient(
		180deg,
		rgba(255, 255, 255, 0.88) 0px,
		rgba(255, 255, 255, 0.88) 5px,
		rgba(255, 255, 255, 0.15) 5px,
		rgba(255, 255, 255, 0.15) 9px
	);
	border-radius: 2px;
}

.stm-public-wrap .stm-court__net-label {
	flex-shrink: 0;
	background: #1b2a38;
	color: rgba(255, 255, 255, 0.92);
	font-size: 0.52rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	padding: 5px 3px;
	border-radius: 2px;
	writing-mode: vertical-lr;
	transform: rotate(180deg);
}

/* ==========================================================================
   Individual Spot
   ========================================================================== */

.stm-public-wrap .stm-spot {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	padding: 1rem 0.75rem;
	min-height: 90px;
	border-radius: 3px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	text-align: center;
	position: relative;
	z-index: 1;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stm-public-wrap .stm-spot--male {
	background-color: rgba(59, 130, 246, 0.22);
}

.stm-public-wrap .stm-spot--female {
	background-color: rgba(247, 109, 176, 0.38);
}

.stm-public-wrap .stm-spot--male.stm-spot--booked {
	background-color: rgba(59, 130, 246, 0.52);
	border-color: rgba(147, 197, 253, 0.65);
}

.stm-public-wrap .stm-spot--female.stm-spot--booked {
	background-color: rgba(247, 109, 176, 0.62);
	border-color: rgba(247, 109, 176, 0.75);
}

.stm-public-wrap .stm-spot--available:hover {
	border-color: rgba(255, 255, 255, 0.6);
	background-color: rgba(255, 255, 255, 0.1);
}

.stm-public-wrap .stm-spot__label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: rgba(255, 255, 255, 0.75);
}

.stm-public-wrap .stm-spot--booked .stm-spot__player {
	font-size: 1.05rem;
	font-weight: 700;
	color: #ffffff;
}

/* Book button: white on the green court surface for legibility */
.stm-public-wrap .stm-court .stm-btn--book {
	background-color: rgba(255, 255, 255, 0.9);
	color: #1e5631;
	font-size: 0.8rem;
	font-weight: 700;
	padding: 0.4rem 0.9rem;
}

.stm-public-wrap .stm-court .stm-btn--book:hover {
	background-color: #ffffff;
	color: #155227;
}

/* ==========================================================================
   Task 06 — Booking Modal
   ========================================================================== */

.stm-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stm-modal[hidden] {
	display: none;
}

.stm-modal__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.55);
}

.stm-modal__box {
	position: relative;
	z-index: 1;
	background-color: #ffffff;
	border-radius: 6px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
	max-width: 440px;
	width: calc(100% - 2rem);
	padding: 1.75rem 2rem;
	max-height: calc(100vh - 4rem);
	overflow-y: auto;
}

.stm-modal__close {
	position: absolute;
	top: 0.75rem;
	right: 0.875rem;
	background: none;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: #555555;
	padding: 0.25rem;
}

.stm-modal__close:hover {
	color: #111111;
}

.stm-modal__close:focus {
	outline: 3px solid #2e86c1;
	outline-offset: 2px;
}

.stm-modal__title {
	margin: 0 0 0.25rem;
	font-size: 1.3rem;
	padding-right: 2rem; /* clear the × button */
}

.stm-modal__spot-info {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	color: #555555;
}

.stm-modal__message {
	margin-bottom: 1rem;
}

/* ==========================================================================
   Task 06 — Shared Form Styles (modal + cancel section)
   ========================================================================== */

.stm-form__field {
	margin-bottom: 1rem;
}

.stm-form__label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 600;
	font-size: 0.9rem;
}

.stm-form__input {
	width: 100%;
	padding: 0.5rem 0.75rem;
	border: 1px solid #b0b8c1;
	border-radius: 4px;
	font-size: 1rem;
	line-height: 1.4;
	transition: border-color 0.15s ease;
	box-sizing: border-box;
}

.stm-form__input:focus {
	border-color: #2e86c1;
	outline: 3px solid rgba(46, 134, 193, 0.35);
}

.stm-form__input--code {
	font-size: 1.5rem;
	letter-spacing: 0.5rem;
	text-align: center;
	font-family: 'Courier New', Courier, monospace;
	max-width: 220px;
}

.stm-form__fieldset {
	border: none;
	margin: 0;
	padding: 0;
}

.stm-form__radio-label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-right: 1.25rem;
	font-size: 0.95rem;
	cursor: pointer;
}

.stm-form__radio {
	cursor: pointer;
}

.stm-form__actions {
	margin-top: 1.25rem;
}

/* ==========================================================================
   Task 06 — Secondary / Danger button variants
   ========================================================================== */

.stm-public-wrap .stm-btn--secondary,
.stm-btn--secondary {
	background-color: #7f8c8d;
	color: #ffffff;
	display: inline-block;
	padding: 0.5rem 1.25rem;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.stm-public-wrap .stm-btn--secondary:hover,
.stm-btn--secondary:hover {
	background-color: #636e72;
}

.stm-public-wrap .stm-btn--danger,
.stm-btn--danger {
	background-color: #c0392b;
	color: #ffffff; /* contrast ratio ≈ 5.4:1 */
	display: inline-block;
	padding: 0.5rem 1.25rem;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.stm-public-wrap .stm-btn--danger:hover,
.stm-btn--danger:hover {
	background-color: #962d22;
}

.stm-btn--secondary:focus,
.stm-btn--danger:focus,
.stm-public-wrap .stm-btn--secondary:focus,
.stm-public-wrap .stm-btn--danger:focus {
	outline: 3px solid #2e86c1;
	outline-offset: 2px;
}

/* ==========================================================================
   Task 06 — Cancel Section
   ========================================================================== */

.stm-cancel-section {
	margin-top: 2rem;
	padding: 1.5rem;
	border: 1px solid #dde3e9;
	border-radius: 6px;
	background-color: #fafbfc;
}

.stm-cancel-section__title {
	margin: 0 0 1rem;
	font-size: 1.1rem;
}

.stm-cancel-section__message {
	margin-bottom: 1rem;
}

/* ==========================================================================
   Event List — Cohort Tags
   ========================================================================== */

.stm-public-wrap .stm-event-card__cohorts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.5rem;
}

.stm-public-wrap .stm-cohort-tag {
	display: inline-block;
	padding: 0.18rem 0.6rem;
	border-radius: 20px;
	background-color: #2e86c1;
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	line-height: 1.4;
}

/* ==========================================================================
   Event List — Gender Availability Pills
   ========================================================================== */

.stm-public-wrap .stm-event-card__spots {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0 0 0.35rem;
	padding: 0;
}

.stm-public-wrap .stm-gender-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.28rem 0.65rem;
	border-radius: 20px;
	font-size: 0.82rem;
	font-weight: 600;
	line-height: 1.3;
	border: 2px solid transparent;
}

.stm-public-wrap .stm-gender-pill--male {
	background-color: rgba(59, 130, 246, 0.12);
	color: #1a4fa0;
	border-color: rgba(59, 130, 246, 0.35);
}

.stm-public-wrap .stm-gender-pill--female {
	background-color: rgba(247, 109, 176, 0.12);
	color: #a0245a;
	border-color: rgba(247, 109, 176, 0.4);
}

.stm-public-wrap .stm-gender-pill--full {
	opacity: 0.55;
	text-decoration: line-through;
}

.stm-public-wrap .stm-gender-pill__icon {
	font-size: 1rem;
	line-height: 1;
}

.stm-public-wrap .stm-gender-pill__label {
	/* screen-reader visible; visually hidden on narrow screens if needed */
}

.stm-public-wrap .stm-gender-pill__count {
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Event List — Cohort Manager (join another group)
   ========================================================================== */

.stm-public-wrap .stm-cohort-manager {
	margin-top: 2rem;
	padding: 1.5rem;
	border: 1px solid #dde3e9;
	border-radius: 6px;
	background-color: #fafbfc;
}

.stm-public-wrap .stm-cohort-manager__title {
	margin: 0 0 0.4rem;
	font-size: 1.1rem;
}

.stm-public-wrap .stm-cohort-manager__intro {
	margin: 0 0 1rem;
	color: #555;
	font-size: 0.95rem;
}

.stm-public-wrap .stm-cohort-manager__error {
	padding: 0.6rem 0.9rem;
	background-color: #fdf2f2;
	border-left: 4px solid #c0392b;
	color: #7b241c;
	border-radius: 3px;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.stm-public-wrap .stm-cohort-manager__forms {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* ==========================================================================
   Event List — Individual Cohort Join Form
   ========================================================================== */

.stm-public-wrap .stm-cohort-join-form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border: 1px solid #dde3e9;
	border-radius: 5px;
	background-color: #ffffff;
}

.stm-public-wrap .stm-cohort-join-form__name {
	flex: 1 1 120px;
	font-weight: 600;
	font-size: 0.9rem;
	color: #222;
}

.stm-public-wrap .stm-cohort-join-form__input {
	flex: 2 1 160px;
	padding: 0.45rem 0.7rem;
	border: 1px solid #b0b8c1;
	border-radius: 4px;
	font-size: 0.92rem;
	line-height: 1.4;
	transition: border-color 0.15s ease;
}

.stm-public-wrap .stm-cohort-join-form__input:focus {
	border-color: #2e86c1;
	outline: 3px solid rgba(46, 134, 193, 0.35);
}

.stm-public-wrap .stm-cohort-join-form__btn {
	flex-shrink: 0;
	padding: 0.45rem 1rem;
	font-size: 0.88rem;
}
