:root {
	--bg-primary: #ffffff;
	--bg-secondary: #f5f7fa;
	--text-primary: #1f2937;
	--text-secondary: #6b7280;
	--border-color: #e5e7eb;
	--accent: #3b82f6;
	--accent-hover: #2563eb;
	--danger: #ef4444;
	--success: #22c55e;
	--warning: #f59e0b;
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	background: var(--bg-secondary);
	color: var(--text-primary);
	line-height: 1.6;
	min-height: 100vh;
}

.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

header {
	background: var(--bg-primary);
	border-bottom: 1px solid var(--border-color);
	padding: 16px 0;
	box-shadow: var(--shadow);
}

header .container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 20px;
}

h1 {
	font-size: 1.5rem;
	font-weight: 600;
}

h2 {
	font-size: 1.25rem;
	font-weight: 600;
	margin-bottom: 16px;
}

.card {
	background: var(--bg-primary);
	border-radius: 12px;
	padding: 20px;
	box-shadow: var(--shadow);
	margin-bottom: 20px;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 20px;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
}

.btn-primary {
	background: var(--accent);
	color: white;
}

.btn-primary:hover {
	background: var(--accent-hover);
}

.btn-danger {
	background: var(--danger);
	color: white;
}

.btn-danger:hover {
	background: #dc2626;
}

.btn-secondary {
	background: var(--bg-secondary);
	color: var(--text-primary);
	border: 1px solid var(--border-color);
}

.btn-secondary:hover {
	background: #e5e7eb;
}

.input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	font-size: 14px;
	transition: border-color 0.2s;
}

.input:focus {
	outline: none;
	border-color: var(--accent);
}

.form-group {
	margin-bottom: 16px;
}

.form-group label {
	display: block;
	margin-bottom: 6px;
	font-weight: 500;
	font-size: 14px;
}

.devices-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.device-card {
	background: var(--bg-primary);
	border-radius: 12px;
	padding: 16px;
	box-shadow: var(--shadow);
	position: relative;
	transition: background 0.3s;
}

/* Offline device - gray background */
.device-card.device-offline {
	background: #d1d5db;
}

/* Charging device - light green/yellow tint background */
.device-card.device-charging {
	background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
	border: 1px solid #6ee7b7;
}

.device-card .battery-value {
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--accent);
}

.device-card .battery-status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 14px;
	color: var(--text-secondary);
}

.device-card .charging {
	color: var(--success);
}

.device-card .battery-icon {
	position: relative;
	width: 60px;
	height: 28px;
	border: 2px solid var(--text-primary);
	border-radius: 4px;
	margin-left: 8px;
}

.device-card .battery-icon::before {
	content: '';
	position: absolute;
	right: -6px;
	top: 50%;
	transform: translateY(-50%);
	width: 4px;
	height: 12px;
	background: var(--text-primary);
	border-radius: 0 2px 2px 0;
}

.device-card .battery-fill {
	position: absolute;
	left: 2px;
	top: 2px;
	bottom: 2px;
	background: var(--success);
	border-radius: 2px;
	transition: width 0.3s;
}

.chart-container {
	background: var(--bg-primary);
	border-radius: 12px;
	padding: 20px;
	box-shadow: var(--shadow);
	height: 600px;
}

.modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.modal-content {
	background: var(--bg-primary);
	border-radius: 12px;
	padding: 24px;
	width: 90%;
	max-width: 400px;
	box-shadow: var(--shadow-lg);
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.modal-close {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: var(--text-secondary);
}

.hidden {
	display: none !important;
}

.qr-code {
	display: flex;
	justify-content: center;
	margin: 20px 0;
}

.qr-code img {
	border: 1px solid var(--border-color);
	border-radius: 8px;
	padding: 10px;
	background: white;
}

.url-display {
	background: var(--bg-secondary);
	padding: 12px;
	border-radius: 8px;
	font-family: monospace;
	font-size: 12px;
	word-break: break-all;
	text-align: center;
	margin-top: 12px;
}

table {
	width: 100%;
	border-collapse: collapse;
}

th, td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid var(--border-color);
}

th {
	font-weight: 600;
	font-size: 14px;
	color: var(--text-secondary);
}

tr:last-child td {
	border-bottom: none;
}

.actions {
	display: flex;
	gap: 8px;
}

.toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	padding: 12px 20px;
	background: var(--text-primary);
	color: white;
	border-radius: 8px;
	box-shadow: var(--shadow-lg);
	z-index: 2000;
	animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		transform: translateY(100%);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

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

	.card {
		padding: 16px;
	}

	.btn {
		width: 100%;
	}
}

/* Device header for offline badge */
.device-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

/* Offline badge */
.offline-badge {
	background: #9ca3af;
	color: white;
	font-size: 10px;
	padding: 2px 8px;
	border-radius: 12px;
	font-weight: 500;
}

/* Chart controls */
.chart-controls {
	display: flex;
	justify-content: flex-end;
	padding: 8px 20px;
	gap: 8px;
}

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