/**
 * Ship Telemetry Panel – Front-end styles (V7)
 * Pixel-perfect reference design with responsive percentage-based holds.
 * V7: Glass panel tonaj kutusu, Sefer Bilgisi bölümü, tıklanabilir gemi adı.
 */

/* ------------------------------------------------------------------ */
/* Reset & base                                                         */
/* ------------------------------------------------------------------ */
.stw-widget *,
.stw-widget *::before,
.stw-widget *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.stw-widget {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: #0f172a;
	background: transparent;
	width: 100%;
	max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* Outer header                                                         */
/* ------------------------------------------------------------------ */
.stw-outer-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 24px;
	margin-bottom: 24px;
}

.stw-outer-header__left {
	flex: 1 1 auto;
	min-width: 0;
}

.stw-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1.5px solid #3b82f6;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 11px;
	font-weight: 600;
	color: #3b82f6;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	margin-bottom: 16px;
}

.stw-widget-title {
	font-size: clamp( 24px, 4vw, 48px );
	line-height: 1.15;
	margin-bottom: 12px;
}

.stw-widget-title__line1 {
	font-weight: 800;
	color: #0f172a;
}

.stw-widget-title__line2 {
	font-weight: 800;
	color: #0d9488;
}

.stw-widget-desc {
	font-size: 14px;
	line-height: 1.6;
	color: #64748b;
	max-width: 480px;
}

.stw-outer-header__right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	flex: 0 0 auto;
	padding-top: 70px;
}

.stw-other-title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #3b82f6;
}

.stw-other-nav {
	display: flex;
	gap: 8px;
}

.stw-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	color: #0f172a;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.stw-arrow:hover {
	background: #f8fafc;
	border-color: #cbd5e1;
}

.stw-arrow:active {
	background: #f1f5f9;
}

.stw-other-counter {
	display: flex;
	align-items: baseline;
	gap: 4px;
	font-size: 13px;
	font-weight: 700;
	color: #64748b;
}

.stw-other-counter__current {
	font-size: 15px;
	font-weight: 800;
	color: #0f172a;
}

.stw-other-counter__sep {
	color: #cbd5e1;
}

/* ------------------------------------------------------------------ */
/* Main card panel                                                      */
/* ------------------------------------------------------------------ */
.stw-panel {
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 16px;
	box-shadow: 0 2px 16px 0 rgba(15, 23, 42, 0.07);
	overflow: hidden;
	margin-bottom: 20px;
}

.stw-panel__topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 24px;
	border-bottom: 1.5px solid #f1f5f9;
	flex-wrap: wrap;
}

.stw-panel__topbar-left {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.stw-panel__topbar-icon {
	color: #3b82f6;
	flex-shrink: 0;
}

.stw-panel__profile-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	color: #64748b;
}

.stw-panel__dot-sep {
	color: #94a3b8;
	font-size: 12px;
}

/* ---- Ship callsign — V7: tıklanabilir link ---- */
.stw-panel__ship-callsign {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.5px;
	color: #0f172a;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	text-decoration: none;
	transition: color 0.2s ease;
}

.stw-panel__ship-callsign--link {
	cursor: pointer;
}

.stw-panel__ship-callsign--link:hover {
	color: #2563eb;
	text-decoration: underline;
}

.stw-panel__ship-callsign-icon {
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.stw-panel__ship-callsign--link:hover .stw-panel__ship-callsign-icon {
	opacity: 1;
	transform: translateX(0);
}

.stw-panel__topbar-specs {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	flex-wrap: wrap;
}

.stw-spec {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 12px;
}

.stw-spec__icon {
	color: #64748b;
	display: flex;
	align-items: center;
}

.stw-spec__label {
	font-size: 11px;
	font-weight: 500;
	color: #94a3b8;
	letter-spacing: 0.3px;
}

.stw-spec__value {
	font-size: 13px;
	font-weight: 700;
	color: #0f172a;
}

.stw-panel__updated {
	flex: 0 0 auto;
	margin-left: auto;
	text-align: right;
}

.stw-panel__updated-header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	margin-bottom: 2px;
}

