/* =========================================================
   Rescu Training Schedule — Frontend Styles
   ========================================================= */

:root {
	--rescu-color: #B40000;
	--rescu-color-dark: #8a0000;
	--rescu-color-light: #fdf0f0;
	--rescu-text: #1a1a1a;
	--rescu-text-muted: #666666;
	--rescu-border: #e5e5e5;
	--rescu-radius: 8px;
	--rescu-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	--rescu-shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.16);
	--rescu-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================================
   Shared Buttons — hard reset prevents theme overrides
   ========================================================= */
.rescu-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	padding: 9px 18px !important;
	border-radius: 6px !important;
	font-family: var(--rescu-font) !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	letter-spacing: 0.01em !important;
	text-decoration: none !important;
	cursor: pointer !important;
	border: 2px solid transparent !important;
	box-sizing: border-box !important;
	white-space: nowrap !important;
	width: auto !important;
	max-width: 100% !important;
	transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s !important;
	background-image: none !important;
	box-shadow: none !important;
	outline: none !important;
	vertical-align: middle !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	text-transform: none !important;
}

.rescu-btn-primary {
	background: var(--rescu-color) !important;
	color: #fff !important;
	border-color: var(--rescu-color) !important;
}

.rescu-btn-primary:hover,
.rescu-btn-primary:focus {
	background: var(--rescu-color-dark) !important;
	border-color: var(--rescu-color-dark) !important;
	color: #fff !important;
	box-shadow: 0 2px 8px rgba(180,0,0,0.3) !important;
}

.rescu-btn-secondary {
	background: transparent !important;
	color: var(--rescu-color) !important;
	border-color: var(--rescu-color) !important;
}

.rescu-btn-secondary:hover,
.rescu-btn-secondary:focus {
	background: var(--rescu-color-light) !important;
	color: var(--rescu-color-dark) !important;
	border-color: var(--rescu-color-dark) !important;
}

.rescu-btn-ghost {
	background: transparent !important;
	color: var(--rescu-text-muted) !important;
	border-color: var(--rescu-border) !important;
}

.rescu-btn-ghost:hover {
	background: #f5f5f5 !important;
	color: var(--rescu-text) !important;
}

.rescu-btn-large {
	padding: 12px 28px !important;
	font-size: 15px !important;
}

.rescu-btn-sm {
	padding: 6px 12px !important;
	font-size: 12px !important;
}

/* =========================================================
   Status Badges
   ========================================================= */
.rescu-status-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-family: var(--rescu-font);
}

