/* main.css — Base Reset, Sidebar Layout, Typography */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import 'theme.css';
@import 'components.css';
@import 'animations.css';

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ─── App Shell ───────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 20px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  flex: 1;
}

.nav-item {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  flex-direction: column;
  gap: 3px;
}

.nav-item svg { width: 18px; height: 18px; }

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.nav-item .nav-label {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

/* ─── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Top Header ───────────────────────────────────────────────────────────── */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  flex-shrink: 0;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-brand h1 {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header-brand p {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: -1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.esp32-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--green-dim);
  border: 1px solid rgba(0,230,118,0.2);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--green);
}

.esp32-chip.offline {
  background: var(--red-dim);
  border-color: rgba(255,23,68,0.2);
  color: var(--red);
}

.esp32-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.esp32-chip.offline .esp32-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  animation: none;
}

.icon-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card-2);
  color: var(--text-primary);
}

/* ─── Dashboard Scroll Area ─────────────────────────────────────────────────── */
.dashboard {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Section helpers ──────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
  background: var(--bg-sidebar);
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
}