.stw-label--update {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	color: #94a3b8;
}

.stw-panel__online-dot {
	width: 8px;
	height: 8px;
	background: #22c55e;
	border-radius: 50%;
	flex-shrink: 0;
}

.stw-panel__updated-date {
	font-size: 20px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.2;
}

.stw-panel__updated-tz {
	font-size: 11px;
	color: #94a3b8;
	margin-top: 2px;
}

/* ------------------------------------------------------------------ */
/* Ship image stage                                                     */
/* ------------------------------------------------------------------ */
.stw-stage {
	position: relative;
	width: 100%;
	overflow: hidden;
	aspect-ratio: 16 / 7;
	min-height: 220px;
	background: #f8fafc;
}

.stw-stage__image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease;
}

.stw-stage__image.is-active {
	opacity: 1;
	visibility: visible;
	position: relative;
}

.stw-stage__image img {
	max-width: 100%;
	height: 100%;
	width: 100%;
	object-fit: contain;
	display: block;
	transform-origin: center center;
}

.stw-stage__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 220px;
	background: #f8fafc;
	color: #94a3b8;
	font-size: 14px;
	font-weight: 600;
}

/* ---- Hold overlays (percentage positioned, responsive) ---- */
.stw-stage__holds {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.stw-hold-overlay {
	position: absolute;
	border-radius: 6px;
	box-sizing: border-box;
	overflow: hidden;
	border: 1.5px solid rgba(255,255,255,0.55);
	background: rgba(10,20,40,0.12);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,0.30),
		inset 0 -1px 0 rgba(0,0,0,0.18),
		0 4px 16px rgba(0,0,0,0.22);
}

.stw-hold-overlay::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
	background:
		linear-gradient(to right,  rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) 4px 4px / 8px 8px no-repeat,
		linear-gradient(to bottom, rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) 4px 4px / 8px 8px no-repeat,
		linear-gradient(to left,   rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) calc(100% - 4px) 4px / 8px 8px no-repeat,
		linear-gradient(to bottom, rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) calc(100% - 4px) 4px / 8px 8px no-repeat,
		linear-gradient(to right,  rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) 4px calc(100% - 4px) / 8px 8px no-repeat,
		linear-gradient(to top,    rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) 4px calc(100% - 4px) / 8px 8px no-repeat,
		linear-gradient(to left,   rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) calc(100% - 4px) calc(100% - 4px) / 8px 8px no-repeat,
		linear-gradient(to top,    rgba(255,255,255,0.7) 0, rgba(255,255,255,0.7) 1px, transparent 1px) calc(100% - 4px) calc(100% - 4px) / 8px 8px no-repeat;
}

.stw-hold-overlay__liquid {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	transform: translateY(var(--stw-offset, 100%));
	transform-origin: bottom center;
	will-change: transform;
	border-radius: 0 0 5px 5px;
	background-color: currentColor;
	background-image: linear-gradient(
		to bottom,
		rgba(255,255,255,0.25) 0%,
		rgba(255,255,255,0.05) 30%,
		rgba(0,0,0,0.08) 100%
	);
}

.stw-hold-overlay__wave {
	position: absolute;
	top: -8px;
	left: 0;
	width: 200%;
	height: 18px;
	display: block;
	opacity: 0.85;
	fill: currentColor;
}

.stw-hold-overlay__wave--back {
	top: -5px;
	opacity: 0.40;
}

.stw-hold-overlay__liquid.is-waving .stw-hold-overlay__wave {
	animation: stw-wave 7s ease-in-out infinite;
}
.stw-hold-overlay__liquid.is-waving .stw-hold-overlay__wave--back {
	animation: stw-wave 9s ease-in-out infinite reverse;
}

@keyframes stw-wave {
	0%   { transform: translateX(0)      translateY(0px); }
	40%  { transform: translateX(-20%)   translateY(-2px); }
	100% { transform: translateX(-50%)   translateY(0px); }
}

.stw-hold-overlay__content {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 6px 4px;
	text-align: center;
	box-sizing: border-box;
	overflow: hidden;
	background: none !important;
}

