/**
 * Sport Rail Front-end Styles
 *
 * @package Tobalt\SportRail
 * Author: Tobalt — https://tobalt.lt
 */

/* CSS Custom Properties (defaults) */
:root {
	--tobalt-rail-circle-bg: #ffffff;
	--tobalt-rail-circle-border: #e0e0e0;
	--tobalt-rail-icon-color: #333333;
	--tobalt-rail-badge-bg: #ff4444;
	--tobalt-rail-badge-text: #ffffff;
	--tobalt-rail-circle-size: 50px;
	--tobalt-rail-breakpoint: 768px;
}

/* ==========================================================================
   Desktop Rail
   ========================================================================== */

.tobalt-rail {
	position: fixed;
	z-index: 9999;
	top: 50%;
	transform: translateY(-50%);
	padding: 12px 10px;
	background: rgba(255, 255, 255, 0.75);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-radius: 9999px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.tobalt-rail--left {
	left: 12px;
}

.tobalt-rail--right {
	right: 12px;
}

.tobalt-rail--align-top {
	top: 30%;
}

.tobalt-rail--align-center {
	top: 50%;
}

.tobalt-rail--align-bottom {
	top: 70%;
}

.tobalt-rail__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tobalt-rail__item {
	position: relative;
	margin: 0;
	padding: 0;
}

.tobalt-rail__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.5);
	text-decoration: none;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
	            background 0.2s ease,
	            box-shadow 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
	position: relative;
}

.tobalt-rail__link:hover {
	transform: scale(1.15);
	background: rgba(255, 255, 255, 0.85);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
	animation: tobalt-bounce 0.4s ease;
}

.tobalt-rail__link:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5), 0 6px 20px rgba(0, 0, 0, 0.15);
}

@keyframes tobalt-bounce {
	0%, 100% { transform: scale(1.15); }
	50% { transform: scale(1.2); }
}

.tobalt-rail__icon {
	color: var(--tobalt-rail-icon-color);
	font-size: 18px;
	line-height: 1;
}

.tobalt-rail__icon--svg {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

/* Badge */
.tobalt-rail__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background-color: var(--tobalt-rail-badge-bg);
	color: var(--tobalt-rail-badge-text);
	font-size: 10px;
	font-weight: 700;
	padding: 2px 5px;
	border-radius: 10px;
	line-height: 1.2;
	white-space: nowrap;
}

