/*
 * css/layout.css
 *
 * Structural layout: sidebar, topbar, main content area.
 * Only concerns itself with positioning and flow —
 * visual decoration lives in components.css.
 */

/* Root flex container that fills the viewport */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar (app-style light cards) ---- */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ---- Main area (topbar + scrollable content) ---- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Topbar matches app header: Guardian title, MQTT status, actions */
.topbar {
  height: 56px;
  min-height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* MQTT status indicator (green checkmark + text like app) */
.topbar-mqtt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
}

/* Scrollable content area beneath the topbar */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-base);
}

/* Page title (app-style section heading below header) */
.page-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px 0;
  letter-spacing: -0.3px;
}

/* Login screen (full viewport, no sidebar) - app light theme */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(63, 81, 181, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(33, 150, 243, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

/* Two-column grid used in Overview and Profile */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Full-height centering utility for loading / error states */
.fill-center {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

/* ---- Bottom nav (app-style, mobile) ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--nav-bg);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  transition: background 0.2s, color 0.2s;
  flex: 1;
  max-width: 80px;
}

.bottom-nav-item:hover {
  color: #fff;
}

.bottom-nav-item.active {
  background: var(--nav-active);
  color: #fff;
}

.bottom-nav-item svg {
  margin-bottom: 4px;
}

/* Mobile: hide sidebar, show bottom nav, add content padding */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  .content {
    padding-bottom: 88px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}
