/* ============================================
   layout.css — App Shell 版型 (Sidebar / Navbar / Content)
   ============================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ================= Sidebar ================= */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(8, 11, 17, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  white-space: nowrap;
  letter-spacing: 1px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(0, 240, 255, 0.05);
  color: var(--neon-cyan);
  text-decoration: none;
}

.nav-item.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-left-color: var(--neon-cyan);
  box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.05);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-group-title {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 16px 20px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-sub .nav-item { padding-left: 42px; font-size: 13px; }

/* 摺疊狀態（桌面） */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-title { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; }

/* ================= Main Area ================= */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ================= Navbar ================= */
.navbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(8, 11, 17, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.navbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hamburger {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--neon-cyan);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.hamburger:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover);
}

/* ================= Content ================= */
.content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-header { margin-bottom: 24px; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ================= Grid ================= */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ================= 響應式 ================= */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }

  /* 手機：Sidebar 變抽屜 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
  }
  .sidebar-backdrop.active { display: block; }
}