.stw-hold-overlay__pct {
	font-size: clamp( 14px, 2.2vw, 20px );
	font-weight: 800;
	color: #ffffff;
	line-height: 1;
	text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.stw-hold-overlay__name {
	font-size: clamp( 9px, 1.3vw, 11px );
	font-weight: 700;
	color: #ffffff;
	text-shadow: 0 1px 3px rgba(0,0,0,0.4);
	margin-top: 3px;
}

.stw-hold-overlay__cargo {
	font-size: clamp( 8px, 1.1vw, 10px );
	font-weight: 500;
	color: rgba(255,255,255,0.9);
	text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.stw-hold-overlay__tonnage {
	font-size: clamp( 9px, 1.3vw, 11px );
	font-weight: 700;
	color: #ffffff;
	text-shadow: 0 1px 3px rgba(0,0,0,0.4);
	margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/* Bottom hold cards grid                                               */
/* ------------------------------------------------------------------ */
.stw-cards-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
}

.stw-hold-card {
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 14px;
	padding: 16px;
	box-shadow: 0 1px 8px 0 rgba(15, 23, 42, 0.05);
}

.stw-hold-card--empty {
	opacity: 0.4;
	pointer-events: none;
}

.stw-hold-card__head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 12px;
}

.stw-hold-card__head-left {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.stw-hold-card__icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1.5px solid currentColor;
	border-radius: 6px;
	flex-shrink: 0;
	margin-top: 1px;
}

.stw-hold-card__name {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.2;
}

.stw-hold-card__cargo {
	font-size: 12px;
	color: #94a3b8;
	margin-top: 1px;
}

.stw-hold-card__pct {
	font-size: 24px;
	font-weight: 800;
	line-height: 1;
	flex-shrink: 0;
}

.stw-hold-card__pct-sym {
	font-size: 16px;
	font-weight: 700;
}

/* ---- V7: Glass Panel Tonaj Kutusu ---- */
.stw-hold-card__glass-box {
	position: relative;
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 14px;
	min-height: 76px;
	/* Glass frame — overlay ile aynı görsel dil */
	border: 1.5px solid rgba(255,255,255,0.55);
	background: rgba(10,20,40,0.12);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,0.30),
		inset 0 -1px 0 rgba(0,0,0,0.18),
		0 4px 16px rgba(0,0,0,0.15);
}

.stw-hold-card__glass-liquid {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	transform: translateY(var(--stw-offset, 100%));
	transform-origin: bottom center;
	will-change: transform;
	border-radius: 0 0 9px 9px;
	background-color: currentColor;
	background-image: linear-gradient(
		to bottom,
		rgba(255,255,255,0.25) 0%,
		rgba(255,255,255,0.05) 30%,
		rgba(0,0,0,0.08) 100%
	);
}

.stw-hold-card__glass-wave {
	position: absolute;
	top: -8px;
	left: 0;
	width: 200%;
	height: 18px;
	display: block;
	opacity: 0.85;
	fill: currentColor;
}

.stw-hold-card__glass-wave--back {
	top: -5px;
	opacity: 0.40;
}

.stw-hold-card__glass-liquid.is-waving .stw-hold-card__glass-wave {
	animation: stw-wave 7s ease-in-out infinite;
}
.stw-hold-card__glass-liquid.is-waving .stw-hold-card__glass-wave--back {
	animation: stw-wave 9s ease-in-out infinite reverse;
}

.stw-hold-card__glass-content {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 16px 12px;
	text-align: center;
	box-sizing: border-box;
}

.stw-hold-card__tonnage-val {
	font-size: 22px;
	font-weight: 800;
	color: #ffffff;
	line-height: 1;
	text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.stw-hold-card__tonnage-max {
	font-size: 12px;
	font-weight: 500;
	color: rgba(255,255,255,0.75);
	margin-top: 4px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.stw-hold-card__rows {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
}

.stw-hold-card__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
}

.stw-hold-card__row-label {
	font-size: 12px;
	color: #94a3b8;
	white-space: nowrap;
}

.stw-hold-card__row-value {
	font-size: 12px;
	font-weight: 600;
	color: #0f172a;
	text-align: right;
}

.stw-hold-card__row-value--loaded {
	font-weight: 700;
}

.stw-hold-card__bar-wrap {
	background: #f1f5f9;
	border-radius: 4px;
	height: 5px;
	overflow: hidden;
}

.stw-hold-card__bar-fill {
	height: 100%;
	border-radius: 4px;
}

/* ---- V7: Sefer Bilgisi ---- */
.stw-voyage {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid #f1f5f9;
}

.stw-voyage__title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	color: #0f172a;
	margin-bottom: 10px;
}