/* Tooltip */
.tobalt-rail__tooltip {
	position: absolute;
	z-index: 10000;
	background: #333;
	color: #fff;
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.4;
	max-width: 220px;
	opacity: 0;
	visibility: hidden;
	transform: translateX(10px);
	transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
	pointer-events: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Position tooltip based on rail position */
.tobalt-rail--left .tobalt-rail__tooltip {
	left: calc(100% + 15px);
	top: 50%;
	transform: translateY(-50%) translateX(10px);
}

.tobalt-rail--right .tobalt-rail__tooltip {
	right: calc(100% + 15px);
	left: auto;
	top: 50%;
	transform: translateY(-50%) translateX(-10px);
}

/* Tooltip arrow */
.tobalt-rail__tooltip::before {
	content: '';
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	border: 6px solid transparent;
}

.tobalt-rail--left .tobalt-rail__tooltip::before {
	left: -12px;
	border-right-color: #333;
}

.tobalt-rail--right .tobalt-rail__tooltip::before {
	right: -12px;
	border-left-color: #333;
}

/* Show tooltip */
.tobalt-rail__item:hover .tobalt-rail__tooltip,
.tobalt-rail__link:focus + .tobalt-rail__tooltip,
.tobalt-rail__tooltip--visible {
	opacity: 1;
	visibility: visible;
}

.tobalt-rail--left .tobalt-rail__item:hover .tobalt-rail__tooltip,
.tobalt-rail--left .tobalt-rail__link:focus + .tobalt-rail__tooltip,
.tobalt-rail--left .tobalt-rail__tooltip--visible {
	transform: translateY(-50%) translateX(0);
}

.tobalt-rail--right .tobalt-rail__item:hover .tobalt-rail__tooltip,
.tobalt-rail--right .tobalt-rail__link:focus + .tobalt-rail__tooltip,
.tobalt-rail--right .tobalt-rail__tooltip--visible {
	transform: translateY(-50%) translateX(0);
}

.tobalt-rail__tooltip-title {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.tobalt-rail__tooltip-desc {
	display: block;
	opacity: 0.85;
	font-size: 12px;
}

/* With labels mode */
.tobalt-rail--with-labels .tobalt-rail__link {
	width: auto;
	border-radius: 25px;
	padding: 0 16px 0 8px;
	gap: 8px;
}

.tobalt-rail__label {
	font-size: 13px;
	font-weight: 500;
	color: var(--tobalt-rail-icon-color);
	white-space: nowrap;
}

/* ==========================================================================
   Mobile Toggle Button
   ========================================================================== */

.tobalt-rail-mobile-toggle {
	display: none;
	position: fixed;
	z-index: 9998;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background-color: var(--tobalt-rail-circle-bg);
	border: 2px solid var(--tobalt-rail-circle-border);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tobalt-rail-mobile-toggle:hover,
.tobalt-rail-mobile-toggle:focus {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
	outline: none;
}

.tobalt-rail-mobile-toggle:focus {
	outline: 3px solid rgba(0, 100, 200, 0.5);
	outline-offset: 2px;
}

.tobalt-rail-mobile-toggle .dashicons {
	font-size: 24px;
	color: var(--tobalt-rail-icon-color);
}

.tobalt-rail-mobile-toggle--bottom-left {
	bottom: 20px;
	left: 20px;
}

.tobalt-rail-mobile-toggle--bottom-right {
	bottom: 20px;
	right: 20px;
}

.tobalt-rail-mobile-toggle[aria-expanded="true"] .dashicons::before {
	content: '\f158'; /* dashicons-no */
}

/* ==========================================================================
   Mobile Panel - Slide Out
   ========================================================================== */

.tobalt-rail-mobile-panel {
	display: none;
	position: fixed;
	z-index: 10001;
	background: #fff;
	box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.tobalt-rail-mobile-panel--slide-out {
	top: 0;
	left: 0;
	width: 280px;
	max-width: 85vw;
	height: 100vh;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
}

.tobalt-rail-mobile-panel--slide-out[aria-hidden="false"] {
	transform: translateX(0);
}

/* ==========================================================================
   Mobile Panel - Bottom Sheet
   ========================================================================== */

.tobalt-rail-mobile-panel--bottom-sheet {
	bottom: 0;
	left: 0;
	right: 0;
	max-height: 70vh;
	border-radius: 20px 20px 0 0;
	transform: translateY(100%);
	transition: transform 0.3s ease;
}

.tobalt-rail-mobile-panel--bottom-sheet[aria-hidden="false"] {
	transform: translateY(0);
}

/* Panel Header */
.tobalt-rail-mobile-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
	font-weight: 600;
	font-size: 16px;
}

.tobalt-rail-mobile-panel__close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	margin: -8px;
	border-radius: 50%;
	transition: background-color 0.2s ease;
}

.tobalt-rail-mobile-panel__close:hover,
.tobalt-rail-mobile-panel__close:focus {
	background-color: #f0f0f0;
	outline: none;
}

.tobalt-rail-mobile-panel__close .dashicons {
	font-size: 20px;
	color: #666;
}

/* Panel List */
.tobalt-rail-mobile-panel__list {
	list-style: none;
	margin: 0;
	padding: 10px 0;
	overflow-y: auto;
	max-height: calc(100vh - 60px);
}

.tobalt-rail-mobile-panel--bottom-sheet .tobalt-rail-mobile-panel__list {
	max-height: calc(70vh - 60px);
}

.tobalt-rail-mobile-panel__item {
	margin: 0;
	padding: 0;
}

.tobalt-rail-mobile-panel__link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 20px;
	text-decoration: none;
	color: #333;
	transition: background-color 0.2s ease;
}

.tobalt-rail-mobile-panel__link:hover,
.tobalt-rail-mobile-panel__link:focus {
	background-color: #f5f5f5;
	outline: none;
}

.tobalt-rail-mobile-panel__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: var(--tobalt-rail-circle-bg);
	border: 2px solid var(--tobalt-rail-circle-border);
	flex-shrink: 0;
}

.tobalt-rail-mobile-panel__icon .dashicons,
.tobalt-rail-mobile-panel__icon .tobalt-rail__icon {
	font-size: 18px;
	color: var(--tobalt-rail-icon-color);
}

.tobalt-rail-mobile-panel__name {
	flex: 1;
	font-size: 15px;
	font-weight: 500;
}

/* Mobile Overlay */
.tobalt-rail-mobile-overlay {
	display: none;
	position: fixed;
	z-index: 10000;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.tobalt-rail-mobile-overlay[aria-hidden="false"] {
	opacity: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.tobalt-rail {
		display: none;
	}

	.tobalt-rail-mobile-toggle,
	.tobalt-rail-mobile-panel,
	.tobalt-rail-mobile-overlay {
		display: flex;
	}

	.tobalt-rail-mobile-panel {
		display: block;
	}
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
	.tobalt-rail,
	.tobalt-rail-mobile-toggle,
	.tobalt-rail-mobile-panel,
	.tobalt-rail-mobile-overlay {
		display: none !important;
	}
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.tobalt-rail__link,
	.tobalt-rail__tooltip,
	.tobalt-rail-mobile-toggle,
	.tobalt-rail-mobile-panel,
	.tobalt-rail-mobile-overlay {
		transition: none;
	}
}
