/* ==========================================================================
   BCM Speedtest - presentation layer
   Sits on top of Bootstrap 4 / MDB 4.8 and only styles .bcm-* components plus
   a few narrowly scoped overrides, so the rest of the MDB theme is untouched.
   ========================================================================== */

:root {
	--bcm-blue: #3a5999;
	--bcm-blue-dark: #2c4478;
	--bcm-blue-light: #6d86c4;
	--bcm-teal: #00b9b2;
	--bcm-teal-dark: #009b95;
	--bcm-ink: #1f2733;
	--bcm-muted: #6b7788;
	--bcm-line: #e3e8ef;
	--bcm-surface: #ffffff;
	--bcm-canvas: #f4f6fb;
	--bcm-warn: #f0a202;
	--bcm-danger: #d64550;
	--bcm-radius: 8px;
	--bcm-radius-sm: 5px;
	--bcm-shadow: 0 1px 2px rgba(31, 39, 51, .05), 0 8px 24px -12px rgba(31, 39, 51, .18);
	--bcm-shadow-lg: 0 2px 4px rgba(31, 39, 51, .06), 0 18px 40px -18px rgba(31, 39, 51, .28);
}

.bcm-page {
	background: var(--bcm-canvas);
	color: var(--bcm-ink);
	font-feature-settings: "tnum" 1;
	text-align: left;
}

.bcm-page a { color: var(--bcm-blue); }
.bcm-page a:hover { color: var(--bcm-blue-dark); }

/* --- Header ------------------------------------------------------------- */

/* Only a brand and two icons live here, so no collapsing menu is needed -
   the bar keeps the same shape on every screen size. */
.bcm-navbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .6rem 1rem;
	background: linear-gradient(120deg, var(--bcm-blue-dark) 0%, var(--bcm-blue) 55%, var(--bcm-teal) 160%);
	box-shadow: 0 2px 16px -6px rgba(31, 39, 51, .5);
}

.bcm-navbar__brand { display: inline-flex; align-items: center; }
.bcm-navbar__brand img { height: 30px; width: auto; display: block; }

.bcm-navbar__links { display: flex; align-items: center; gap: .35rem; }

.bcm-page .bcm-navbar__links a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	color: rgba(255, 255, 255, .85);
	border-radius: var(--bcm-radius-sm);
	text-decoration: none;
	transition: color .15s ease, background .15s ease;
}

.bcm-page .bcm-navbar__links a:hover { color: #fff; background: rgba(255, 255, 255, .14); }

.bcm-hero {
	padding: 2rem 0 .5rem;
}

.bcm-hero h1 {
	font-size: 1.75rem;
	font-weight: 700;
	letter-spacing: -.02em;
	margin: 0 0 .35rem;
}

.bcm-hero p {
	color: var(--bcm-muted);
	margin: 0;
}

/* --- Cards -------------------------------------------------------------- */

.bcm-card {
	background: var(--bcm-surface);
	border: 1px solid var(--bcm-line);
	border-radius: var(--bcm-radius);
	box-shadow: var(--bcm-shadow);
	padding: 1.25rem;
	margin-bottom: 1.25rem;
}

.bcm-card--flush { padding: 0; overflow: hidden; }

.bcm-card__title {
	font-size: .8rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--bcm-muted);
	margin: 0 0 1rem;
}

/* --- Control bar -------------------------------------------------------- */

/* The server block carries a label above the select, so centring would push
   the button half a line too high. Align on the baseline row instead. */
.bcm-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: .75rem;
}

.bcm-controls__server {
	flex: 1 1 260px;
	min-width: 0;
}

.bcm-controls__server label {
	display: block;
	font-size: .75rem;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--bcm-muted);
	margin: 0 0 .3rem;
}