.stw-voyage__row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

.stw-voyage__row:last-child {
	margin-bottom: 0;
}

.stw-voyage__icon {
	font-size: 13px;
	flex-shrink: 0;
	line-height: 1;
}

.stw-voyage__label {
	font-size: 11px;
	font-weight: 500;
	color: #64748b;
	white-space: nowrap;
}

.stw-voyage__value {
	font-size: 12px;
	font-weight: 600;
	color: #0f172a;
	margin-left: auto;
	text-align: right;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */
@media (max-width: 1024px) {
	.stw-cards-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.stw-widget-title {
		font-size: 32px;
	}

	.stw-outer-header__right {
		padding-top: 40px;
	}

	.stw-stage {
		aspect-ratio: 16 / 9;
	}

	.stw-hold-overlay__content,
	.stw-hold-overlay__fill {
		box-sizing: border-box;
	}
}

@media (max-width: 768px) {
	.stw-outer-header {
		flex-direction: column;
		gap: 16px;
	}

	.stw-outer-header__right {
		padding-top: 0;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		gap: 16px;
		width: 100%;
	}

	.stw-widget-title {
		font-size: 26px;
	}

	.stw-panel__topbar {
		flex-wrap: wrap;
		gap: 10px;
		padding: 14px 16px;
	}

	.stw-panel__updated {
		margin-left: 0;
		text-align: left;
		width: 100%;
	}

	.stw-panel__updated-header {
		justify-content: flex-start;
	}

	.stw-panel__topbar-specs {
		width: 100%;
	}

	.stw-cards-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.stw-stage {
		aspect-ratio: 4 / 3;
		min-height: 180px;
	}

	.stw-hold-overlay {
		transform: translateZ(0);
	}
	.stw-hold-overlay__content {
		max-height: 100%;
	}

	.stw-hold-card {
		padding: 14px;
	}

	.stw-hold-card__tonnage-val {
		font-size: 18px;
	}

	.stw-hold-card__pct {
		font-size: 20px;
	}
}

@media (max-width: 480px) {
	.stw-widget-title {
		font-size: 22px;
	}

	.stw-panel__topbar-left {
		flex-wrap: wrap;
	}

	.stw-cards-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.stw-stage {
		aspect-ratio: 1 / 1;
		min-height: 200px;
	}

	.stw-other-nav {
		gap: 6px;
	}

	.stw-arrow {
		width: 40px;
		height: 40px;
	}

	.stw-hold-card__glass-content {
		padding: 12px 10px;
	}

	.stw-hold-card__tonnage-val {
		font-size: 16px;
	}

	.stw-hold-card__pct {
		font-size: 18px;
	}
}

/* ===================================================================
   V5 — RESPONSIVE CALIBRATION (device-specific overlay positions)
   =================================================================== */

@media (max-width: 1024px) {
	.stw-hold-overlay {
		left: attr(data-tx percentage, 20%) !important;
		top: attr(data-ty percentage, 40%) !important;
		width: attr(data-tw percentage, 18%) !important;
		height: attr(data-th percentage, 50%) !important;
	}
}

@media (max-width: 768px) {
	.stw-hold-overlay {
		left: attr(data-mx percentage, 20%) !important;
		top: attr(data-my percentage, 40%) !important;
		width: attr(data-mw percentage, 18%) !important;
		height: attr(data-mh percentage, 50%) !important;
	}
}

.stw-hold-overlay {
	max-width: 100%;
	max-height: 100%;
}
.stw-hold-overlay__content {
	max-height: 100%;
}
