/* ============ LAYOUT — Sidebar + Main + Topbar ============ */

/* AUTH SCREEN */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  padding: 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}

.auth-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 1.5rem; }

.auth-form .form-group {
  text-align: left;
  margin-bottom: 1rem;
}
.auth-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.auth-form .btn { margin-top: 0.5rem; padding: 0.7rem; font-size: 0.95rem; }

.auth-toggle { margin-top: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.auth-toggle a { color: var(--accent); font-weight: 500; }
.auth-toggle a:hover { text-decoration: underline; }

.auth-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* APP LAYOUT */
.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { font-size: 1.4rem; }
.sidebar-title { font-size: 1.05rem; font-weight: 700; flex: 1; }

.sidebar-toggle {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}
.sidebar-toggle:hover { background: var(--bg-hover); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.nav-divider {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 1rem 0.8rem 0.4rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-left #sidebar-open { display: none; }

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all var(--transition);
}
.search-trigger:hover { border-color: var(--accent); }
.search-trigger svg { width: 16px; height: 16px; }
.search-hint { font-size: 0.7rem; opacity: 0.6; }

/* VIEWS CONTAINER */
.views-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

/* BOTTOM NAV (mobile only) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0.4rem 0;
  padding-bottom: env(safe-area-inset-bottom, 0.4rem);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  padding: 0.3rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { width: 20px; height: 20px; }