.bcm-page select.bcm-select {
	width: 100%;
	height: 2.7rem;
	padding: 0 .8rem;
	font-size: .95rem;
	color: var(--bcm-ink);
	background-color: #fff;
	border: 1px solid var(--bcm-line);
	border-radius: var(--bcm-radius-sm);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.bcm-page select.bcm-select:focus {
	outline: 0;
	border-color: var(--bcm-blue-light);
	box-shadow: 0 0 0 3px rgba(58, 89, 153, .15);
}

.bcm-page select.bcm-select:disabled {
	background-color: #f1f3f8;
	color: var(--bcm-muted);
}

.bcm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-width: 168px;
	height: 2.7rem;
	padding: 0 1.4rem;
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: linear-gradient(135deg, var(--bcm-blue) 0%, var(--bcm-blue-dark) 100%);
	border: 0;
	border-radius: var(--bcm-radius-sm);
	cursor: pointer;
	box-shadow: 0 6px 18px -8px rgba(58, 89, 153, .9);
	transition: transform .12s ease, box-shadow .15s ease, background .2s ease, opacity .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.bcm-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(58, 89, 153, .95); color: #fff; }
.bcm-btn:active:not(:disabled) { transform: translateY(0); }
.bcm-btn:focus-visible { outline: 3px solid rgba(58, 89, 153, .35); outline-offset: 2px; }
.bcm-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.bcm-btn--stop { background: linear-gradient(135deg, #e2565f 0%, var(--bcm-danger) 100%); box-shadow: 0 6px 18px -8px rgba(214, 69, 80, .9); }
.bcm-btn--stop:hover:not(:disabled) { box-shadow: 0 10px 24px -10px rgba(214, 69, 80, .95); }

.bcm-btn--ghost {
	min-width: 0;
	height: auto;
	padding: .5rem 1.1rem;
	font-size: .85rem;
	color: var(--bcm-blue);
	background: #fff;
	border: 1px solid var(--bcm-blue-light);
	box-shadow: none;
}
.bcm-btn--ghost:hover:not(:disabled) { color: var(--bcm-blue-dark); background: #f3f6fd; box-shadow: none; }

/* `.bcm-page a` is more specific than `.bcm-btn`, so links styled as buttons
   need their colour restated or they inherit the plain link colour. */
.bcm-page a.bcm-btn { color: #fff; }
.bcm-page a.bcm-btn:hover { color: #fff; }
.bcm-page a.bcm-btn--ghost { color: var(--bcm-blue); }
.bcm-page a.bcm-btn--ghost:hover { color: var(--bcm-blue-dark); }

/* --- Gauges ------------------------------------------------------------- */

.bcm-gauges {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

@media (max-width: 575px) {
	.bcm-gauges { grid-template-columns: minmax(0, 1fr); }
}

.bcm-gauge {
	position: relative;
	text-align: center;
	padding: .5rem .25rem 0;
}

.bcm-gauge__svg { display: block; width: 100%; max-width: 280px; margin: 0 auto; height: auto; }

.bcm-gauge__label {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	font-size: .8rem;
	font-weight: 600;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--bcm-muted);
}

.bcm-gauge__label .bcm-dot {
	width: .55rem;
	height: .55rem;
	border-radius: 50%;
	background: currentColor;
}

.bcm-gauge--dl .bcm-gauge__label .bcm-dot { color: var(--bcm-blue); }
.bcm-gauge--ul .bcm-gauge__label .bcm-dot { color: var(--bcm-teal); }

.bcm-gauge__value {
	font-size: 2.4rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.03em;
	font-variant-numeric: tabular-nums;
}

.bcm-gauge__unit { font-size: .8rem; color: var(--bcm-muted); letter-spacing: .05em; }

/* --- Stat tiles (ping / jitter / traffic) ------------------------------- */

.bcm-stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: .75rem;
}

@media (max-width: 767px) { .bcm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bcm-stat {
	background: var(--bcm-surface);
	border: 1px solid var(--bcm-line);
	border-radius: var(--bcm-radius-sm);
	padding: .8rem .9rem;
}

.bcm-stat__label {
	display: flex;
	align-items: center;
	gap: .4rem;
	font-size: .7rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--bcm-muted);
	margin-bottom: .3rem;
}

.bcm-stat__value {
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bcm-stat__value small { font-size: .65em; font-weight: 500; color: var(--bcm-muted); margin-left: .15em; }

/* --- Progress ----------------------------------------------------------- */

.bcm-progress {
	position: relative;
	height: 8px;
	border-radius: 4px;
	background: #e8ecf5;
	overflow: hidden;
}

.bcm-progress__bar {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: 4px;
	background: linear-gradient(90deg, var(--bcm-blue) 0%, var(--bcm-teal) 100%);
	transition: width .35s ease;
}

.bcm-phase {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: .5rem;
	margin-top: .6rem;
	font-size: .8rem;
	color: var(--bcm-muted);
}

.bcm-phase__name { font-weight: 600; color: var(--bcm-ink); }

/* --- Live chart --------------------------------------------------------- */

.bcm-chart { position: relative; width: 100%; height: 170px; }
.bcm-chart canvas { display: block; width: 100%; height: 100%; }

.bcm-legend {
	display: flex;
	gap: 1.1rem;
	justify-content: flex-end;
	font-size: .78rem;
	color: var(--bcm-muted);
}

.bcm-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.bcm-legend i { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.bcm-legend .is-dl { color: var(--bcm-blue); }
.bcm-legend .is-ul { color: var(--bcm-teal); }
.bcm-legend__hint { opacity: .7; font-style: italic; }

@media (max-width: 575px) {
	.bcm-legend__hint { display: none; }
}

/* --- Queue panel -------------------------------------------------------- */

.bcm-queue {
	border: 1px solid #cfe0f5;
	border-left: 4px solid var(--bcm-blue);
	background: linear-gradient(180deg, #f7faff 0%, #fff 100%);
	border-radius: var(--bcm-radius);
	padding: 1.1rem 1.25rem;
	margin-bottom: 1.25rem;
}

.bcm-queue--turn { border-color: #b6ece9; border-left-color: var(--bcm-teal); background: linear-gradient(180deg, #f2fdfc 0%, #fff 100%); }

.bcm-queue__head { display: flex; align-items: center; gap: .85rem; }

.bcm-queue__badge {
	flex: 0 0 auto;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 60px;
	padding: .45rem .6rem;
	border-radius: var(--bcm-radius-sm);
	background: var(--bcm-blue);
	color: #fff;
	line-height: 1;
}

.bcm-queue--turn .bcm-queue__badge { background: var(--bcm-teal); }
.bcm-queue__badge b { font-size: 1.5rem; font-weight: 700; }
.bcm-queue__badge span { font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; margin-top: .15rem; }

.bcm-queue__text { flex: 1 1 auto; min-width: 0; }
.bcm-queue__text strong { display: block; font-size: 1rem; }
.bcm-queue__text p { margin: .2rem 0 0; font-size: .85rem; color: var(--bcm-muted); }

.bcm-queue__actions { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.bcm-note {
	display: flex;
	gap: .6rem;
	align-items: flex-start;
	font-size: .82rem;
	line-height: 1.45;
	color: var(--bcm-muted);
	background: #fffaf0;
	border: 1px solid #f6e3bd;
	border-radius: var(--bcm-radius-sm);
	padding: .65rem .8rem;
	margin-top: .9rem;
}

.bcm-note i { color: var(--bcm-warn); margin-top: .15rem; }

/* --- Loading ------------------------------------------------------------ */

.bcm-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .7rem;
	color: var(--bcm-muted);
	padding: 1.75rem 0;
}

.bcm-spinner {
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid rgba(58, 89, 153, .25);
	border-top-color: var(--bcm-blue);
	border-radius: 50%;
	animation: bcm-spin .7s linear infinite;
}

@keyframes bcm-spin { to { transform: rotate(360deg); } }

.bcm-hidden { display: none !important; }

.bcm-fade-in { animation: bcm-fade .35s ease both; }
@keyframes bcm-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
	.bcm-fade-in, .bcm-spinner { animation: none; }
	.bcm-progress__bar, .bcm-btn { transition: none; }
}

/* --- Tabs --------------------------------------------------------------- */

.bcm-tabs { display: flex; gap: .4rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

.bcm-tabs a {
	flex: 1 1 auto;
	text-align: center;
	padding: .6rem 1rem;
	font-size: .9rem;
	font-weight: 600;
	color: var(--bcm-muted);
	background: #fff;
	border: 1px solid var(--bcm-line);
	border-radius: var(--bcm-radius-sm);
	text-decoration: none;
	transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.bcm-tabs a:hover { color: var(--bcm-blue); border-color: var(--bcm-blue-light); }
.bcm-tabs a.is-active { color: #fff; background: var(--bcm-blue); border-color: var(--bcm-blue); }

/* --- Result modal ------------------------------------------------------- */

.bcm-modal .modal-content { border: 0; border-radius: var(--bcm-radius); box-shadow: var(--bcm-shadow-lg); overflow: hidden; }

.bcm-modal .modal-header {
	align-items: center;
	gap: .85rem;
	background: linear-gradient(120deg, var(--bcm-blue-dark) 0%, var(--bcm-blue) 60%, var(--bcm-teal) 165%);
	color: #fff;
	border-bottom: 0;
}

.bcm-modal .modal-header .close { color: #fff; opacity: .85; text-shadow: none; }
.bcm-modal .modal-title { font-size: 1.05rem; font-weight: 600; }

.bcm-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }

.bcm-result {
	border: 1px solid var(--bcm-line);
	border-radius: var(--bcm-radius-sm);
	padding: .7rem .85rem;
}

.bcm-result__label { font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--bcm-muted); }
.bcm-result__value { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bcm-result__value small { font-size: .6em; font-weight: 500; color: var(--bcm-muted); }

.bcm-result--dl .bcm-result__value { color: var(--bcm-blue); }
.bcm-result--ul .bcm-result__value { color: var(--bcm-teal); }

.bcm-meta { font-size: .8rem; color: var(--bcm-muted); margin-top: .85rem; line-height: 1.5; }
.bcm-meta strong { color: var(--bcm-ink); }

/* --- Info / footer ------------------------------------------------------ */

.bcm-info { font-size: .85rem; line-height: 1.6; color: var(--bcm-muted); }
.bcm-info h3 { font-size: .95rem; font-weight: 700; color: var(--bcm-ink); margin: 0 0 .35rem; }
.bcm-info section + section { margin-top: 1rem; }

.bcm-footer { text-align: center; font-size: .82rem; color: var(--bcm-muted); padding: 1.5rem 0 2rem; }
.bcm-footer__sep { margin: 0 .45rem; opacity: .5; }

/* --- Gate page (non-subscriber) ----------------------------------------- */

.bcm-gate { max-width: 640px; margin: 0 auto; padding: 2.5rem 0; }
.bcm-gate__logo { display: block; width: 150px; margin: 0 auto 1.5rem; }
.bcm-gate .bcm-card { text-align: center; }
.bcm-gate__ip { font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; }
.bcm-gate__phones { list-style: none; padding: 0; margin: .5rem 0 0; font-weight: 600; }
