/* A-COSMOS Dashboard — Custom Styles */

:root {
	--primary: #003d7a;
	--accent: #0056b3;
	--sidebar-bg: #001f3f;
}

/* ── Brand / Sidebar ─────────────────────────────────── */
.brand-link {
	background: linear-gradient(135deg, #001428, #002855);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.main-sidebar {
	background: linear-gradient(180deg, #001f3f 0%, #002855 100%);
}
[class*='sidebar-dark'] .nav-sidebar .nav-link {
	color: rgba(255, 255, 255, 0.75);
}
[class*='sidebar-dark'] .nav-sidebar .nav-link.active {
	background: rgba(0, 86, 179, 0.65);
	color: #fff;
}
[class*='sidebar-dark'] .nav-sidebar .nav-link:hover {
	background: rgba(255, 255, 255, 0.07);
	color: #fff;
}

/* ── Navbar ──────────────────────────────────────────── */
.main-header {
	border-bottom: 1px solid #e4e7ea;
}

/* ── Info Boxes ──────────────────────────────────────── */
.info-box {
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.info-box .info-box-icon {
	border-radius: 8px 0 0 8px;
	font-size: 1.65rem;
}

/* ── Sensor Cards ────────────────────────────────────── */
.sensor-card {
	border-radius: 10px;
	border-left: 4px solid var(--accent);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	transition:
		transform 0.18s,
		box-shadow 0.18s;
}
.sensor-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.sensor-card .card-header {
	background: transparent;
	border-bottom: 1px solid #f0f0f0;
	font-weight: 600;
	font-size: 0.9rem;
	padding: 0.6rem 1rem;
}
.sensor-val {
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1.1;
	color: #1a1a2e;
}
.sensor-unit {
	font-size: 0.8rem;
	color: #888;
	margin-top: 2px;
}
.sensor-meta {
	font-size: 0.75rem;
	color: #999;
}
.sensor-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
}
.sensor-item {
	flex: 1 1 46%;
	padding: 0.55rem 0.75rem;
	border-right: 1px solid #f0f0f0;
	border-bottom: 1px solid #f0f0f0;
}
.sensor-item:nth-child(even) {
	border-right: none;
}
.sensor-item:nth-last-child(-n + 2) {
	border-bottom: none;
}

/* ── Status dot ──────────────────────────────────────── */
.status-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	margin-right: 5px;
}
.status-dot.online {
	background: #28a745;
	box-shadow: 0 0 5px #28a745;
	animation: blink 2s infinite;
}
.status-dot.offline {
	background: #dc3545;
}
@keyframes blink {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.35;
	}
}

/* ── Relay Cards ─────────────────────────────────────── */
.relay-card {
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
	transition: transform 0.18s;
}
.relay-card:hover {
	transform: translateY(-2px);
}
.relay-card .card-header {
	padding: 0.6rem 0.9rem;
	font-size: 0.85rem;
	font-weight: 600;
}
.relay-on .card-header {
	background: linear-gradient(135deg, #28a745, #20c997);
	color: #fff;
}
.relay-off .card-header {
	background: #f1f3f5;
	color: #555;
}
.relay-on .card-body {
	background: #f0fff4;
}
.relay-off .card-body {
	background: #fbfbfb;
}
.relay-btn {
	width: 100%;
	font-weight: 600;
	letter-spacing: 0.3px;
}

/* ── Chart containers ────────────────────────────────── */
.chart-wrap {
	position: relative;
	height: 220px;
}
.chart-wrap-lg {
	position: relative;
	height: 280px;
}

/* ── Table ───────────────────────────────────────────── */
.table-sm td,
.table-sm th {
	font-size: 0.82rem;
}
.table-hover tbody tr:hover {
	background-color: #f0f6ff;
}

/* ── Page title ──────────────────────────────────────── */
.content-header h1 {
	font-size: 1.4rem;
	font-weight: 600;
}

/* ── Login page ──────────────────────────────────────── */
.login-page {
	background: linear-gradient(135deg, #001428 0%, #003d7a 50%, #0056b3 100%);
	min-height: 100vh;
}
.login-logo a {
	color: #fff !important;
	letter-spacing: 1px;
}
.login-box {
	width: 400px;
}
.login-card-body {
	border-radius: 8px;
	padding: 2rem;
}

/* ── Last update badge ───────────────────────────────── */
.last-update {
	font-size: 0.73rem;
	color: #aaa;
}
.last-update.fresh {
	color: #28a745;
}

/* ── Mobile tweaks ───────────────────────────────────── */
@media (max-width: 576px) {
	.sensor-val {
		font-size: 1.35rem;
	}
	.login-box {
		width: 95%;
	}
	.relay-card {
		margin-bottom: 8px;
	}
}

/* ── Alert compact ───────────────────────────────────── */
.alert-compact {
	padding: 0.4rem 0.75rem;
	font-size: 0.85rem;
}