.rescu-status-available  { background: #d4edda; color: #155724; }
.rescu-status-last_seats { background: #fff3cd; color: #856404; }
.rescu-status-full       { background: #f8d7da; color: #721c24; }
.rescu-status-finished   { background: #e9ecef; color: #495057; }
.rescu-status-hidden     { background: #e9ecef; color: #868e96; }

/* =========================================================
   Training List Grid
   ========================================================= */
.rescu-training-list {
	display: grid;
	gap: 20px;
	font-family: var(--rescu-font);
}

.rescu-layout-cards {
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

@media (max-width: 640px) {
	.rescu-layout-cards {
		grid-template-columns: 1fr;
	}
}

.rescu-layout-list .rescu-training-card,
.rescu-layout-compact .rescu-training-card {
	display: flex;
	flex-direction: column;
}

/* =========================================================
   Training Card
   ========================================================= */
.rescu-training-card {
	background: #fff;
	border: 1px solid var(--rescu-border);
	border-top: 4px solid var(--rescu-color);
	border-radius: var(--rescu-radius);
	box-shadow: var(--rescu-shadow);
	display: flex;
	flex-direction: column;
	font-family: var(--rescu-font);
	color: var(--rescu-text);
	overflow: hidden;
	transition: box-shadow 0.2s, transform 0.2s;
}

.rescu-training-card:hover {
	box-shadow: var(--rescu-shadow-lg);
	transform: translateY(-2px);
}

/* --- Card header --- */
.rescu-card-header {
	padding: 18px 20px 10px;
}

.rescu-card-title {
	margin: 0 0 5px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	font-family: var(--rescu-font);
}

.rescu-card-title a {
	color: var(--rescu-color) !important;
	text-decoration: none !important;
}

.rescu-card-title a:hover {
	color: var(--rescu-color-dark) !important;
	text-decoration: underline !important;
}

.rescu-card-city {
	font-size: 11px;
	color: var(--rescu-text-muted);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

/* --- Card body --- */
.rescu-card-body {
	padding: 4px 20px 10px;
	flex: 1;
}

.rescu-card-dates {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 600;
	margin: 8px 0;
	color: var(--rescu-text);
}

.rescu-card-dates .dashicons {
	color: var(--rescu-color);
	font-size: 18px;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.rescu-card-sessions {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.7;
	color: var(--rescu-text-muted);
}

.rescu-card-session-item {
	display: flex;
	gap: 4px;
}

.rescu-card-session-item strong {
	color: var(--rescu-text);
	font-weight: 600;
}

.rescu-card-status {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
	flex-wrap: wrap;
}

.rescu-card-seats {
	font-size: 12px;
	color: var(--rescu-text-muted);
}

.rescu-card-desc {
	font-size: 13px;
	color: var(--rescu-text-muted);
	line-height: 1.5;
	margin-bottom: 6px;
}

/* --- Card footer --- */
.rescu-card-footer {
	padding: 12px 20px 16px;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
	border-top: 1px solid var(--rescu-border);
	background: #fafafa;
}

/* --- Expandable schedule --- */
.rescu-card-schedule-expand {
	padding: 16px 20px;
	background: var(--rescu-color-light);
	border-top: 1px solid rgba(180,0,0,0.12);
	font-size: 13px;
	font-family: var(--rescu-font);
}

.rescu-card-schedule-expand[hidden] {
	display: none;
}

.rescu-schedule-group {
	margin-bottom: 14px;
}

.rescu-schedule-group:last-child {
	margin-bottom: 0;
}

.rescu-schedule-type {
	font-size: 11px;
	font-weight: 700;
	color: var(--rescu-color);
	margin: 0 0 6px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-family: var(--rescu-font);
}

.rescu-schedule-item {
	display: grid;
	grid-template-columns: 100px 1fr;
	gap: 8px;
	align-items: baseline;
	padding: 3px 0;
	border-bottom: 1px solid rgba(0,0,0,0.05);
}

.rescu-schedule-item:last-child {
	border-bottom: none;
}

.rescu-schedule-date {
	font-weight: 600;
	font-size: 13px;
}

.rescu-schedule-time {
	color: var(--rescu-text-muted);
	font-size: 13px;
}

.rescu-schedule-note {
	font-size: 12.5px;
	color: var(--rescu-text);
	line-height: 1.45;
	grid-column: 2;
}

.rescu-details-link {
	display: inline-block;
	margin-top: 12px;
	font-size: 13px;
	color: var(--rescu-color);
	font-weight: 600;
	text-decoration: none;
	font-family: var(--rescu-font);
}

.rescu-details-link:hover {
	text-decoration: underline;
	color: var(--rescu-color-dark);
}

/* =========================================================
   Training Details Page
   ========================================================= */
.rescu-training-details {
	font-family: var(--rescu-font);
	color: var(--rescu-text);
	max-width: 740px;
}

.rescu-details-title {
	font-size: 26px;
	font-weight: 800;
	margin: 0 0 20px;
	color: var(--rescu-text);
	border-bottom: 3px solid var(--rescu-color);
	padding-bottom: 12px;
	line-height: 1.3;
}

.rescu-details-meta {
	background: var(--rescu-color-light);
	border-radius: var(--rescu-radius);
	border-left: 4px solid var(--rescu-color);
	padding: 16px 20px;
	margin-bottom: 28px;
}

.rescu-details-row {
	display: flex;
	gap: 12px;
	align-items: baseline;
	padding: 7px 0;
	border-bottom: 1px solid rgba(0,0,0,0.06);
	font-size: 15px;
}

.rescu-details-row:last-child {
	border-bottom: none;
}

.rescu-details-label {
	font-weight: 700;
	min-width: 110px;
	color: var(--rescu-text-muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	flex-shrink: 0;
}

.rescu-details-value {
	font-size: 15px;
	font-weight: 600;
}

.rescu-details-seats {
	font-size: 13px;
	color: var(--rescu-text-muted);
	margin-left: 8px;
	font-weight: 400;
}

.rescu-details-desc {
	flex-direction: column;
	gap: 4px;
}

.rescu-details-schedule {
	margin-bottom: 28px;
}

.rescu-details-schedule-title {
	font-size: 19px;
	font-weight: 700;
	margin: 0 0 16px;
	color: var(--rescu-text);
}

.rescu-details-group {
	margin-bottom: 24px;
}

.rescu-details-group-title {
	font-size: 13px;
	font-weight: 700;
	color: var(--rescu-color);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin: 0 0 10px;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--rescu-color);
}

.rescu-details-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rescu-details-item {
	display: grid;
	grid-template-columns: 110px 130px 1fr;
	gap: 12px;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid var(--rescu-border);
	font-size: 14px;
}

.rescu-details-item:last-child {
	border-bottom: none;
}

.rescu-details-item-date {
	font-weight: 700;
}

.rescu-details-item-time {
	color: var(--rescu-text-muted);
}

.rescu-details-item-note {
	font-size: 13.5px;
	color: var(--rescu-text);
	line-height: 1.45;
}

.rescu-details-cta {
	margin-top: 28px;
	padding-top: 20px;
	border-top: 2px solid var(--rescu-border);
}

.rescu-training-empty {
	color: var(--rescu-text-muted);
	font-style: italic;
	font-family: var(--rescu-font);
}

/* =========================================================
   Floating Widget
   ========================================================= */
.rescu-training-widget {
	position: fixed;
	z-index: 9900;
	font-family: var(--rescu-font);
}

/* --- Desktop: right / left side tab --- */
@media (min-width: 769px) {
	.rescu-training-widget.rescu-widget-pos-right {
		right: 0;
		top: 50%;
		transform: translateY(-50%);
		display: flex;
		flex-direction: row;
		align-items: flex-start;
	}

	.rescu-training-widget.rescu-widget-pos-left {
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		display: flex;
		flex-direction: row-reverse;
		align-items: flex-start;
	}

	.rescu-widget-tab {
		/* Column layout — ikona i tekst ułożone pionowo, bez obracania całego elementu */
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 10px !important;
		width: 46px !important;
		padding: 20px 0 !important;
		background: var(--rescu-color) !important;
		color: #fff !important;
		border: none !important;
		cursor: pointer !important;
		border-radius: 10px 0 0 10px !important;
		box-shadow: -4px 0 16px rgba(180,0,0,0.35) !important;
		transition: background 0.2s, box-shadow 0.2s, width 0.2s !important;
		background-image: none !important;
		appearance: none !important;
		-webkit-appearance: none !important;
		outline: none !important;
		position: relative !important;
		writing-mode: horizontal-tb !important;
		overflow: visible !important;
	}

	.rescu-widget-pos-left .rescu-widget-tab {
		border-radius: 0 10px 10px 0 !important;
		box-shadow: 4px 0 16px rgba(180,0,0,0.35) !important;
	}

	.rescu-widget-tab:hover {
		background: var(--rescu-color-dark) !important;
		width: 50px !important;
		box-shadow: -6px 0 20px rgba(180,0,0,0.5) !important;
	}

	/* Ikona kalendarza — normalna orientacja */
	.rescu-widget-tab-icon-wrap {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		opacity: 0.9;
	}

	.rescu-widget-tab-icon-wrap svg {
		width: 20px;
		height: 20px;
		stroke: #fff;
	}

	/* Tekst obrócony pionowo */
	.rescu-widget-tab-text {
		writing-mode: vertical-rl;
		transform: rotate(180deg);
		font-family: var(--rescu-font);
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: #fff;
		line-height: 1;
		white-space: nowrap;
	}

	/* Badge z liczbą kursów — lewa strona zakładki */
	.rescu-widget-tab-badge {
		position: absolute;
		top: -6px;
		left: -6px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #fff;
		color: var(--rescu-color);
		font-size: 10px;
		font-weight: 800;
		min-width: 18px;
		height: 18px;
		border-radius: 9px;
		padding: 0 4px;
		box-shadow: 0 1px 4px rgba(0,0,0,0.2);
		line-height: 1;
	}

	/* Strzałka stanu — biała, większa */
	.rescu-widget-tab-arrow {
		font-size: 16px;
		opacity: 1;
		color: #fff;
		transition: transform 0.3s;
	}

	.rescu-training-widget[data-open="true"] .rescu-widget-tab-arrow {
		transform: rotate(180deg);
	}

	.rescu-widget-panel {
		width: 300px;
		max-height: 80vh;
		background: #fff;
		box-shadow: var(--rescu-shadow-lg);
		border-radius: 10px 0 0 10px;
		overflow-y: auto;
		display: none;
	}

	.rescu-widget-pos-left .rescu-widget-panel {
		border-radius: 0 10px 10px 0;
	}

	.rescu-training-widget[data-open="true"] .rescu-widget-panel {
		display: block;
	}

	/* Subtelny puls gdy zwinięty */
	@keyframes rescu-pulse {
		0%   { box-shadow: -4px 0 16px rgba(180,0,0,0.35); }
		50%  { box-shadow: -6px 0 24px rgba(180,0,0,0.55); }
		100% { box-shadow: -4px 0 16px rgba(180,0,0,0.35); }
	}

	.rescu-training-widget:not([data-open="true"]) .rescu-widget-tab {
		animation: rescu-pulse 2.5s ease-in-out infinite;
	}

	.rescu-training-widget:not([data-open="true"]) .rescu-widget-tab:hover {
		animation: none;
	}
}

/* --- Mobile: bottom bar --- */
@media (max-width: 768px) {
	.rescu-training-widget {
		bottom: 0;
		left: 0;
		right: 0;
		top: auto;
		transform: none;
	}

	.rescu-widget-tab {
		width: 100% !important;
		writing-mode: horizontal-tb !important;
		text-orientation: mixed !important;
		transform: none !important;
		background: var(--rescu-color) !important;
		color: #fff !important;
		border: none !important;
		padding: 13px 20px !important;
		font-family: var(--rescu-font) !important;
		font-size: 14px !important;
		font-weight: 700 !important;
		letter-spacing: 0.04em !important;
		cursor: pointer !important;
		display: flex !important;
		align-items: center !important;
		justify-content: space-between !important;
		box-shadow: 0 -3px 10px rgba(0,0,0,0.18) !important;
		appearance: none !important;
		-webkit-appearance: none !important;
		border-radius: 0 !important;
		text-transform: uppercase !important;
		outline: none !important;
		background-image: none !important;
	}

	.rescu-widget-tab-icon {
		transition: transform 0.3s;
		display: inline-block;
	}

	.rescu-training-widget[data-open="true"] .rescu-widget-tab-icon {
		transform: rotate(-90deg);
	}

	.rescu-widget-panel {
		background: #fff;
		max-height: 60vh;
		overflow-y: auto;
		display: none;
		border-top: 3px solid var(--rescu-color);
		box-shadow: 0 -6px 24px rgba(0,0,0,0.2);
	}

	.rescu-training-widget[data-open="true"] .rescu-widget-panel {
		display: block;
	}
}

/* --- Widget panel content --- */
.rescu-widget-panel-inner {
	padding: 16px;
}

.rescu-widget-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--rescu-color);
}

.rescu-widget-header h3 {
	margin: 0 !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	color: var(--rescu-text) !important;
	font-family: var(--rescu-font) !important;
}

.rescu-widget-close {
	background: none !important;
	border: none !important;
	box-shadow: none !important;
	font-size: 20px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	color: var(--rescu-text-muted) !important;
	padding: 2px 4px !important;
	border-radius: 4px !important;
	transition: color 0.15s, background 0.15s !important;
	width: auto !important;
	background-image: none !important;
}

.rescu-widget-close:hover {
	color: var(--rescu-color) !important;
	background: var(--rescu-color-light) !important;
}

.rescu-widget-course {
	padding: 12px 0;
	border-bottom: 1px solid var(--rescu-border);
}

.rescu-widget-course:last-child {
	border-bottom: none;
}

.rescu-widget-course-city {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--rescu-text-muted);
	margin-bottom: 2px;
}

.rescu-widget-course-dates {
	font-size: 15px;
	font-weight: 700;
	color: var(--rescu-text);
	margin-bottom: 3px;
}

.rescu-widget-course-exam {
	font-size: 12px;
	color: var(--rescu-text-muted);
	margin-bottom: 4px;
}

.rescu-widget-course-status {
	margin-bottom: 8px;
}

.rescu-widget-course-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.rescu-widget-course-actions .rescu-btn {
	font-size: 12px !important;
	padding: 6px 12px !important;
}

.rescu-widget-footer {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--rescu-border);
	text-align: center;
}

.rescu-widget-all-link {
	color: var(--rescu-color);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.rescu-widget-all-link:hover {
	text-decoration: underline;
	color: var(--rescu-color-dark);
}

.rescu-widget-empty {
	color: var(--rescu-text-muted);
	font-size: 14px;
	padding: 6px 0;
}

/* Overlay for mobile */
.rescu-widget-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.35);
	z-index: 9899;
}

@media (max-width: 768px) {
	.rescu-widget-overlay.rescu-overlay-active {
		display: block;
	}
}
